Message ID | 20190702202857.4433-1-chaitanya.kulkarni@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | null_blk: use SECTOR_SHIFT consistently | expand |
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>
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>
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; >
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;