On Thu, Sep 14, 2023 at 11:16:25AM +0200, Jan Kara wrote: > On Fri 11-08-23 17:15:27, Matthew Wilcox (Oracle) wrote: > > grow_dev_page() is only called by grow_buffers(). grow_buffers() > > is only called by __getblk_slow() and __getblk_slow() is only called > > from __getblk_gfp(), so it is safe to move the GFP flags setting > > all the way up. With that done, add a new bdev_getblk() entry point > > that leaves the GFP flags the way the caller specified them. > > > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > > Can't we just finish this gfp parameter conversion for all the users? > There are five __getblk_gfp() users, three in buffer_head.h directly > generate gfp mask, two (__bread_gfp() and sb_getblk_gfp()) pass it from the > caller. All three __bread_gfp() callers are in buffer_head.h and directly > generate gfp mask. sb_getblk_gfp() has five callers, all in ext4 and easily > convertable as well. > > This results not only in cleaner code but also just checking > sb_getblk_gfp() callers shows how confused they currently are about the gfp > argument (passing NOFS, NOFAIL and other pointless flags). Secondly, we can > keep using sb_getblk_gfp() from the filesystems instead of having to decide > between sb_getblk_gfp() and bdev_getblk(). I didn't do __bread_gfp() because it's basically an internal interface. All users call sb_bread(), sb_bread_unmovable() or __bread(). It doesn't seem worth doing. Now, if we start to see people actually using __bread_gfp() outside of those three interfaces, I'd agree we need to make it use GFP flags properly. BTW, Andrew has taken the bdev_getblk() series into the mm tree, so testing that tree might be a good idea for the ext4 developers (and other filesystems; an earlier revision of this patchset had a bug which would have only affected nilfs2).