[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28755.1579100378@warthog.procyon.org.uk>
Date: Wed, 15 Jan 2020 14:59:38 +0000
From: David Howells <dhowells@...hat.com>
To: Christoph Hellwig <hch@....de>
Cc: dhowells@...hat.com, Qu Wenruo <quwenruo.btrfs@....com>,
Andreas Dilger <adilger@...ger.ca>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
"Theodore Y. Ts'o" <tytso@....edu>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
linux-ext4 <linux-ext4@...r.kernel.org>,
linux-xfs <linux-xfs@...r.kernel.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Problems with determining data presence by examining extents?
Christoph Hellwig <hch@....de> wrote:
> > Another thread could be writing to the file, and the raciness matters if I
> > want to cache the result of calling SEEK_HOLE - though it might be possible
> > just to mask it off.
>
> Well, if you have other threads changing the file (writing, punching holes,
> truncating, etc) you have lost with any interface that isn't an atomic
> give me that data or tell me its a hole. And even if that if you allow
> threads that aren't part of your fscache implementation to do the
> modifications you have lost. If on the other hand they are part of
> fscache you should be able to synchronize your threads somehow.
Another thread could be writing to the file at the same time, but not in the
same block. That's managed by netfs, most likely based on the pages and page
flags attached to the netfs inode being cached in this particular file[*].
What I was more thinking of is that SEEK_HOLE might run past the block of
interest and into a block that's currently being written and see a partially
written block.
[*] For AFS, this is only true of regular files; dirs and symlinks are cached
as monoliths and are there entirely or not at all.
> > However, SEEK_HOLE doesn't help with the issue of the filesystem 'altering'
> > the content of the file by adding or removing blocks of zeros.
>
> As does any other method. If you need that fine grained control you
> need to track the information yourself.
So, basically, I can't. Okay. I was hoping it might be possible to add an
ioctl or something to tell filesystems not to do that with particular files.
David
Powered by blists - more mailing lists