Re: [PATCH v4 03/21] iomap: use GFP_NOWAIT when application for iomap_dio_simple allocations
"changfengnan" <[email protected]> Tue, 28 Jul 2026 11:04:34 +0800
| Newsgroups | org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <d9210bcdf73fbe1ac8b6ec132865609a3ed68688.3b277109.3b33.4175.9d57.4ea2181fb636@bytedance.com> |
> From: "Joanne Koong"<[email protected]> > Date: Tue, Jul 28, 2026, 05:24 > Subject: [PATCH v4 03/21] iomap: use GFP_NOWAIT when application for iomap_dio_simple allocations > To: "Christian Brauner"<[email protected]>, <[email protected]>, "Darrick J . Wong"<[email protected]>, <[email protected]> > Cc: <[email protected]>, <[email protected]>, "Matthew Wilcox"<[email protected]>, "Jan Kara"<[email protected]>, "Jonathan Corbet"<[email protected]>, "David Sterba"<[email protected]>, "Gao Xiang"<[email protected]>, "Namjae Jeon"<[email protected]>, <[email protected]>, "Jaegeuk Kim"<[email protected]>, "Miklos Szeredi"<[email protected]>, "Andreas Gruenbacher"<[email protected]>, "Mikulas Patocka"<[email protected]>, "Hyunchul Lee"<[email protected]>, "Konstantin Komarov"<[email protected]>, "Carlos Maiolino"<[email protected]>, "Damien Le Moal"<[email protected]>, <[email protected]>, <[email protected]>, <[email protected]> > From: Christoph Hellwig <[email protected]> > > For non-blocking iocbs we should avoid blocking allocation where > possible, so switch to a GFP_NOWAIT allocation here. > > Reviewed-by: Darrick J. Wong <[email protected]> > Reviewed-by: Joanne Koong <[email protected]> > Signed-off-by: Joanne Koong <[email protected]> > Signed-off-by: Christoph Hellwig <[email protected]> Looks good. Reviewed-by: Fengnan Chang <[email protected]> > --- > fs/iomap/direct-io.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 36c976cf0848..5c28124b9f02 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -986,6 +986,7 @@ static void iomap_dio_simple_end_io(struct bio *bio) > ssize_t __iomap_dio_read_simple(struct kiocb *iocb, struct iov_iter *iter, > struct iomap_iter *iomi) > { > + gfp_t gfp = (iomi->flags & IOMAP_NOWAIT) ? GFP_NOWAIT : GFP_KERNEL; > struct iomap_dio_simple *sr; > unsigned int alignment; > struct bio *bio; > @@ -1015,7 +1016,11 @@ ssize_t __iomap_dio_read_simple(struct kiocb *iocb, struct iov_iter *iter, > > bio = bio_alloc_bioset(iomi->iomap.bdev, > bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS), > - REQ_OP_READ, GFP_KERNEL, &iomap_dio_simple_pool); > + REQ_OP_READ, gfp, &iomap_dio_simple_pool); > + if (!bio) { > + ret = -EAGAIN; > + goto out_dio_end; > + } > sr = container_of(bio, struct iomap_dio_simple, bio); > sr->iocb = iocb; > sr->dio_flags = 0; > -- > 2.52.0 >