]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
erofs: shorten bvecs[] for file-backed mounts
authorGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 7 Jan 2025 08:28:25 +0000 (16:28 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 16 Jan 2025 19:18:55 +0000 (03:18 +0800)
BIO_MAX_VECS is too large for __GFP_NOFAIL allocation.  We could use
a mempool (since BIOs can always proceed), but it seems overly
complicated for now.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250107082825.74242-1-hsiangkao@linux.alibaba.com
fs/erofs/fileio.c

index 33f8539dda4aebab3a46040bbddcd6e15f2f6e79..0ffd1c63beeb9872b575fbbf162ba6a065eb5cd6 100644 (file)
@@ -6,7 +6,7 @@
 #include <trace/events/erofs.h>
 
 struct erofs_fileio_rq {
-       struct bio_vec bvecs[BIO_MAX_VECS];
+       struct bio_vec bvecs[16];
        struct bio bio;
        struct kiocb iocb;
        struct super_block *sb;
@@ -68,7 +68,7 @@ static struct erofs_fileio_rq *erofs_fileio_rq_alloc(struct erofs_map_dev *mdev)
        struct erofs_fileio_rq *rq = kzalloc(sizeof(*rq),
                                             GFP_KERNEL | __GFP_NOFAIL);
 
-       bio_init(&rq->bio, NULL, rq->bvecs, BIO_MAX_VECS, REQ_OP_READ);
+       bio_init(&rq->bio, NULL, rq->bvecs, ARRAY_SIZE(rq->bvecs), REQ_OP_READ);
        rq->iocb.ki_filp = mdev->m_dif->file;
        rq->sb = mdev->m_sb;
        return rq;