Re: [PATCH v2] fiemap: Allow to specify range to fiemap

Darrick J. Wong
2017-08-10T21:13:02Z

On Thu, Aug 10, 2017 at 07:46:35PM +0300, Nikolay Borisov wrote:
>
>
> On 10.08.2017 19:13, Darrick J. Wong wrote:
> > We don't decrement len each time through the ioctl loop? Doesn't that
> > cause us to request and retrieve rows for ranges we don't want?
>
> Hm, you are right, I believe on every iteration we should do:
>
> len -= last_logical - start_offset

start_offset doesn't change, right?

I would think len -= last_logical - fiemap->fm_start.

Or just calculate end_offset = start_offset + length and set
fiemap->fm_length = end_offset - last_logical...

...though now that I look at that file even closer I wonder what is
going on with that outer while loop counting extents? Does -n exist to
let users cap the number of records to print, even if that means we
don't make it to the end of the range requested?

--D

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