On May 29, 2008 11:56 -0700, Joel Becker wrote: > On Thu, May 29, 2008 at 11:33:09AM -0400, jim owens wrote: > > 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 :( > > See, that's a very natural API. I'd be much happier with that - > "extent_count == 0" is consistent with no extent structures passed in. > It also fits with many other API that do it the same way (eg, snprintf). So, to clarify, you are suggesting that FIEMAP_FLAG_NUM_EXTENTS isn't needed, and returning the extent count should just be detected by calling FIEMAP with fm_extent_count == 0? I'm OK with that also, since calling it with fm_extent_count == 0 doesn't make sense otherwise. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- 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