linux-block.vger.kernel.org archive mirror
 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

* Re: [PATCH] null_blk: use SECTOR_SHIFT consistently
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Marcos Paulo de Souza @ 2019-07-03  3:09 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block

On Tue, Jul 02, 2019 at 01:28:57PM -0700, Chaitanya Kulkarni wrote:
> 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.
> 

Agreed, much better than a magic number.

Acked-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>

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

* Re: [PATCH] null_blk: use SECTOR_SHIFT consistently
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Minwoo Im @ 2019-07-03  5:23 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, Minwoo Im

On 19-07-02 13:28:57, Chaitanya Kulkarni wrote:
> 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>

This looks good to me.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>

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

* Re: [PATCH] null_blk: use SECTOR_SHIFT consistently
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-08 18:51 UTC (permalink / raw)
  To: linux-block

Minwoo and Marcus reviewed this patch in the last week.

Ping ?

On 07/02/2019 01:29 PM, Chaitanya Kulkarni wrote:
> 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;
>


^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).