All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
	Eric Sandeen <sandeen@sandeen.net>,
	linux-fsdevel@vger.kernel.org, david@fromorbit.com,
	hch@infradead.org
Subject: Re: Ext4 fiemap implementation
Date: Thu, 7 Jun 2018 09:25:04 -0700	[thread overview]
Message-ID: <20180607162504.GD9426@magnolia> (raw)
In-Reply-To: <20180607083101.bqazknwqswybvxpm@odin.usersys.redhat.com>

On Thu, Jun 07, 2018 at 10:31:01AM +0200, Carlos Maiolino wrote:
> On Wed, Jun 06, 2018 at 07:40:18AM -0700, Darrick J. Wong wrote:
> > On Wed, Jun 06, 2018 at 03:13:39PM +0200, Carlos Maiolino wrote:
> > > Sigh..
> > > 
> > > On Mon, Jun 04, 2018 at 09:43:09AM -0700, Darrick J. Wong wrote:
> > > > On Sat, Jun 02, 2018 at 11:28:53PM -0400, Theodore Y. Ts'o wrote:
> > > > > On Fri, Jun 01, 2018 at 10:01:54AM -0500, Eric Sandeen wrote:
> > > > > > > Ted, is there any restriction why ext4_fiemap isn't using iomap_fiemap()? Or any
> > > > > > > reason why ext4 fiemap always returns the offset from the beginning of the
> > > > > > > extent? Would you oppose to have it updated to return the offset initially
> > > > > > > requested? Or maybe, change ext4_fiemap() to use iomap_fiemap()?
> > > > > 
> > > > > ext4_fiemap() predates iomap_fiemap().  In fact, it used to be that
> > > > > all of the file systems had their own fiemap() implementation.   
> > > > > 
> > > > > > > I read the fiemap documentation, but I didn't get a clear understanding if
> > > > > > > fiemap should be returning the beginning of the extent, the offset initially
> > > > > > > requested, or if it depends on FS implementation.
> > > > > > 
> > > > > > I think the fiemap docs[1] explicitly state that ext4's behavior is valid:
> > > > > > 
> > > > > > > Extents returned mirror
> > > > > > > those on disk - that is, the logical offset of the 1st returned extent
> > > > > > > may start before fm_start, and the range covered by the last returned
> > > > > > > extent may end after fm_length.
> > > > > 
> > > > > Actually, I read, "Extents returned mirror those on disk" as meaning
> > > > > that the ext4 behavior is *mandated* by the docs.  It would be
> > > > > interesting to see what XFS did before the iomap_fiemap() conversion.
> > > > > Or it could have been that the docs were inconsistent with what XFS
> > > > > was doing and then when when ext4_fiemap() was implemented, we
> > > > > followed the docs.  Some software archeology would be required to know
> > > > > for sure.
> > > > 
> > > > IIRC the pre-iomap xfs_vn_fiemap implementation only returned extent
> > > > data for the block range requested.  As far as I can tell, the current
> > > > xfs iomap implementation retains that behavior.
> > > > 
> > > > The fiemap spec says that "it is valid for an extents [sic] logical
> > > > offset to start before the request or its logical length to extend past
> > > > the request".  To my eyes, that means either behavior is acceptable.
> > > > 
> > > 
> > > Ok, thanks for the input everyone. I believe Eric's idea then is the one which
> > > makes more sense. If both behaviors are valid, to make fiemap() usage for
> > > fibmap, I think I'll need to get the extent returned by the filesystem and look
> > > for the block into the extent. Thanks a lot for the ideas.
> > 
> > Just to throw another monkey wrench into the machine, have you
> > considered using iomap_bmap() instead?  It's new for 4.18...
> 
> No, but thanks, I'll look into it.

You might also look at converting ext4 to use iomap_swapfile_activate
since that's new too.  iomap_bmap won't report blocks for unwritten
extents (because we shouldn't be pointing userspace at stale disk
blocks), which breaks swapfiles with unwritten extents.

--D

> 
> > 
> > --D
> > 
> > > 
> > > 
> > > -- 
> > > Carlos
> 
> -- 
> Carlos

  reply	other threads:[~2018-06-07 16:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 12:36 Ext4 fiemap implementation Carlos Maiolino
2018-06-01 15:01 ` Eric Sandeen
2018-06-03  3:28   ` Theodore Y. Ts'o
2018-06-04 16:43     ` Darrick J. Wong
2018-06-06 13:13       ` Carlos Maiolino
2018-06-06 14:40         ` Darrick J. Wong
2018-06-07  8:31           ` Carlos Maiolino
2018-06-07 16:25             ` Darrick J. Wong [this message]
2018-06-08  8:18               ` Carlos Maiolino
2018-06-08 22:41       ` Mark Fasheh
2018-06-11  7:28         ` Carlos Maiolino
2018-06-12 23:52           ` Mark Fasheh
2018-06-13  3:06             ` Theodore Y. Ts'o
2018-06-13  3:32               ` Dave Chinner
2018-06-13  5:04                 ` Theodore Y. Ts'o
2018-06-13  7:41                   ` Dave Chinner
2018-06-13 12:09                     ` Christoph Hellwig
2018-06-14  8:14                       ` Carlos Maiolino
2018-06-01 18:57 ` Andreas Dilger

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=20180607162504.GD9426@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=cmaiolino@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=tytso@mit.edu \
    /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.