]> www.infradead.org Git - users/hch/block.git/commitdiff
squashfs: always use bio_kmalloc in squashfs_bio_read
authorChristoph Hellwig <hch@lst.de>
Sun, 27 Feb 2022 20:10:42 +0000 (21:10 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 4 Apr 2022 04:47:40 +0000 (06:47 +0200)
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 <hch@lst.de>
Acked-by: Phillip Lougher <phillip@squashfs.org.uk>
fs/squashfs/block.c

index 622c844f6d118650ba573ebf78fa1fd07027af74..4311a32218928dae1072fe162d7c78cc0b97633a 100644 (file)
@@ -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);