Re: Ext4 fiemap implementation

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

 



On Jun 1, 2018, at 8:36 AM, Carlos Maiolino <cmaiolino@xxxxxxxxxx> wrote:
> 
> Hi,
> 
> I've been working on a patchset to get rid of the ->bmap infrastructure.
> 
> FIBMAP ioctl should be supported forever, so, basically I'm using Dave's
> idea to use ->fiemap() implementation to handle FIBMAP ioctl, however,
> I've been facing an issue with Ext4 FIEMAP in this case; basically:
> 
> When issuing a FIEMAP ioctl to Ext4with something like this:
> 
> fiemap->fm_start = block_num * blocksize;
> fiemap->fm_length = 1;
> fmap->fm_extent_count = 1;
> 
> I was expecting the fiemap_extent returned, to contain the physical block
> from the logical request above, so:
> 
> physical block == fiemap_ext.fe_physical / blocksize
> 
> 
> This works on XFS, which is using iomap_fiemap infrastructure. However, it
> doesn't work on Ext4.
> 
> Ext4 always returns in fiemap_ext.fe_physical, the start of the extent, and
> not the offset requested initially (if it lies somewhere beyond the first
> block in the extent).
> 
> Ted, is there any restriction why ext4_fiemap isn't using iomap_fiemap()?

I think the main reason is that iomap_fiemap() was _just_ added to the tree
and nobody has submitted a patch to move it over yet.

> 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()?

I think both behaviours are valid.  The main benefit IMHO of returning the
start of the extent is that one doesn't have to _know_ where the extent
starts.  It is possible to "find the extent that covers byte X", which is
also true whether the byte offset is at the start or at the middle of a
block, while if it always starts at the supplied offset one has to do a
search backward to find the start of the extent.

> 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.

Cheers, Andreas





Attachment: signature.asc
Description: Message signed with OpenPGP


[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