From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-block@vger.kernel.org>
Cc: <axboe@kernel.dk>, <ming.lei@redhat.com>, <damien.lemoal@wdc.com>,
<jiangguoqing@kylinos.cn>, <shinichiro.kawasaki@wdc.com>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH V2 1/1] blk-lib: don't check bdev_get_queue() NULL check
Date: Tue, 15 Feb 2022 03:52:47 -0800 [thread overview]
Message-ID: <20220215115247.11717-2-kch@nvidia.com> (raw)
In-Reply-To: <20220215115247.11717-1-kch@nvidia.com>
Based on the comment present in the bdev_get_queue()
bdev->bd_queue can never be NULL. Remove the NULL check for the local
variable q that is set from bdev_get_queue() for discard, write_same,
and write_zeroes.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
block/blk-lib.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 1b8ced45e4e5..fc6ea52e7482 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -19,9 +19,6 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
unsigned int op;
sector_t bs_mask, part_offset = 0;
- if (!q)
- return -ENXIO;
-
if (bdev_read_only(bdev))
return -EPERM;
@@ -156,9 +153,6 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
struct bio *bio = *biop;
sector_t bs_mask;
- if (!q)
- return -ENXIO;
-
if (bdev_read_only(bdev))
return -EPERM;
@@ -232,10 +226,6 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev,
{
struct bio *bio = *biop;
unsigned int max_write_zeroes_sectors;
- struct request_queue *q = bdev_get_queue(bdev);
-
- if (!q)
- return -ENXIO;
if (bdev_read_only(bdev))
return -EPERM;
@@ -284,14 +274,10 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev,
sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
struct bio **biop)
{
- struct request_queue *q = bdev_get_queue(bdev);
struct bio *bio = *biop;
int bi_size = 0;
unsigned int sz;
- if (!q)
- return -ENXIO;
-
if (bdev_read_only(bdev))
return -EPERM;
--
2.29.0
next prev parent reply other threads:[~2022-02-15 11:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 11:52 [PATCH V2 0/1] blk-lib: cleanup bdev_get_queue() Chaitanya Kulkarni
2022-02-15 11:52 ` Chaitanya Kulkarni [this message]
2022-02-15 12:02 ` [PATCH V2 1/1] blk-lib: don't check bdev_get_queue() NULL check Ming Lei
2022-02-15 14:51 ` [PATCH V2 0/1] blk-lib: cleanup bdev_get_queue() Jens Axboe
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=20220215115247.11717-2-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=jiangguoqing@kylinos.cn \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=shinichiro.kawasaki@wdc.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox