Re: [RFC v2 2/2] gfs2: Rework read and page fault locking

From: Matthew Wilcox
Date: Fri Jul 03 2020 - 07:44:42 EST


On Fri, Jul 03, 2020 at 12:38:01PM +0100, Matthew Wilcox wrote:
> > @@ -598,16 +562,9 @@ static void gfs2_readahead(struct readahead_control *rac)
> > {
> > struct inode *inode = rac->mapping->host;
> > struct gfs2_inode *ip = GFS2_I(inode);
> > - struct gfs2_holder gh;
> >
> > - gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
> > - if (gfs2_glock_nq(&gh))
> > - goto out_uninit;
> > if (!gfs2_is_stuffed(ip))
> > mpage_readahead(rac, gfs2_block_map);
>
> I think you probably want to make this:
>
> if (i_blocksize(page->mapping->host) == PAGE_SIZE &&
> !page_has_buffers(page))
> error = iomap_readahead(rac, &gfs2_iomap_ops);
> else if (!gfs2_is_stuffed(ip))
> error = mpage_readahead(rac, gfs2_block_map);
>
> ... but I understand not wanting to make that change at this point
> in the release cycle.

That was stupid. I meant to write out:

if (i_blocksize(rac->mapping->host) == PAGE_SIZE)
error = iomap_readahead(rac, &gfs2_iomap_ops);
else if (!gfs2_is_stuffed(ip))
error = mpage_readahead(rac, gfs2_block_map);

Since the pages are freshly allocated, they can't have buffers, and
the mapping comes out of the readahead_control, not from the page.