Skip to content

Commit a98b05b

Browse files
damien-lemoalaxboe
authored andcommitted
block: Replace zone_wlock debugfs entry with zone_wplugs entry
In preparation to completely remove zone write locking, replace the "zone_wlock" mq-debugfs entry that was listing zones that are write-locked with the zone_wplugs entry which lists the zones that currently have a write plug allocated. The write plug information provided is: the zone number, the zone write plug flags, the zone write plug write pointer offset and the number of BIOs currently waiting for execution in the zone write plug BIO list. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Tested-by: Hans Holmberg <hans.holmberg@wdc.com> Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240408014128.205141-26-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d9f1439 commit a98b05b

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

block/blk-mq-debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
160160
{ "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops },
161161
{ "pm_only", 0600, queue_pm_only_show, NULL },
162162
{ "state", 0600, queue_state_show, queue_state_write },
163-
{ "zone_wlock", 0400, queue_zone_wlock_show, NULL },
163+
{ "zone_wplugs", 0400, queue_zone_wplugs_show, NULL },
164164
{ },
165165
};
166166

block/blk-mq-debugfs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)
8484
#endif
8585

8686
#if defined(CONFIG_BLK_DEV_ZONED) && defined(CONFIG_BLK_DEBUG_FS)
87-
int queue_zone_wlock_show(void *data, struct seq_file *m);
87+
int queue_zone_wplugs_show(void *data, struct seq_file *m);
8888
#else
89-
static inline int queue_zone_wlock_show(void *data, struct seq_file *m)
89+
static inline int queue_zone_wplugs_show(void *data, struct seq_file *m)
9090
{
9191
return 0;
9292
}

block/blk-zoned.c

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,17 +1808,34 @@ EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
18081808

18091809
#ifdef CONFIG_BLK_DEBUG_FS
18101810

1811-
int queue_zone_wlock_show(void *data, struct seq_file *m)
1811+
int queue_zone_wplugs_show(void *data, struct seq_file *m)
18121812
{
18131813
struct request_queue *q = data;
1814-
unsigned int i;
1814+
struct gendisk *disk = q->disk;
1815+
struct blk_zone_wplug *zwplug;
1816+
unsigned int zwp_wp_offset, zwp_flags;
1817+
unsigned int zwp_zone_no, zwp_ref;
1818+
unsigned int zwp_bio_list_size, i;
1819+
unsigned long flags;
18151820

1816-
if (!q->disk->seq_zones_wlock)
1817-
return 0;
1821+
rcu_read_lock();
1822+
for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) {
1823+
hlist_for_each_entry_rcu(zwplug,
1824+
&disk->zone_wplugs_hash[i], node) {
1825+
spin_lock_irqsave(&zwplug->lock, flags);
1826+
zwp_zone_no = zwplug->zone_no;
1827+
zwp_flags = zwplug->flags;
1828+
zwp_ref = atomic_read(&zwplug->ref);
1829+
zwp_wp_offset = zwplug->wp_offset;
1830+
zwp_bio_list_size = bio_list_size(&zwplug->bio_list);
1831+
spin_unlock_irqrestore(&zwplug->lock, flags);
18181832

1819-
for (i = 0; i < q->disk->nr_zones; i++)
1820-
if (test_bit(i, q->disk->seq_zones_wlock))
1821-
seq_printf(m, "%u\n", i);
1833+
seq_printf(m, "%u 0x%x %u %u %u\n",
1834+
zwp_zone_no, zwp_flags, zwp_ref,
1835+
zwp_wp_offset, zwp_bio_list_size);
1836+
}
1837+
}
1838+
rcu_read_unlock();
18221839

18231840
return 0;
18241841
}

0 commit comments

Comments
 (0)