[Drbd-dev] [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard

Christoph Hellwig hch at lst.de
Thu Mar 3 12:32:20 CET 2022


Use the %pg format specifier to save on stack consuption and code size.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 block/blk-lib.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index fc6ea52e74824..a745fc389a7c5 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -34,10 +34,8 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
 
 	/* In case the discard granularity isn't set by buggy device driver */
 	if (WARN_ON_ONCE(!q->limits.discard_granularity)) {
-		char dev_name[BDEVNAME_SIZE];
-
-		bdevname(bdev, dev_name);
-		pr_err_ratelimited("%s: Error: discard_granularity is 0.\n", dev_name);
+		pr_err_ratelimited("%pg: Error: discard_granularity is 0.\n",
+				   bdev);
 		return -EOPNOTSUPP;
 	}
 
-- 
2.30.2



More information about the drbd-dev mailing list