mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
16cab91a0c
commit
4889bc05a9
3 changed files with 23 additions and 25 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue