From: Christoph Hellwig Date: Wed, 6 Apr 2022 06:12:25 +0000 (+0200) Subject: squashfs: always use bio_kmalloc in squashfs_bio_read X-Git-Tag: v5.19-rc1~125^2~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46a2d4ccc49903923506685a8368ca88312bbdc9;p=thirdparty%2Fkernel%2Fstable.git squashfs: always use bio_kmalloc in squashfs_bio_read If a plain kmalloc that is not backed by a mempool is safe here for a large read (and the actual page allocations), it must also be for a small one, so simplify the code a bit. Signed-off-by: Christoph Hellwig Acked-by: Phillip Lougher Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20220406061228.410163-3-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 622c844f6d118..4311a32218928 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c @@ -86,16 +86,11 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, int error, i; struct bio *bio; - if (page_count <= BIO_MAX_VECS) { - bio = bio_alloc(sb->s_bdev, page_count, REQ_OP_READ, GFP_NOIO); - } else { - bio = bio_kmalloc(GFP_NOIO, page_count); - bio_set_dev(bio, sb->s_bdev); - bio->bi_opf = REQ_OP_READ; - } - + bio = bio_kmalloc(GFP_NOIO, page_count); if (!bio) return -ENOMEM; + bio_set_dev(bio, sb->s_bdev); + bio->bi_opf = REQ_OP_READ; bio->bi_iter.bi_sector = block * (msblk->devblksize >> SECTOR_SHIFT);