All of lore.kernel.org
 help / color / mirror / Atom feed
* a few trivial bdevname() removals
@ 2022-03-03 11:32 Christoph Hellwig
  2022-03-03 11:32 ` [PATCH 1/5] block: stop using bdevname in bdev_write_inode Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Hi Jens,

this series contains a few trivial conversion from bdevname to the %pg
format specifier.

Diffstat:
 block/bdev.c                  |    8 +++-----
 block/blk-lib.c               |    6 ++----
 drivers/block/drbd/drbd_req.c |    6 ++----
 drivers/block/pktcdvd.c       |   10 +++-------
 security/loadpin/loadpin.c    |    5 +----
 5 files changed, 11 insertions(+), 24 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] block: stop using bdevname in bdev_write_inode
  2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
@ 2022-03-03 11:32 ` Christoph Hellwig
  2022-03-03 15:33   ` Johannes Thumshirn
  2022-03-03 11:32 ` [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bdev.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index a3632317c8aae..b4389f10ee7de 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -54,12 +54,10 @@ static void bdev_write_inode(struct block_device *bdev)
 	while (inode->i_state & I_DIRTY) {
 		spin_unlock(&inode->i_lock);
 		ret = write_inode_now(inode, true);
-		if (ret) {
-			char name[BDEVNAME_SIZE];
+		if (ret)
 			pr_warn_ratelimited("VFS: Dirty inode writeback failed "
-					    "for block device %s (err=%d).\n",
-					    bdevname(bdev, name), ret);
-		}
+					    "for block device %pg (err=%d).\n",
+					    bdev, ret);
 		spin_lock(&inode->i_lock);
 	}
 	spin_unlock(&inode->i_lock);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard
  2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
  2022-03-03 11:32 ` [PATCH 1/5] block: stop using bdevname in bdev_write_inode Christoph Hellwig
@ 2022-03-03 11:32 ` Christoph Hellwig
  2022-03-03 15:34   ` Johannes Thumshirn
  2022-03-03 11:32 ` [PATCH 3/5] block: stop using bdevname in drbd_report_io_error Christoph Hellwig
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

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

Signed-off-by: Christoph Hellwig <hch@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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] block: stop using bdevname in drbd_report_io_error
  2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
  2022-03-03 11:32 ` [PATCH 1/5] block: stop using bdevname in bdev_write_inode Christoph Hellwig
  2022-03-03 11:32 ` [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard Christoph Hellwig
@ 2022-03-03 11:32 ` Christoph Hellwig
  2022-03-03 15:34   ` Johannes Thumshirn
  2022-03-03 11:32 ` [PATCH 4/5] pktcdvd: stop using bdevname Christoph Hellwig
  2022-03-03 11:32 ` [PATCH 5/5] loadpin: " Christoph Hellwig
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

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

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

diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index c00ae8619519e..82a9adb7d55ce 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -511,16 +511,14 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m,
 
 static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req)
 {
-        char b[BDEVNAME_SIZE];
-
 	if (!__ratelimit(&drbd_ratelimit_state))
 		return;
 
-	drbd_warn(device, "local %s IO error sector %llu+%u on %s\n",
+	drbd_warn(device, "local %s IO error sector %llu+%u on %pg\n",
 			(req->rq_state & RQ_WRITE) ? "WRITE" : "READ",
 			(unsigned long long)req->i.sector,
 			req->i.size >> 9,
-			bdevname(device->ldev->backing_bdev, b));
+			device->ldev->backing_bdev);
 }
 
 /* Helper for HANDED_OVER_TO_NETWORK.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] pktcdvd: stop using bdevname
  2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
                   ` (2 preceding siblings ...)
  2022-03-03 11:32 ` [PATCH 3/5] block: stop using bdevname in drbd_report_io_error Christoph Hellwig
@ 2022-03-03 11:32 ` Christoph Hellwig
  2022-03-03 15:34   ` Johannes Thumshirn
  2022-03-03 11:32 ` [PATCH 5/5] loadpin: " Christoph Hellwig
  4 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/pktcdvd.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index be749c686feb7..623df4141ff3f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2471,11 +2471,9 @@ static int pkt_seq_show(struct seq_file *m, void *p)
 {
 	struct pktcdvd_device *pd = m->private;
 	char *msg;
-	char bdev_buf[BDEVNAME_SIZE];
 	int states[PACKET_NUM_STATES];
 
-	seq_printf(m, "Writer %s mapped to %s:\n", pd->name,
-		   bdevname(pd->bdev, bdev_buf));
+	seq_printf(m, "Writer %s mapped to %pg:\n", pd->name, pd->bdev);
 
 	seq_printf(m, "\nSettings:\n");
 	seq_printf(m, "\tpacket size:\t\t%dkB\n", pd->settings.size / 2);
@@ -2532,7 +2530,6 @@ static int pkt_seq_show(struct seq_file *m, void *p)
 static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
 {
 	int i;
-	char b[BDEVNAME_SIZE];
 	struct block_device *bdev;
 	struct scsi_device *sdev;
 
@@ -2545,8 +2542,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
 		if (!pd2)
 			continue;
 		if (pd2->bdev->bd_dev == dev) {
-			pkt_err(pd, "%s already setup\n",
-				bdevname(pd2->bdev, b));
+			pkt_err(pd, "%pg already setup\n", pd2->bdev);
 			return -EBUSY;
 		}
 		if (pd2->pkt_dev == dev) {
@@ -2581,7 +2577,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
 	}
 
 	proc_create_single_data(pd->name, 0, pkt_proc, pkt_seq_show, pd);
-	pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b));
+	pkt_dbg(1, pd, "writer mapped to %pg\n", bdev);
 	return 0;
 
 out_mem:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] loadpin: stop using bdevname
  2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
                   ` (3 preceding siblings ...)
  2022-03-03 11:32 ` [PATCH 4/5] pktcdvd: stop using bdevname Christoph Hellwig
@ 2022-03-03 11:32 ` Christoph Hellwig
  2022-03-03 15:35   ` Johannes Thumshirn
  2022-03-03 17:29   ` Kees Cook
  4 siblings, 2 replies; 12+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:32 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 security/loadpin/loadpin.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
index b12f7d986b1e3..ad4e6756c0386 100644
--- a/security/loadpin/loadpin.c
+++ b/security/loadpin/loadpin.c
@@ -78,11 +78,8 @@ static void check_pinning_enforcement(struct super_block *mnt_sb)
 	 * device, allow sysctl to change modes for testing.
 	 */
 	if (mnt_sb->s_bdev) {
-		char bdev[BDEVNAME_SIZE];
-
 		ro = bdev_read_only(mnt_sb->s_bdev);
-		bdevname(mnt_sb->s_bdev, bdev);
-		pr_info("%s (%u:%u): %s\n", bdev,
+		pr_info("%pg (%u:%u): %s\n", mnt_sb->s_bdev,
 			MAJOR(mnt_sb->s_bdev->bd_dev),
 			MINOR(mnt_sb->s_bdev->bd_dev),
 			ro ? "read-only" : "writable");
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] block: stop using bdevname in bdev_write_inode
  2022-03-03 11:32 ` [PATCH 1/5] block: stop using bdevname in bdev_write_inode Christoph Hellwig
@ 2022-03-03 15:33   ` Johannes Thumshirn
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2022-03-03 15:33 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard
  2022-03-03 11:32 ` [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard Christoph Hellwig
@ 2022-03-03 15:34   ` Johannes Thumshirn
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2022-03-03 15:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] block: stop using bdevname in drbd_report_io_error
  2022-03-03 11:32 ` [PATCH 3/5] block: stop using bdevname in drbd_report_io_error Christoph Hellwig
@ 2022-03-03 15:34   ` Johannes Thumshirn
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2022-03-03 15:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/5] pktcdvd: stop using bdevname
  2022-03-03 11:32 ` [PATCH 4/5] pktcdvd: stop using bdevname Christoph Hellwig
@ 2022-03-03 15:34   ` Johannes Thumshirn
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2022-03-03 15:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] loadpin: stop using bdevname
  2022-03-03 11:32 ` [PATCH 5/5] loadpin: " Christoph Hellwig
@ 2022-03-03 15:35   ` Johannes Thumshirn
  2022-03-03 17:29   ` Kees Cook
  1 sibling, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2022-03-03 15:35 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Philipp Reisner, Kees Cook, linux-block, drbd-dev, linux-security-module

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] loadpin: stop using bdevname
  2022-03-03 11:32 ` [PATCH 5/5] loadpin: " Christoph Hellwig
  2022-03-03 15:35   ` Johannes Thumshirn
@ 2022-03-03 17:29   ` Kees Cook
  1 sibling, 0 replies; 12+ messages in thread
From: Kees Cook @ 2022-03-03 17:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Philipp Reisner, linux-block, drbd-dev,
	linux-security-module

On Thu, Mar 03, 2022 at 02:32:23PM +0300, Christoph Hellwig wrote:
> Use the %pg format specifier to save on stack consuption and code size.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-03-03 17:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 11:32 a few trivial bdevname() removals Christoph Hellwig
2022-03-03 11:32 ` [PATCH 1/5] block: stop using bdevname in bdev_write_inode Christoph Hellwig
2022-03-03 15:33   ` Johannes Thumshirn
2022-03-03 11:32 ` [PATCH 2/5] block: stop using bdevname in __blkdev_issue_discard Christoph Hellwig
2022-03-03 15:34   ` Johannes Thumshirn
2022-03-03 11:32 ` [PATCH 3/5] block: stop using bdevname in drbd_report_io_error Christoph Hellwig
2022-03-03 15:34   ` Johannes Thumshirn
2022-03-03 11:32 ` [PATCH 4/5] pktcdvd: stop using bdevname Christoph Hellwig
2022-03-03 15:34   ` Johannes Thumshirn
2022-03-03 11:32 ` [PATCH 5/5] loadpin: " Christoph Hellwig
2022-03-03 15:35   ` Johannes Thumshirn
2022-03-03 17:29   ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.