diff options
author | Brian Behlendorf <[email protected]> | 2020-12-22 10:26:45 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-12-27 16:20:08 -0800 |
commit | b7281c88bcbba0525e8b55607145956320d103f0 (patch) | |
tree | 981a8babaef6cf441860442bf7baf04c425a890c /module | |
parent | c347fac5861e9ed736441644a97b5fa5b446998d (diff) |
Linux 5.11 compat: lookup_bdev()
The lookup_bdev() function has been updated to require a dev_t
be passed as the second argument. This is actually pretty nice
since the major number stored in the dev_t was the only part we
were interested in. This allows to us avoid handling the bdev
entirely. The vdev_lookup_bdev() wrapper was updated to emulate
the behavior of the new lookup_bdev() for all supported kernels.
Reviewed-by: Rafael Kitover <[email protected]>
Reviewed-by: Coleman Kane <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #11387
Closes #11390
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/zvol_os.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 3b1d3e4f8..29ad67368 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -66,19 +66,14 @@ typedef struct zv_request { * Given a path, return TRUE if path is a ZVOL. */ static boolean_t -zvol_is_zvol_impl(const char *device) +zvol_is_zvol_impl(const char *path) { - struct block_device *bdev; - unsigned int major; + dev_t dev = 0; - bdev = vdev_lookup_bdev(device); - if (IS_ERR(bdev)) + if (vdev_lookup_bdev(path, &dev) != 0) return (B_FALSE); - major = MAJOR(bdev->bd_dev); - bdput(bdev); - - if (major == zvol_major) + if (MAJOR(dev) == zvol_major) return (B_TRUE); return (B_FALSE); |