@@ -161,6 +161,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
{ "pm_only", 0600, queue_pm_only_show, NULL },
{ "state", 0600, queue_state_show, queue_state_write },
{ "zone_plugged_wplugs", 0400, queue_zone_plugged_wplugs_show, NULL },
+ { "zone_active_wplugs", 0400, queue_zone_active_wplugs_show, NULL },
{ },
};
@@ -85,11 +85,16 @@ static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos)
#if defined(CONFIG_BLK_DEV_ZONED) && defined(CONFIG_BLK_DEBUG_FS)
int queue_zone_plugged_wplugs_show(void *data, struct seq_file *m);
+int queue_zone_active_wplugs_show(void *data, struct seq_file *m);
#else
static inline int queue_zone_plugged_wplugs_show(void *data, struct seq_file *m)
{
return 0;
}
+static inline int queue_zone_active_wplugs_show(void *data, struct seq_file *m)
+{
+ return 0;
+}
#endif
#endif
@@ -1526,6 +1526,33 @@ int queue_zone_plugged_wplugs_show(void *data, struct seq_file *m)
return 0;
}
+int queue_zone_active_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 i, wp_offset;
+ unsigned long flags;
+ bool active;
+
+ if (!disk->zone_wplugs)
+ return 0;
+
+ for (i = 0; i < disk->nr_zones; i++) {
+ zwplug = &disk->zone_wplugs[i];
+ blk_zone_wplug_lock(zwplug, flags);
+ active = zwplug->flags & BLK_ZONE_WPLUG_ACTIVE;
+ if (active)
+ wp_offset = zwplug->zawplug->wp_offset;
+ blk_zone_wplug_unlock(zwplug, flags);
+
+ if (active)
+ seq_printf(m, "%u %u\n", i, wp_offset);
+ }
+
+ return 0;
+}
+
#endif
void blk_zone_dev_init(void)
Add the zone_active_wplugs debugfs entry to list the zone number and write pointer offset of zones that have an active zone write plug. This helps ensure that struct blk_zone_active_wplug are reclaimed as zones become empty or full and allows observing which zones are being written by the block device user. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> --- block/blk-mq-debugfs.c | 1 + block/blk-mq-debugfs.h | 5 +++++ block/blk-zoned.c | 27 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+)