diff options
Diffstat (limited to 'block/blk-mq-sysfs.c')
-rw-r--r-- | block/blk-mq-sysfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c index b91ce75bd35d..b0ba264b0522 100644 --- a/block/blk-mq-sysfs.c +++ b/block/blk-mq-sysfs.c | |||
@@ -244,6 +244,32 @@ static ssize_t blk_mq_hw_sysfs_tags_show(struct blk_mq_hw_ctx *hctx, char *page) | |||
244 | return blk_mq_tag_sysfs_show(hctx->tags, page); | 244 | return blk_mq_tag_sysfs_show(hctx->tags, page); |
245 | } | 245 | } |
246 | 246 | ||
247 | static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page) | ||
248 | { | ||
249 | unsigned int i, queue_num, first = 1; | ||
250 | ssize_t ret = 0; | ||
251 | |||
252 | blk_mq_disable_hotplug(); | ||
253 | |||
254 | for_each_online_cpu(i) { | ||
255 | queue_num = hctx->queue->mq_map[i]; | ||
256 | if (queue_num != hctx->queue_num) | ||
257 | continue; | ||
258 | |||
259 | if (first) | ||
260 | ret += sprintf(ret + page, "%u", i); | ||
261 | else | ||
262 | ret += sprintf(ret + page, ", %u", i); | ||
263 | |||
264 | first = 0; | ||
265 | } | ||
266 | |||
267 | blk_mq_enable_hotplug(); | ||
268 | |||
269 | ret += sprintf(ret + page, "\n"); | ||
270 | return ret; | ||
271 | } | ||
272 | |||
247 | static struct blk_mq_ctx_sysfs_entry blk_mq_sysfs_dispatched = { | 273 | static struct blk_mq_ctx_sysfs_entry blk_mq_sysfs_dispatched = { |
248 | .attr = {.name = "dispatched", .mode = S_IRUGO }, | 274 | .attr = {.name = "dispatched", .mode = S_IRUGO }, |
249 | .show = blk_mq_sysfs_dispatched_show, | 275 | .show = blk_mq_sysfs_dispatched_show, |
@@ -294,6 +320,10 @@ static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_tags = { | |||
294 | .attr = {.name = "tags", .mode = S_IRUGO }, | 320 | .attr = {.name = "tags", .mode = S_IRUGO }, |
295 | .show = blk_mq_hw_sysfs_tags_show, | 321 | .show = blk_mq_hw_sysfs_tags_show, |
296 | }; | 322 | }; |
323 | static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = { | ||
324 | .attr = {.name = "cpu_list", .mode = S_IRUGO }, | ||
325 | .show = blk_mq_hw_sysfs_cpus_show, | ||
326 | }; | ||
297 | 327 | ||
298 | static struct attribute *default_hw_ctx_attrs[] = { | 328 | static struct attribute *default_hw_ctx_attrs[] = { |
299 | &blk_mq_hw_sysfs_queued.attr, | 329 | &blk_mq_hw_sysfs_queued.attr, |
@@ -302,6 +332,7 @@ static struct attribute *default_hw_ctx_attrs[] = { | |||
302 | &blk_mq_hw_sysfs_pending.attr, | 332 | &blk_mq_hw_sysfs_pending.attr, |
303 | &blk_mq_hw_sysfs_ipi.attr, | 333 | &blk_mq_hw_sysfs_ipi.attr, |
304 | &blk_mq_hw_sysfs_tags.attr, | 334 | &blk_mq_hw_sysfs_tags.attr, |
335 | &blk_mq_hw_sysfs_cpus.attr, | ||
305 | NULL, | 336 | NULL, |
306 | }; | 337 | }; |
307 | 338 | ||