* [PATCH v2 1/4] blk-zoned: Minimize #include directives
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
@ 2024-12-17 21:03 ` Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 2/4] blk-zoned: Document locking assumptions Bart Van Assche
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2024-12-17 21:03 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche
Only include those header files that are necessary.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 84da1eadff64..1575b887fa38 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -11,12 +11,8 @@
*/
#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/blk-mq.h>
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/sched/mm.h>
#include <linux/spinlock.h>
#include <linux/refcount.h>
#include <linux/mempool.h>
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/4] blk-zoned: Document locking assumptions
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 1/4] blk-zoned: Minimize #include directives Bart Van Assche
@ 2024-12-17 21:03 ` Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 3/4] blk-zoned: Improve the queue reference count strategy documentation Bart Van Assche
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2024-12-17 21:03 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche
Document which functions expect that their callers must hold a lock.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 1575b887fa38..954724a2e3c6 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -459,6 +459,8 @@ static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug)
static inline bool disk_should_remove_zone_wplug(struct gendisk *disk,
struct blk_zone_wplug *zwplug)
{
+ lockdep_assert_held(&zwplug->lock);
+
/* If the zone write plug was already removed, we are done. */
if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED)
return false;
@@ -913,6 +915,8 @@ static bool blk_zone_wplug_prepare_bio(struct blk_zone_wplug *zwplug,
{
struct gendisk *disk = bio->bi_bdev->bd_disk;
+ lockdep_assert_held(&zwplug->lock);
+
/*
* If we lost track of the zone write pointer due to a write error,
* the user must either execute a report zones, reset the zone or finish
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 3/4] blk-zoned: Improve the queue reference count strategy documentation
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 1/4] blk-zoned: Minimize #include directives Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 2/4] blk-zoned: Document locking assumptions Bart Van Assche
@ 2024-12-17 21:03 ` Bart Van Assche
2024-12-17 21:03 ` [PATCH v2 4/4] blk-zoned: Split queue_zone_wplugs_show() Bart Van Assche
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2024-12-17 21:03 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche
For the blk_queue_exit() calls, document where the corresponding code can
be found that increases q->q_usage_counter.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 954724a2e3c6..7876a6458022 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -582,6 +582,7 @@ static inline void blk_zone_wplug_bio_io_error(struct blk_zone_wplug *zwplug,
bio_clear_flag(bio, BIO_ZONE_WRITE_PLUGGING);
bio_io_error(bio);
disk_put_zone_wplug(zwplug);
+ /* Drop the reference taken by disk_zone_wplug_add_bio(() */
blk_queue_exit(q);
}
@@ -893,10 +894,7 @@ void blk_zone_write_plug_init_request(struct request *req)
break;
}
- /*
- * Drop the extra reference on the queue usage we got when
- * plugging the BIO and advance the write pointer offset.
- */
+ /* Drop the reference taken by disk_zone_wplug_add_bio(). */
blk_queue_exit(q);
zwplug->wp_offset += bio_sectors(bio);
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 4/4] blk-zoned: Split queue_zone_wplugs_show()
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
` (2 preceding siblings ...)
2024-12-17 21:03 ` [PATCH v2 3/4] blk-zoned: Improve the queue reference count strategy documentation Bart Van Assche
@ 2024-12-17 21:03 ` Bart Van Assche
2024-12-20 18:18 ` [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
2024-12-21 16:47 ` Jens Axboe
5 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2024-12-17 21:03 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche
Reduce the indentation level of the code in queue_zone_wplugs_show() by
moving the body of the loop in that function into a new function.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-zoned.c | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 7876a6458022..4b0be40a8ea7 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -1774,37 +1774,41 @@ int blk_zone_issue_zeroout(struct block_device *bdev, sector_t sector,
EXPORT_SYMBOL_GPL(blk_zone_issue_zeroout);
#ifdef CONFIG_BLK_DEBUG_FS
+static void queue_zone_wplug_show(struct blk_zone_wplug *zwplug,
+ struct seq_file *m)
+{
+ unsigned int zwp_wp_offset, zwp_flags;
+ unsigned int zwp_zone_no, zwp_ref;
+ unsigned int zwp_bio_list_size;
+ unsigned long flags;
+
+ spin_lock_irqsave(&zwplug->lock, flags);
+ zwp_zone_no = zwplug->zone_no;
+ zwp_flags = zwplug->flags;
+ zwp_ref = refcount_read(&zwplug->ref);
+ zwp_wp_offset = zwplug->wp_offset;
+ zwp_bio_list_size = bio_list_size(&zwplug->bio_list);
+ spin_unlock_irqrestore(&zwplug->lock, flags);
+
+ seq_printf(m, "%u 0x%x %u %u %u\n", zwp_zone_no, zwp_flags, zwp_ref,
+ zwp_wp_offset, zwp_bio_list_size);
+}
int queue_zone_wplugs_show(void *data, struct seq_file *m)
{
struct request_queue *q = data;
struct gendisk *disk = q->disk;
struct blk_zone_wplug *zwplug;
- unsigned int zwp_wp_offset, zwp_flags;
- unsigned int zwp_zone_no, zwp_ref;
- unsigned int zwp_bio_list_size, i;
- unsigned long flags;
+ unsigned int i;
if (!disk->zone_wplugs_hash)
return 0;
rcu_read_lock();
- for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) {
- hlist_for_each_entry_rcu(zwplug,
- &disk->zone_wplugs_hash[i], node) {
- spin_lock_irqsave(&zwplug->lock, flags);
- zwp_zone_no = zwplug->zone_no;
- zwp_flags = zwplug->flags;
- zwp_ref = refcount_read(&zwplug->ref);
- zwp_wp_offset = zwplug->wp_offset;
- zwp_bio_list_size = bio_list_size(&zwplug->bio_list);
- spin_unlock_irqrestore(&zwplug->lock, flags);
-
- seq_printf(m, "%u 0x%x %u %u %u\n",
- zwp_zone_no, zwp_flags, zwp_ref,
- zwp_wp_offset, zwp_bio_list_size);
- }
- }
+ for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++)
+ hlist_for_each_entry_rcu(zwplug, &disk->zone_wplugs_hash[i],
+ node)
+ queue_zone_wplug_show(zwplug, m);
rcu_read_unlock();
return 0;
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/4] Minor improvements for the zoned block storage code
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
` (3 preceding siblings ...)
2024-12-17 21:03 ` [PATCH v2 4/4] blk-zoned: Split queue_zone_wplugs_show() Bart Van Assche
@ 2024-12-20 18:18 ` Bart Van Assche
2024-12-21 16:47 ` Jens Axboe
5 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2024-12-20 18:18 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Christoph Hellwig, Damien Le Moal
On 12/17/24 1:03 PM, Bart Van Assche wrote:
> This patch series includes several minor improvements for the zoned block
> storage code. None of these patches changes the behavior of that code.
(replying to my own email)
Hi Jens,
Can you please take a look at this patch series and also at the patch
series "[PATCH v3 0/2] Two blk_mq_submit_bio() patches"? All patches in
both patch series received one or two positive reviews and no negative
feedback.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 0/4] Minor improvements for the zoned block storage code
2024-12-17 21:03 [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
` (4 preceding siblings ...)
2024-12-20 18:18 ` [PATCH v2 0/4] Minor improvements for the zoned block storage code Bart Van Assche
@ 2024-12-21 16:47 ` Jens Axboe
5 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2024-12-21 16:47 UTC (permalink / raw)
To: Bart Van Assche; +Cc: linux-block, Christoph Hellwig, Damien Le Moal
On Tue, 17 Dec 2024 13:03:06 -0800, Bart Van Assche wrote:
> This patch series includes several minor improvements for the zoned block
> storage code. None of these patches changes the behavior of that code.
>
> Please consider these patches for the next merge window.
>
> Thanks,
>
> [...]
Applied, thanks!
[1/4] blk-zoned: Minimize #include directives
commit: 812047bc7e7754dc9d9a9f42685a006f064cd16a
[2/4] blk-zoned: Document locking assumptions
commit: 27eb21b36c60a3986cfc7d374f066fbdebb8b3ed
[3/4] blk-zoned: Improve the queue reference count strategy documentation
commit: e3d334adc3aea20e3caf16d408c1f5b04a59eed0
[4/4] blk-zoned: Split queue_zone_wplugs_show()
commit: 736a8772092fa8e3a87bf8768e47d6bc1fcbc149
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread