Skip to content

Commit 1cdeac6

Browse files
committed
btrfs: pass btrfs_device to btrfs_scratch_superblocks()
Replace the two parameters bdev and name by one that can be used to get them both. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 37bf771 commit 1cdeac6

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

fs/btrfs/dev-replace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
998998
btrfs_sysfs_remove_device(src_device);
999999
btrfs_sysfs_update_devid(tgt_device);
10001000
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &src_device->dev_state))
1001-
btrfs_scratch_superblocks(fs_info, src_device->bdev,
1002-
src_device->name->str);
1001+
btrfs_scratch_superblocks(fs_info, src_device);
10031002

10041003
/* write back the superblocks */
10051004
trans = btrfs_start_transaction(root, 0);

fs/btrfs/volumes.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,11 +2030,10 @@ static void btrfs_scratch_superblock(struct btrfs_fs_info *fs_info,
20302030
copy_num, ret);
20312031
}
20322032

2033-
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
2034-
struct block_device *bdev,
2035-
const char *device_path)
2033+
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, struct btrfs_device *device)
20362034
{
20372035
int copy_num;
2036+
struct block_device *bdev = device->bdev;
20382037

20392038
if (!bdev)
20402039
return;
@@ -2050,7 +2049,7 @@ void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
20502049
btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
20512050

20522051
/* Update ctime/mtime for device path for libblkid */
2053-
update_dev_time(device_path);
2052+
update_dev_time(device->name->str);
20542053
}
20552054

20562055
int btrfs_rm_device(struct btrfs_fs_info *fs_info,
@@ -2185,8 +2184,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info,
21852184
* device and let the caller do the final bdev_release.
21862185
*/
21872186
if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) {
2188-
btrfs_scratch_superblocks(fs_info, device->bdev,
2189-
device->name->str);
2187+
btrfs_scratch_superblocks(fs_info, device);
21902188
if (device->bdev) {
21912189
sync_blockdev(device->bdev);
21922190
invalidate_bdev(device->bdev);
@@ -2299,8 +2297,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
22992297

23002298
mutex_unlock(&fs_devices->device_list_mutex);
23012299

2302-
btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev->bdev,
2303-
tgtdev->name->str);
2300+
btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev);
23042301

23052302
btrfs_close_bdev(tgtdev);
23062303
synchronize_rcu();

fs/btrfs/volumes.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,7 @@ void btrfs_commit_device_sizes(struct btrfs_transaction *trans);
817817
struct list_head * __attribute_const__ btrfs_get_fs_uuids(void);
818818
bool btrfs_check_rw_degradable(struct btrfs_fs_info *fs_info,
819819
struct btrfs_device *failing_dev);
820-
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
821-
struct block_device *bdev,
822-
const char *device_path);
820+
void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, struct btrfs_device *device);
823821

824822
enum btrfs_raid_types __attribute_const__ btrfs_bg_flags_to_raid_index(u64 flags);
825823
int btrfs_bg_type_to_factor(u64 flags);

0 commit comments

Comments
 (0)