diff mbox series

[3/4] block: null_blk: Cleanup messages

Message ID 20220419110038.3728406-4-damien.lemoal@opensource.wdc.com (mailing list archive)
State New, archived
Headers show
Series null_blk cleanup and device naming improvements | expand

Commit Message

Damien Le Moal April 19, 2022, 11 a.m. UTC
Prefix all null_blk pr_xxx() messages with "null_blk:" to clarify which
module is printing the messages. Also add a pr_info() message in
null_add_dev() to print the name of a newly created disk.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
 drivers/block/null_blk/main.c  | 29 ++++++++++++++++-------------
 drivers/block/null_blk/zoned.c | 14 +++++++-------
 2 files changed, 23 insertions(+), 20 deletions(-)

Comments

Johannes Thumshirn April 19, 2022, 2 p.m. UTC | #1
Shouldn't that be done using

#define pr_fmt(fmt) "null_blk: " fmt
Damien Le Moal April 19, 2022, 8:58 p.m. UTC | #2
On 4/19/22 23:00, Johannes Thumshirn wrote:
> Shouldn't that be done using
> 
> #define pr_fmt(fmt) "null_blk: " fmt

Yep, thought of that after sending :)
diff mbox series

Patch

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 4d6bc94086da..96b6eb4ca60a 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1521,7 +1521,7 @@  static int null_map_queues(struct blk_mq_tag_set *set)
 			submit_queues = dev->prev_submit_queues;
 			poll_queues = dev->prev_poll_queues;
 		} else {
-			pr_warn("tag set has unexpected nr_hw_queues: %d\n",
+			pr_warn("null_blk: tag set has unexpected nr_hw_queues: %d\n",
 				set->nr_hw_queues);
 			return -EINVAL;
 		}
@@ -1582,7 +1582,7 @@  static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res)
 	struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
 	struct nullb_cmd *cmd = blk_mq_rq_to_pdu(rq);
 
-	pr_info("rq %p timed out\n", rq);
+	pr_info("null_blk: rq %p timed out\n", rq);
 
 	if (hctx->type == HCTX_TYPE_POLL) {
 		struct nullb_queue *nq = hctx->driver_data;
@@ -1754,13 +1754,13 @@  static void null_config_discard(struct nullb *nullb)
 
 	if (!nullb->dev->memory_backed) {
 		nullb->dev->discard = false;
-		pr_info("discard option is ignored without memory backing\n");
+		pr_info("null_blk: discard option is ignored without memory backing\n");
 		return;
 	}
 
 	if (nullb->dev->zoned) {
 		nullb->dev->discard = false;
-		pr_info("discard option is ignored in zoned mode\n");
+		pr_info("null_blk: discard option is ignored in zoned mode\n");
 		return;
 	}
 
@@ -1932,7 +1932,7 @@  static int null_validate_conf(struct nullb_device *dev)
 
 	if (dev->zoned &&
 	    (!dev->zone_size || !is_power_of_2(dev->zone_size))) {
-		pr_err("zone_size must be power-of-two\n");
+		pr_err("null_blk: zone_size must be power-of-two\n");
 		return -EINVAL;
 	}
 
@@ -2071,6 +2071,8 @@  static int null_add_dev(struct nullb_device *dev)
 	list_add_tail(&nullb->list, &nullb_list);
 	mutex_unlock(&lock);
 
+	pr_info("null_blk: disk %s created\n", nullb->disk_name);
+
 	return 0;
 out_cleanup_zone:
 	null_free_zoned_dev(dev);
@@ -2121,30 +2123,31 @@  static int __init null_init(void)
 	struct nullb *nullb;
 
 	if (g_bs > PAGE_SIZE) {
-		pr_warn("invalid block size\n");
-		pr_warn("defaults block size to %lu\n", PAGE_SIZE);
+		pr_warn("null_blk: invalid block size\n");
+		pr_warn("null_blk: defaults block size to %lu\n", PAGE_SIZE);
 		g_bs = PAGE_SIZE;
 	}
 
 	if (g_max_sectors > BLK_DEF_MAX_SECTORS) {
-		pr_warn("invalid max sectors\n");
-		pr_warn("defaults max sectors to %u\n", BLK_DEF_MAX_SECTORS);
+		pr_warn("null_blk: invalid max sectors\n");
+		pr_warn("null_blk: defaults max sectors to %u\n",
+			BLK_DEF_MAX_SECTORS);
 		g_max_sectors = BLK_DEF_MAX_SECTORS;
 	}
 
 	if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
-		pr_err("invalid home_node value\n");
+		pr_err("null_blk: invalid home_node value\n");
 		g_home_node = NUMA_NO_NODE;
 	}
 
 	if (g_queue_mode == NULL_Q_RQ) {
-		pr_err("legacy IO path is no longer available\n");
+		pr_err("null_blk: legacy IO path is no longer available\n");
 		return -EINVAL;
 	}
 
 	if (g_queue_mode == NULL_Q_MQ && g_use_per_node_hctx) {
 		if (g_submit_queues != nr_online_nodes) {
-			pr_warn("submit_queues param is set to %u.\n",
+			pr_warn("null_blk: submit_queues param is set to %u.\n",
 				nr_online_nodes);
 			g_submit_queues = nr_online_nodes;
 		}
@@ -2181,7 +2184,7 @@  static int __init null_init(void)
 			goto err_dev;
 	}
 
-	pr_info("module loaded\n");
+	pr_info("null_blk: module loaded\n");
 	return 0;
 
 err_dev:
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index dae54dd1aeac..f7114a16a342 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -63,11 +63,11 @@  int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
 	unsigned int i;
 
 	if (!is_power_of_2(dev->zone_size)) {
-		pr_err("zone_size must be power-of-two\n");
+		pr_err("null_blk: zone_size must be power-of-two\n");
 		return -EINVAL;
 	}
 	if (dev->zone_size > dev->size) {
-		pr_err("Zone size larger than device capacity\n");
+		pr_err("null_blk: Zone size larger than device capacity\n");
 		return -EINVAL;
 	}
 
@@ -76,7 +76,7 @@  int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
 
 	if (dev->zone_capacity > dev->zone_size) {
 		pr_err("null_blk: zone capacity (%lu MB) larger than zone size (%lu MB)\n",
-					dev->zone_capacity, dev->zone_size);
+		       dev->zone_capacity, dev->zone_size);
 		return -EINVAL;
 	}
 
@@ -95,24 +95,24 @@  int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
 
 	if (dev->zone_nr_conv >= dev->nr_zones) {
 		dev->zone_nr_conv = dev->nr_zones - 1;
-		pr_info("changed the number of conventional zones to %u",
+		pr_info("null_blk: changed the number of conventional zones to %u",
 			dev->zone_nr_conv);
 	}
 
 	/* Max active zones has to be < nbr of seq zones in order to be enforceable */
 	if (dev->zone_max_active >= dev->nr_zones - dev->zone_nr_conv) {
 		dev->zone_max_active = 0;
-		pr_info("zone_max_active limit disabled, limit >= zone count\n");
+		pr_info("null_blk: zone_max_active limit disabled, limit >= zone count\n");
 	}
 
 	/* Max open zones has to be <= max active zones */
 	if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) {
 		dev->zone_max_open = dev->zone_max_active;
-		pr_info("changed the maximum number of open zones to %u\n",
+		pr_info("null_blk: changed the maximum number of open zones to %u\n",
 			dev->nr_zones);
 	} else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) {
 		dev->zone_max_open = 0;
-		pr_info("zone_max_open limit disabled, limit >= zone count\n");
+		pr_info("null_blk: zone_max_open limit disabled, limit >= zone count\n");
 	}
 	dev->need_zone_res_mgmt = dev->zone_max_active || dev->zone_max_open;
 	dev->imp_close_zone_no = dev->zone_nr_conv;