On Wed, Jun 12, 2024 at 01:40:25PM -0700, Darrick J. Wong wrote: > On Fri, Jun 07, 2024 at 02:58:58PM +0000, Pankaj Raghav (Samsung) wrote: > > From: Pankaj Raghav <p.raghav@xxxxxxxxxxx> > > > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > > index f3b43d223a46..b95600b254a3 100644 > > --- a/fs/iomap/direct-io.c > > +++ b/fs/iomap/direct-io.c > > @@ -27,6 +27,13 @@ > > #define IOMAP_DIO_WRITE (1U << 30) > > #define IOMAP_DIO_DIRTY (1U << 31) > > > > +/* > > + * Used for sub block zeroing in iomap_dio_zero() > > + */ > > +#define ZERO_FSB_SIZE (65536) > > +#define ZERO_FSB_ORDER (get_order(ZERO_FSB_SIZE)) > > +static struct page *zero_fs_block; > > Er... zero_page_64k ? > > Since it's a permanent allocation, can we also mark the memory ro? Sounds good. > > > + > > struct iomap_dio { > > struct kiocb *iocb; > > const struct iomap_dio_ops *dops; > > @@ -52,6 +59,16 @@ struct iomap_dio { > > }; > > }; > > > > +int iomap_dio_init(void) > > +{ > > + zero_fs_block = alloc_pages(GFP_KERNEL | __GFP_ZERO, ZERO_FSB_ORDER); > > + > > + if (!zero_fs_block) > > + return -ENOMEM; > > + > > + return 0; > > +} > > Can't we just turn this into another fs_initcall() instead of exporting > it just so we can call it from iomap_init? And maybe rename the > existing iomap_init to iomap_pagecache_init or something, for clarity's > sake? Yeah, probably iomap_pagecache_init() in fs/iomap/buffered-io.c and iomap_dio_init() in fs/iomap/direct-io.c > > --D >