[Cluster-devel] [PATCH] iomap: Add inline data support to iomap_readpage_actor

Andreas Gruenbacher agruenba at redhat.com
Mon Jul 2 15:05:18 UTC 2018


On 2 July 2018 at 14:52, Christoph Hellwig <hch at lst.de> wrote:
> On Sun, Jul 01, 2018 at 11:43:43PM +0200, Andreas Gruenbacher wrote:
>> > +               WARN_ON_ONCE(plen != PAGE_SIZE);
>>
>> Inline mappings only extend to the end of the file (iomap->offset == 0
>> && iomap->length == inode->i_size), so length and plen will be
>> inode->i_size here. This assertion should just be removed.
>
> But we should generally still return PAGE_SIZE from iomap_begin
> because we cover the whole page and zero the rest, don't we?

iomap_begin doesn't know when it's being called for readpage. Direct
I/O reads don't pad to the page size,  for example, so handling the
padding in the caller seems reasonable. If you compare with regular
block-based mappings, those are also block but not necessarily page
aligned.

For stuffed files, iomap_begin will return an IOMAP_HOLE mapping for
offsets beyond the end of the file, so iterating beyond the end of the
file is fine (even if readpage doesn't do that).

> Either way, I can remove the assert from now.

Yes, thanks.

Andreas




More information about the Cluster-devel mailing list