mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Timber <dxdt@dev.snart.me>
Cc: linkinjeon@kernel.org, sj1557.seo@samsung.com,
	yuezhang.mo@sony.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] exfat: EXFAT_IOC_GET_VALID_DATA ioctl
Date: Thu, 12 Mar 2026 14:57:04 +0000	[thread overview]
Message-ID: <abLUQECuMuxHNXjZ@casper.infradead.org> (raw)
In-Reply-To: <b216af63-f65e-4c26-84bc-2693fad0fdf1@dev.snart.me>

On Thu, Mar 12, 2026 at 11:02:29PM +0900, David Timber wrote:
> On 3/12/26 12:23, Matthew Wilcox wrote:
> > We already have two interfaces for this on Linux.  One is SEEK_HOLE /
> > SEEK_DATA and the other is fiemap (Documentation/filesystems/fiemap.rst)
> > Why are both of these interfaces unsuitable?
> https://lore.kernel.org/linux-fsdevel/cf6c2b08-b7ff-4f70-95f4-cdb12ef5a666@dev.snart.me/
> 
> Because exFAT is not a sparse file system. The VDL is only a shorthand
> for fast cluster allocation without writing actual data to them. In
> other words, the range between the VDL and isize is not actually a hole.
> The blocks in the range are actually allocated, filled with garbage data
> on the disk. The kernel has to be careful not to return it to userspace,
> which is something Linux kernel actually does.

Uh, no it's not.  If you try to read from the file at positions mapped
to those blocks, Linux will return zeroes.

You seem to be under the impression that SEEK_HOLE only finds blocks
which have not been allocated.  That's not the behaviour of any
filesystem whch uses iomap.  Look:

static int iomap_seek_hole_iter(struct iomap_iter *iter,
                loff_t *hole_pos)
{
        loff_t length = iomap_length(iter);

        switch (iter->iomap.type) {
        case IOMAP_UNWRITTEN:
                *hole_pos = mapping_seek_hole_data(iter->inode->i_mapping,
                                iter->pos, iter->pos + length, SEEK_HOLE);
                if (*hole_pos == iter->pos + length)
                        return iomap_iter_advance(iter, length);
                return 0;
        case IOMAP_HOLE:
                *hole_pos = iter->pos;
                return 0;

Yes, if there's literally a hole, that counts as a hole, but what you're
talking about is an unwritten extent.  And that counts as a hole
*unless* we've written to the page cache covering the hole.


  reply	other threads:[~2026-03-12 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 22:26 David Timber
2026-03-12  3:23 ` Matthew Wilcox
2026-03-12 14:02   ` David Timber
2026-03-12 14:57     ` Matthew Wilcox [this message]
2026-03-12 15:06       ` Darrick J. Wong
2026-03-13  7:59         ` David Timber
2026-03-13 13:59           ` Namjae Jeon
2026-03-13 16:24           ` Darrick J. Wong
2026-03-16 22:37             ` David Timber
2026-03-19  0:51               ` Namjae Jeon
2026-03-19  3:29                 ` David Timber

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=abLUQECuMuxHNXjZ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dxdt@dev.snart.me \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=yuezhang.mo@sony.com \
    /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

Powered by JetHome