aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/linux/zfs/vdev_disk.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2022-08-03 11:35:47 -0700
committerBrian Behlendorf <[email protected]>2022-08-04 16:57:33 -0700
commitbebdf52a16b107e20baf76899b4cb131a95a6887 (patch)
tree64c8f8d4b0d9fd146810ad28531622a7788a8f86 /module/os/linux/zfs/vdev_disk.c
parent673aa7e6cff21ad5260497edfda8ad0f720ac212 (diff)
Linux 5.20 compat: bdevname()
As of the Linux 5.20 kernel bdevname() has been removed, all callers should use snprintf() and the "%pg" format specifier. Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #13728
Diffstat (limited to 'module/os/linux/zfs/vdev_disk.c')
-rw-r--r--module/os/linux/zfs/vdev_disk.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c
index e720d2e90..ba7adcc1b 100644
--- a/module/os/linux/zfs/vdev_disk.c
+++ b/module/os/linux/zfs/vdev_disk.c
@@ -105,6 +105,16 @@ bdev_whole(struct block_device *bdev)
}
#endif
+#if defined(HAVE_BDEVNAME)
+#define vdev_bdevname(bdev, name) bdevname(bdev, name)
+#else
+static inline void
+vdev_bdevname(struct block_device *bdev, char *name)
+{
+ snprintf(name, BDEVNAME_SIZE, "%pg", bdev);
+}
+#endif
+
/*
* Returns the maximum expansion capacity of the block device (in bytes).
*
@@ -204,7 +214,7 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
if (bdev) {
if (v->vdev_expanding && bdev != bdev_whole(bdev)) {
- bdevname(bdev_whole(bdev), disk_name + 5);
+ vdev_bdevname(bdev_whole(bdev), disk_name + 5);
/*
* If userland has BLKPG_RESIZE_PARTITION,
* then it should have updated the partition