linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: dhowells@redhat.com, Qu Wenruo <quwenruo.btrfs@gmx.com>,
	Andreas Dilger <adilger@dilger.ca>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Problems with determining data presence by examining extents?
Date: Wed, 15 Jan 2020 14:59:38 +0000	[thread overview]
Message-ID: <28755.1579100378@warthog.procyon.org.uk> (raw)
In-Reply-To: <20200115144839.GA30301@lst.de>

Christoph Hellwig <hch@lst.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


  parent reply	other threads:[~2020-01-15 14:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 16:48 Problems with determining data presence by examining extents? David Howells
2020-01-14 22:49 ` Theodore Y. Ts'o
2020-01-15  3:54 ` Qu Wenruo
2020-01-15 12:46   ` Andreas Dilger
2020-01-15 13:10     ` Qu Wenruo
2020-01-15 13:31       ` Christoph Hellwig
2020-01-15 19:48         ` Andreas Dilger
2020-01-16 10:16           ` Christoph Hellwig
2020-01-15 20:55         ` David Howells
2020-01-15 22:11           ` Andreas Dilger
2020-01-15 23:09           ` David Howells
2020-01-26 18:19             ` Zygo Blaxell
2020-01-15 14:35       ` David Howells
2020-01-15 14:48         ` Christoph Hellwig
2020-01-15 14:59         ` David Howells [this message]
2020-01-16 10:13           ` Christoph Hellwig
2020-01-17 16:43           ` David Howells
2020-01-15 14:20   ` David Howells
2020-01-15  8:38 ` Christoph Hellwig
2020-01-15 13:50 ` David Howells
2020-01-15 14:05 ` David Howells
2020-01-15 14:24   ` Qu Wenruo
2020-01-15 14:50   ` David Howells
2020-01-15 14:15 ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28755.1579100378@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=adilger@dilger.ca \
    --cc=clm@fb.com \
    --cc=darrick.wong@oracle.com \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).