Skip to content

Commit 9c7eddf

Browse files
andrealmeidaxboe
authored andcommitted
null_blk: format pr_* logs with pr_fmt
Instead of writing "null_blk: " at the beginning of each pr_err/info/warn log message, format messages using pr_fmt() macro. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: André Almeida <andrealmeid@collabora.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 701dfc4 commit 9c7eddf

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

‎drivers/block/null_blk.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#ifndef __BLK_NULL_BLK_H
33
#define __BLK_NULL_BLK_H
44

5+
#undef pr_fmt
6+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7+
58
#include <linux/blkdev.h>
69
#include <linux/slab.h>
710
#include <linux/blk-mq.h>
@@ -96,7 +99,7 @@ blk_status_t null_handle_zoned(struct nullb_cmd *cmd,
9699
#else
97100
static inline int null_zone_init(struct nullb_device *dev)
98101
{
99-
pr_err("null_blk: CONFIG_BLK_DEV_ZONED not enabled\n");
102+
pr_err("CONFIG_BLK_DEV_ZONED not enabled\n");
100103
return -EINVAL;
101104
}
102105
static inline void null_zone_exit(struct nullb_device *dev) {}

‎drivers/block/null_blk_main.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ static bool should_requeue_request(struct request *rq)
13151315

13161316
static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res)
13171317
{
1318-
pr_info("null_blk: rq %p timed out\n", rq);
1318+
pr_info("rq %p timed out\n", rq);
13191319
blk_mq_complete_request(rq);
13201320
return BLK_EH_DONE;
13211321
}
@@ -1748,28 +1748,28 @@ static int __init null_init(void)
17481748
struct nullb_device *dev;
17491749

17501750
if (g_bs > PAGE_SIZE) {
1751-
pr_warn("null_blk: invalid block size\n");
1752-
pr_warn("null_blk: defaults block size to %lu\n", PAGE_SIZE);
1751+
pr_warn("invalid block size\n");
1752+
pr_warn("defaults block size to %lu\n", PAGE_SIZE);
17531753
g_bs = PAGE_SIZE;
17541754
}
17551755

17561756
if (!is_power_of_2(g_zone_size)) {
1757-
pr_err("null_blk: zone_size must be power-of-two\n");
1757+
pr_err("zone_size must be power-of-two\n");
17581758
return -EINVAL;
17591759
}
17601760

17611761
if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
1762-
pr_err("null_blk: invalid home_node value\n");
1762+
pr_err("invalid home_node value\n");
17631763
g_home_node = NUMA_NO_NODE;
17641764
}
17651765

17661766
if (g_queue_mode == NULL_Q_RQ) {
1767-
pr_err("null_blk: legacy IO path no longer available\n");
1767+
pr_err("legacy IO path no longer available\n");
17681768
return -EINVAL;
17691769
}
17701770
if (g_queue_mode == NULL_Q_MQ && g_use_per_node_hctx) {
17711771
if (g_submit_queues != nr_online_nodes) {
1772-
pr_warn("null_blk: submit_queues param is set to %u.\n",
1772+
pr_warn("submit_queues param is set to %u.\n",
17731773
nr_online_nodes);
17741774
g_submit_queues = nr_online_nodes;
17751775
}
@@ -1812,7 +1812,7 @@ static int __init null_init(void)
18121812
}
18131813
}
18141814

1815-
pr_info("null_blk: module loaded\n");
1815+
pr_info("module loaded\n");
18161816
return 0;
18171817

18181818
err_dev:

‎drivers/block/null_blk_zoned.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int null_zone_init(struct nullb_device *dev)
1717
unsigned int i;
1818

1919
if (!is_power_of_2(dev->zone_size)) {
20-
pr_err("null_blk: zone_size must be power-of-two\n");
20+
pr_err("zone_size must be power-of-two\n");
2121
return -EINVAL;
2222
}
2323

@@ -31,7 +31,7 @@ int null_zone_init(struct nullb_device *dev)
3131

3232
if (dev->zone_nr_conv >= dev->nr_zones) {
3333
dev->zone_nr_conv = dev->nr_zones - 1;
34-
pr_info("null_blk: changed the number of conventional zones to %u",
34+
pr_info("changed the number of conventional zones to %u",
3535
dev->zone_nr_conv);
3636
}
3737

0 commit comments

Comments
 (0)