From: Christoph Hellwig <hch@lst.de> To: Jens Axboe <axboe@kernel.dk> Cc: Coly Li <colyli@suse.de>, Mike Snitzer <snitzer@redhat.com>, Song Liu <song@kernel.org>, "Martin K. Petersen" <martin.petersen@oracle.com>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, Phillip Lougher <phillip@squashfs.org.uk>, linux-block@vger.kernel.org, dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Date: Tue, 1 Mar 2022 10:45:49 +0200 [thread overview] Message-ID: <20220301084552.880256-3-hch@lst.de> (raw) In-Reply-To: <20220301084552.880256-1-hch@lst.de> 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> --- fs/squashfs/block.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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); -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de> To: Jens Axboe <axboe@kernel.dk> Cc: linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, Mike Snitzer <snitzer@redhat.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, linux-kernel@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>, Coly Li <colyli@suse.de>, linux-block@vger.kernel.org, Song Liu <song@kernel.org>, dm-devel@redhat.com, target-devel@vger.kernel.org, David Sterba <dsterba@suse.com>, Phillip Lougher <phillip@squashfs.org.uk>, linux-btrfs@vger.kernel.org Subject: [dm-devel] [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Date: Tue, 1 Mar 2022 10:45:49 +0200 [thread overview] Message-ID: <20220301084552.880256-3-hch@lst.de> (raw) In-Reply-To: <20220301084552.880256-1-hch@lst.de> 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> --- fs/squashfs/block.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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); -- 2.30.2 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2022-03-01 8:46 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-01 8:45 cleanup bio_kmalloc Christoph Hellwig 2022-03-01 8:45 ` [dm-devel] " Christoph Hellwig 2022-03-01 8:45 ` [PATCH 1/5] btrfs: simplify ->flush_bio handling Christoph Hellwig 2022-03-01 8:45 ` [dm-devel] " Christoph Hellwig 2022-03-01 14:22 ` David Sterba 2022-03-01 14:22 ` [dm-devel] " David Sterba 2022-03-01 8:45 ` Christoph Hellwig [this message] 2022-03-01 8:45 ` [dm-devel] [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Christoph Hellwig 2022-03-02 3:01 ` Phillip Lougher 2022-03-02 3:01 ` [dm-devel] " Phillip Lougher 2022-03-01 8:45 ` [PATCH 3/5] target/pscsi: remove pscsi_get_bio Christoph Hellwig 2022-03-01 8:45 ` [dm-devel] " Christoph Hellwig 2022-03-02 2:57 ` Martin K. Petersen 2022-03-02 2:57 ` [dm-devel] " Martin K. Petersen 2022-03-01 8:45 ` [PATCH 4/5] block: turn bio_kmalloc into a simple kmalloc wrapper Christoph Hellwig 2022-03-01 8:45 ` [dm-devel] " Christoph Hellwig 2022-03-01 8:45 ` [PATCH 5/5] pktcdvd: stop using bio_reset Christoph Hellwig 2022-03-01 8:45 ` [dm-devel] " Christoph Hellwig 2022-03-08 6:15 cleanup bio_kmalloc v2 Christoph Hellwig 2022-03-08 6:15 ` [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Christoph Hellwig 2022-04-06 6:12 [dm-devel] cleanup bio_kmalloc v3 Christoph Hellwig 2022-04-06 6:12 ` [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Christoph Hellwig 2022-04-06 16:24 ` Chaitanya Kulkarni
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220301084552.880256-3-hch@lst.de \ --to=hch@lst.de \ --cc=axboe@kernel.dk \ --cc=colyli@suse.de \ --cc=dm-devel@redhat.com \ --cc=dsterba@suse.com \ --cc=josef@toxicpanda.com \ --cc=linux-bcache@vger.kernel.org \ --cc=linux-block@vger.kernel.org \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-raid@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=phillip@squashfs.org.uk \ --cc=snitzer@redhat.com \ --cc=song@kernel.org \ --cc=target-devel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.