All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Daeho Jeong <daeho43@gmail.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: change fiemap way in printing compression chunk
Date: Thu, 22 Jul 2021 10:57:26 -0700	[thread overview]
Message-ID: <YPmxhiJrUazvHJTx@gmail.com> (raw)
In-Reply-To: <CACOAw_wGeX+D+Q7CDqi5Qt0YX=3YxZQwSf8ARiUhLUBANgs5ZQ@mail.gmail.com>

On Thu, Jul 22, 2021 at 10:55:01AM -0700, Daeho Jeong wrote:
> On Thu, Jul 22, 2021 at 10:36 AM Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > On Thu, Jul 22, 2021 at 09:33:59AM -0700, Daeho Jeong wrote:
> > > On Thu, Jul 22, 2021 at 9:26 AM Eric Biggers <ebiggers@kernel.org> wrote:
> > > >
> > > > On Thu, Jul 22, 2021 at 09:17:54AM -0700, Eric Biggers wrote:
> > > > > > I think it matches with FIEMAP_EXTENT_UNWRITTEN. Otherwise, we should
> > > > > > shorten the last extent like below.
> > > > > >
> > > > > >         fe_logical=0    fe_physical=16384  length=4096
> > > > > >         fe_logical=4096 fe_physical=81920  length=4096
> > > > > >         fe_logical=8192 fe_physical=147456 length=4096
> > > > > >
> > > > > >
> > > > > >   Unwritten extent - the extent is allocated but its data has not been
> > > > > >   initialized.  This indicates the extent's data will be all zero if read
> > > > > >   through the filesystem but the contents are undefined if read directly from
> > > > > >   the device.
> > > > >
> > > > > Well, as I said before, using UNWRITTEN isn't appropriate because it indicates
> > > > > that the data is all zeroes, which in this case it is not.  Similarly, reporting
> > > > > a hole isn't appropriate because it also indicates that the data is all zeroes
> > > > > and also that it has no space allocated on-disk at all.
> > > > >
> > > > > I think we should just over-report the physical length of the last extent in the
> > > > > cluster, which is what btrfs does...
> > > > >
> > > >
> > > > Also keep in mind that as far as fiemap is concerned, when FIEMAP_EXTENT_ENCODED
> > > > is set (indicating that the data is compressed or encrypted), then reading the
> > > > data from disk will have "undefined results"; see
> > > > Documentation/filesystems/fiemap.rst.  As such, when someone decides to do so
> > > > anyway (which is necessary for encryption testing), they really need to know
> > > > *exactly* what they're doing.  So I think it's less bad to bend the rules on
> > > > extents where FIEMAP_EXTENT_ENCODED is already set.
> > > >
> > > > In contrast, your suggestion would incorreectly report some parts of the file as
> > > > standard extents (or holes) without FIEMAP_EXTENT_ENCODED, so it would be
> > > > expected that the standard meaning would apply to those parts.
> > > >
> > > > - Eric
> > >
> > > I also think it is okay with the FIEMAP_EXTENT_ENCODED flag.
> > > It is actually all zero in a view of the filesystem internal and still
> > > undefined if read directly from the device.
> > > If we remove this extent, it might be confusing to understand the layout of it.
> >
> > FIEMAP_EXTENT_ENCODED | FIEMAP_EXTENT_UNWRITTEN is contradictory, so that
> > doesn't seem like a good option.  And no, the range is *not* zero when read from
> > the file by userspace, which is what UNWRITTEN is supposed to indicate.
> >
> > Compressed data is terminated by an end-of-stream marker, so it is possible to
> > decompress even if extra data is appended to it.  So that's another reason why I
> > feel that my suggestion is not as bad as the other options.
> >
> > > Plus, I think we need to remove the last extent, when we return back
> > > the block to the free space pool to filesystem using releasing
> > > reserved space ioctl.
> >
> > This seems to be a filesystem implementation detail.  Again, FS_IOC_FIEMAP is
> > just about returning the actual extent mapping, not about other filesystem
> > implementation details.
> >
> > - Eric
> 
> Understood. For confirmation, is this your final suggestion?
> 
>        fe_logical=0    fe_physical=16384  length=4096
>        fe_logical=4096 fe_physical=81920  length=4096
>        fe_logical=8192 fe_physical=147456 length=8192

Yes.

- Eric


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2021-07-22 17:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  7:20 [f2fs-dev] [PATCH] f2fs: change fiemap way in printing compression chunk Daeho Jeong
2021-07-21  7:20 ` Daeho Jeong
2021-07-21 21:35 ` [f2fs-dev] " Eric Biggers
2021-07-21 21:35   ` Eric Biggers
2021-07-21 22:30   ` Daeho Jeong
2021-07-21 22:30     ` Daeho Jeong
2021-07-22  0:15     ` Eric Biggers
2021-07-22  0:15       ` Eric Biggers
2021-07-22  1:04       ` Daeho Jeong
2021-07-22  1:04         ` Daeho Jeong
2021-07-22  1:15         ` Eric Biggers
2021-07-22  1:15           ` Eric Biggers
2021-07-22  1:40           ` Daeho Jeong
2021-07-22  1:40             ` Daeho Jeong
2021-07-22  1:56             ` Eric Biggers
2021-07-22  1:56               ` Eric Biggers
2021-07-22  3:59               ` Daeho Jeong
2021-07-22  3:59                 ` Daeho Jeong
     [not found]               ` <CACOAw_yfG494AK=XH_xzeTDWn-a1mYF+537=VTT6oX6RgLGxnw@mail.gmail.com>
2021-07-22 14:34                 ` Eric Biggers
2021-07-22 16:10                   ` Daeho Jeong
2021-07-22 16:17                     ` Eric Biggers
2021-07-22 16:26                       ` Eric Biggers
2021-07-22 16:33                         ` Daeho Jeong
2021-07-22 17:36                           ` Eric Biggers
2021-07-22 17:55                             ` Daeho Jeong
2021-07-22 17:57                               ` Eric Biggers [this message]
2021-07-22  6:24 ` Christoph Hellwig
2021-07-22  6:24   ` Christoph Hellwig
2021-07-22  6:39   ` [f2fs-dev] " Daeho Jeong
2021-07-22  6:39     ` Daeho Jeong

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=YPmxhiJrUazvHJTx@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=daeho43@gmail.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.