[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <152281.1615281705@warthog.procyon.org.uk>
Date: Tue, 09 Mar 2021 09:21:45 +0000
From: David Howells <dhowells@...hat.com>
To: Dave Chinner <david@...morbit.com>
Cc: dhowells@...hat.com, Amir Goldstein <amir73il@...il.com>,
linux-cachefs@...hat.com, Jeff Layton <jlayton@...hat.com>,
David Wysochanski <dwysocha@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
"J. Bruce Fields" <bfields@...ldses.org>,
Christoph Hellwig <hch@...radead.org>,
Dave Chinner <dchinner@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-afs@...ts.infradead.org,
Linux NFS Mailing List <linux-nfs@...r.kernel.org>,
CIFS <linux-cifs@...r.kernel.org>,
ceph-devel <ceph-devel@...r.kernel.org>,
v9fs-developer@...ts.sourceforge.net,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Miklos Szeredi <miklos@...redi.hu>
Subject: Re: fscache: Redesigning the on-disk cache
Dave Chinner <david@...morbit.com> wrote:
> > > With ->fiemap() you can at least make the distinction between a non
> > > existing and an UNWRITTEN extent.
> >
> > I can't use that for XFS, Ext4 or btrfs, I suspect. Christoph and Dave's
> > assertion is that the cache can't rely on the backing filesystem's metadata
> > because these can arbitrarily insert or remove blocks of zeros to bridge or
> > split extents.
>
> Well, that's not the big problem. The issue that makes FIEMAP
> unusable for determining if there is user data present in a file is
> that on-disk extent maps aren't exactly coherent with in-memory user
> data state.
>
> That is, we can have a hole on disk with delalloc user data in
> memory. There's user data in the file, just not on disk. Same goes
> for unwritten extents - there can be dirty data in memory over an
> unwritten extent, and it won't get converted to written until the
> data is written back and the filesystem runs a conversion
> transaction.
>
> So, yeah, if you use FIEMAP to determine where data lies in a file
> that is being actively modified, you're going get corrupt data
> sooner rather than later. SEEK_HOLE/DATA are coherent with in
> memory user data, so don't have this problem.
I thought you and/or Christoph said it *was* a problem to use the backing
filesystem's metadata to track presence of data in the cache because the
filesystem (or its tools) can arbitrarily insert blocks of zeros to
bridge/break up extents.
If that is the case, then that is a big problem, and SEEK_HOLE/DATA won't
suffice.
If it's not a problem - maybe if I can set a mark on a file to tell the
filesystem and tools not to do that - then that would obviate the need for me
to store my own maps.
David
Powered by blists - more mailing lists