linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] block: get wp_offset by bdev_offset_from_zone_start
@ 2024-11-07  0:23 LongPing Wei
  2024-11-07  1:18 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: LongPing Wei @ 2024-11-07  0:23 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, bvanassche, dlemoal, LongPing Wei

It should be better to call bdev_offset_from_zone_start()
 instead of open-coding it.

Fixes: dd291d77cc90 ("block: Introduce zone write plugging")
Signed-off-by: LongPing Wei <weilongping@oppo.com>
---
v3: update commit message
---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index af19296fa50d..77a448952bbd 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -537,7 +537,7 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk,
 	spin_lock_init(&zwplug->lock);
 	zwplug->flags = 0;
 	zwplug->zone_no = zno;
-	zwplug->wp_offset = sector & (disk->queue->limits.chunk_sectors - 1);
+	zwplug->wp_offset = bdev_offset_from_zone_start(disk->part0, sector);
 	bio_list_init(&zwplug->bio_list);
 	INIT_WORK(&zwplug->bio_work, blk_zone_wplug_bio_work);
 	zwplug->disk = disk;
-- 
2.34.1


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

* Re: [PATCH v3] block: get wp_offset by bdev_offset_from_zone_start
  2024-11-07  0:23 [PATCH v3] block: get wp_offset by bdev_offset_from_zone_start LongPing Wei
@ 2024-11-07  1:18 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2024-11-07  1:18 UTC (permalink / raw)
  To: LongPing Wei, axboe; +Cc: linux-block, bvanassche

On 11/7/24 09:23, LongPing Wei wrote:
> It should be better to call bdev_offset_from_zone_start()
>  instead of open-coding it.

Make this simply:

Call bdev_offset_from_zone_start() instead of open-coding it.

With that, looks good to me, so feel free to add:

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> 
> Fixes: dd291d77cc90 ("block: Introduce zone write plugging")
> Signed-off-by: LongPing Wei <weilongping@oppo.com>
> ---
> v3: update commit message
> ---
>  block/blk-zoned.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index af19296fa50d..77a448952bbd 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -537,7 +537,7 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk,
>  	spin_lock_init(&zwplug->lock);
>  	zwplug->flags = 0;
>  	zwplug->zone_no = zno;
> -	zwplug->wp_offset = sector & (disk->queue->limits.chunk_sectors - 1);
> +	zwplug->wp_offset = bdev_offset_from_zone_start(disk->part0, sector);
>  	bio_list_init(&zwplug->bio_list);
>  	INIT_WORK(&zwplug->bio_work, blk_zone_wplug_bio_work);
>  	zwplug->disk = disk;


-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2024-11-07  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07  0:23 [PATCH v3] block: get wp_offset by bdev_offset_from_zone_start LongPing Wei
2024-11-07  1:18 ` Damien Le Moal

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).