public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] null_blk: use SECTOR_SHIFT consistently
@ 2019-07-02 20:28 Chaitanya Kulkarni
  2019-07-03  3:09 ` Marcos Paulo de Souza
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-02 20:28 UTC (permalink / raw)
  To: linux-block; +Cc: Chaitanya Kulkarni

This is a pure cleanup patch and doesn't change any functionality.
In null_blk_main.c we use mixed style of the code SECTOR_SHIFT and
>> 9. Get rid of the >> 9 and use SECTOR_SHIFT everywhere.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/null_blk_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index cbbbb89e89ab..860d9c17b615 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1203,7 +1203,7 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd)
 		if (dev->queue_mode == NULL_Q_BIO) {
 			op = bio_op(cmd->bio);
 			sector = cmd->bio->bi_iter.bi_sector;
-			nr_sectors = cmd->bio->bi_iter.bi_size >> 9;
+			nr_sectors = cmd->bio->bi_iter.bi_size >> SECTOR_SHIFT;
 		} else {
 			op = req_op(cmd->rq);
 			sector = blk_rq_pos(cmd->rq);
@@ -1408,7 +1408,7 @@ static void null_config_discard(struct nullb *nullb)
 		return;
 	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
 	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
-	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
+	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> SECTOR_SHIFT);
 	blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q);
 }
 
@@ -1521,7 +1521,7 @@ static int null_gendisk_register(struct nullb *nullb)
 	if (!disk)
 		return -ENOMEM;
 	size = (sector_t)nullb->dev->size * 1024 * 1024ULL;
-	set_capacity(disk, size >> 9);
+	set_capacity(disk, size >> SECTOR_SHIFT);
 
 	disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
 	disk->major		= null_major;
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-08 18:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02 20:28 [PATCH] null_blk: use SECTOR_SHIFT consistently Chaitanya Kulkarni
2019-07-03  3:09 ` Marcos Paulo de Souza
2019-07-03  5:23 ` Minwoo Im
2019-07-08 18:51 ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox