mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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 <rkitover@gmail.com> Reviewed-by: Coleman Kane <ckane@colemankane.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11387 Closes #11390
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user