Skip to contentSkip to conversation

block: get wp_offset by bdev_offset_from_zone_start

PATCH Applied LongPing Wei 3 participants 5 messages Nov 7, 2024 – Dec 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 block: get wp_offset by bdev_offset_from_zone_start

Call bdev_offset_from_zone_start() instead of open-coding it.

Fixes dd291d77cc90 ("block: Introduce zone write plugging")

---
v4: update commit message

---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-zoned.c +1 -1
index af19296fa50d..77a448952bbd 100644
@@ -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;
Signature · 1 line
2.34.1
Reviewed-by on v4 1/1
#1 lore raw
Quoted 3 lines · LongPing Wei

Call bdev_offset_from_zone_start() instead of open-coding it.

Fixes dd291d77cc90 ("block: Introduce zone write plugging")

This is not a bug fix so the "Fixes:" tag probably should be left out. Anyway:

#2 lore raw
In reply to LongPing Wei
Quoted 16 lines · LongPing Wei

Call bdev_offset_from_zone_start() instead of open-coding it.

Fixes dd291d77cc90 ("block: Introduce zone write plugging")

---
v4: update commit message

---
  block/blk-zoned.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-zoned.c +0 -0
index af19296fa50d..77a448952bbd 100644

block/blk-zoned.c static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk, · line 543

Quoted 8 lines
block/blk-zoned.c +1 -1
@@ -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;

Hi LongPing Wei,

Since this patch has not yet been merged, how about reposting it?

Thanks,

Bart.

maintainer
#3 lore raw
Quoted 28 lines · Bart Van Assche
Quoted 16 lines · LongPing Wei

Call bdev_offset_from_zone_start() instead of open-coding it.

Fixes dd291d77cc90 ("block: Introduce zone write plugging")

---
v4: update commit message
---
  block/blk-zoned.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-zoned.c +0 -0
index af19296fa50d..77a448952bbd 100644

block/blk-zoned.c static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk, · line 543

Quoted 8 lines
block/blk-zoned.c +1 -1
@@ -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;

Hi LongPing Wei,

Quoted 1 line

Since this patch has not yet been merged, how about reposting it?

No need, bubbled to the top and I got it applied.

Signature · 1 line
Jens Axboe
maintainer Applied
#4 lore raw
In reply to LongPing Wei
Quoted 3 lines · LongPing Wei

Call bdev_offset_from_zone_start() instead of open-coding it.

Applied, thanks!

[1/1] block: get wp_offset by bdev_offset_from_zone_start

      commit: 790eb09e59709a1ffc1c64fe4aae2789120851b0

Best regards,

Signature · 1 line
Jens Axboe