Re: [RFC][PATCH 0/5] Fiemap, an extent mapping ioctl

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

 



Christoph Hellwig wrote:

What use is there geeting the extent count for a range?  I'd rather
do it only per-file like the xfs ioctl.

I'll answer that from practical experience.  Our api equivalents:

 	__u64	fm_start;	 /* logical offset (inclusive) at
				  * which to start mapping (in) */
	__u64	fm_length;	 /* logical length of mapping which
				  * userspace cares about (in) */
	__u32	fm_extent_count; /* size of fm_extents array (in) */
	__u32	fm_mapped_extents; /* number of extents that were
				    * mapped (out) */

... note it has no flags field and no separate ioctl_extent_count.

"fm_extent_count" is
   IN  == max_extents to return.
   OUT == number of extents remaining in-range after fm_mapped_extents

Pass in fm_extent_count==0 and you get OUT number of extent entries
within your fm_start + fm_length range.  Which you can use to set
your malloc size because the FS can have massive extent counts :(

This is why it was done.  In practice this was only used by kernel
callers because most application developers simply looped with a
fixed buffer and adjusted fm_start.  Dumber applications kept
doubling their malloc to get all extents at once... or core dump :)

I'm not saying there is a good reason to do it this way
in linux, just why someone else did it that way.

jim
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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