As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does.
Unified · Split
| @@ -728,12 +728,13 @@ error_brelse: · 727 unmodified lines | |||
| 728 | * error pointer when failed | 728 | * error pointer when failed |
| 729 | */ | 729 | */ |
| 730 | static noinline struct btrfs_device *device_list_add(const char *path, | 730 | static noinline struct btrfs_device *device_list_add(const char *path, |
| 731 | struct btrfs_super_block *disk_super, u64 devid) | 731 | struct btrfs_super_block *disk_super) |
| 732 | { | 732 | { |
| 733 | struct btrfs_device *device; | 733 | struct btrfs_device *device; |
| 734 | struct btrfs_fs_devices *fs_devices; | 734 | struct btrfs_fs_devices *fs_devices; |
| 735 | struct rcu_string *name; | 735 | struct rcu_string *name; |
| 736 | u64 found_transid = btrfs_super_generation(disk_super); | 736 | u64 found_transid = btrfs_super_generation(disk_super); |
| 737 | u64 devid = btrfs_stack_device_id(&disk_super->dev_item); | ||
| 737 | 738 | ||
| 738 | fs_devices = find_fsid(disk_super->fsid); | 739 | fs_devices = find_fsid(disk_super->fsid); |
| 739 | if (!fs_devices) { | 740 | if (!fs_devices) { |
| @@ -1181,7 +1182,6 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, · 441 unmodified lines | |||
| 1181 | struct block_device *bdev; | 1182 | struct block_device *bdev; |
| 1182 | struct page *page; | 1183 | struct page *page; |
| 1183 | int ret = 0; | 1184 | int ret = 0; |
| 1184 | u64 devid; | ||
| 1185 | u64 bytenr; | 1185 | u64 bytenr; |
| 1186 | 1186 | ||
| 1187 | /* | 1187 | /* |
| @@ -1205,9 +1205,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, · 17 unmodified lines | |||
| 1205 | goto error_bdev_put; | 1205 | goto error_bdev_put; |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | devid = btrfs_stack_device_id(&disk_super->dev_item); | 1208 | device = device_list_add(path, disk_super); |
| 1209 | |||
| 1210 | device = device_list_add(path, disk_super, devid); | ||
| 1211 | if (IS_ERR(device)) | 1209 | if (IS_ERR(device)) |
| 1212 | ret = PTR_ERR(device); | 1210 | ret = PTR_ERR(device); |
| 1213 | else | 1211 | else |