diff options
author | Anand Jain <anand.jain@oracle.com> | 2022-01-12 13:06:01 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-03-14 13:13:47 +0100 |
commit | 4889bc05a96e039b055bbd11438c40bf956f057b (patch) | |
tree | 161cbf1dca6d039fb8528da67d395e93adbd43ca /fs/btrfs/dev-replace.c | |
parent | 16cab91a0c8fea50a03ef9c49ca829e6c0c4cf66 (diff) | |
download | linux-4889bc05a96e039b055bbd11438c40bf956f057b.tar.gz linux-4889bc05a96e039b055bbd11438c40bf956f057b.tar.bz2 linux-4889bc05a96e039b055bbd11438c40bf956f057b.zip |
btrfs: add device major-minor info in the struct btrfs_device
Internally it is common to use the major-minor number to identify a
device and, at a few locations in btrfs, we use the major-minor number
to match the device.
So when we identify a new btrfs device through device add or device
replace or device-scan/ready save the device's major-minor (dev_t) in the
struct btrfs_device so that we don't have to call lookup_bdev() again.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 1bd1bcee95c9..71fd99b48283 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -303,6 +303,9 @@ static int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info, goto error; } rcu_assign_pointer(device->name, name); + ret = lookup_bdev(device_path, &device->devt); + if (ret) + goto error; set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); device->generation = 0; |