public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>
Subject: Strange SEEK_HOLE / SEEK_DATA behavior
Date: Mon, 26 Oct 2020 15:57:10 +0100	[thread overview]
Message-ID: <20201026145710.GF28769@quack2.suse.cz> (raw)

Hello!

When reviewing Matthew's THP patches I've noticed one odd behavior which
got copied from current iomap seek hole/data helpers. Currently we have:

# fallocate -l 4096 testfile
# xfs_io -x -c "seek -h 0" testfile
Whence	Result
HOLE	0
# dd if=testfile bs=4096 count=1 of=/dev/null
# xfs_io -x -c "seek -h 0" testfile
Whence	Result
HOLE	4096

So once we read from an unwritten extent, the areas with cached pages
suddently become treated as data. Later when pages get evicted, they become
treated as holes again. Strictly speaking I wouldn't say this is a bug
since nobody promises we won't treat holes as data but it looks weird.
Shouldn't we treat clean pages over unwritten extents still as holes and
only once the page becomes dirty treat is as data? What do other people
think?

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

             reply	other threads:[~2020-10-26 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 14:57 Jan Kara [this message]
2020-10-26 15:14 ` Strange SEEK_HOLE / SEEK_DATA behavior Matthew Wilcox
2020-10-26 16:48   ` Jan Kara

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=20201026145710.GF28769@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.org \
    /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