Re: Ext4 fiemap implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 11, 2018 at 09:28:27AM +0200, Carlos Maiolino wrote:
> On Sat, Jun 09, 2018 at 12:41:26AM +0200, Mark Fasheh wrote:
> > Hi Darrick,
> > 
> > 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.
> > 
> > You have to take the whole paragraph (well the first half) together:
> > 
> > "All offsets and lengths are in bytes and mirror those on disk.  It is valid
> > for an extents logical offset to start before the request or its logical
> > length to extend past the request."
> > 
> > So in other words, mirror what's on disk. That might mean that
> > the returned extent might have a logical start before what the user
> > requested. The length might be past the request too, again because we're
> > mirroring what's on disk.
> > 
> > In fact, at no point is it specified that the fs can move the logical
> > start of the returned extent *forward*. The text is quite explicit that the
> > logcal end can only be *before* the request because that's the only way that
> > 'mirror what's on disk' can work for the user.
> > 
> > Thanks,
> > 	--Mark
> > 
> > Btw, I realize the original e-mail was about physical offset but for the
> > purposes of this conversation the two values are mathematically linked.
> 
> So, you are saying iomap implementation violates FIEMAP specs?

Does iomap do this or just XFS? At any rate, the doc should be read as Ted
suggests: '"Extents returned mirror those on disk" as meaning that the ext4 behavior is *mandated* by the
docs.'

So anything that's mainipulating the returned extents solely to 'fit' them into a
request is wrong.
	--Mark



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux