Commit 443f24fe authored by Miao Xie's avatar Miao Xie Committed by Chris Mason

Btrfs: cleanup unused latest_devid and latest_trans in fs_devices

The member variants - latest_devid and latest_trans - of fs_devices structure
are set, but no one use them to do anything. so remove them.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 6ba40b61
...@@ -475,14 +475,13 @@ static noinline int device_list_add(const char *path, ...@@ -475,14 +475,13 @@ static noinline int device_list_add(const char *path,
return PTR_ERR(fs_devices); return PTR_ERR(fs_devices);
list_add(&fs_devices->list, &fs_uuids); list_add(&fs_devices->list, &fs_uuids);
fs_devices->latest_devid = devid;
fs_devices->latest_trans = found_transid;
device = NULL; device = NULL;
} else { } else {
device = __find_device(&fs_devices->devices, devid, device = __find_device(&fs_devices->devices, devid,
disk_super->dev_item.uuid); disk_super->dev_item.uuid);
} }
if (!device) { if (!device) {
if (fs_devices->opened) if (fs_devices->opened)
return -EBUSY; return -EBUSY;
...@@ -567,10 +566,6 @@ static noinline int device_list_add(const char *path, ...@@ -567,10 +566,6 @@ static noinline int device_list_add(const char *path,
if (!fs_devices->opened) if (!fs_devices->opened)
device->generation = found_transid; device->generation = found_transid;
if (found_transid > fs_devices->latest_trans) {
fs_devices->latest_devid = devid;
fs_devices->latest_trans = found_transid;
}
*fs_devices_ret = fs_devices; *fs_devices_ret = fs_devices;
return ret; return ret;
...@@ -586,8 +581,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) ...@@ -586,8 +581,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
if (IS_ERR(fs_devices)) if (IS_ERR(fs_devices))
return fs_devices; return fs_devices;
fs_devices->latest_devid = orig->latest_devid;
fs_devices->latest_trans = orig->latest_trans;
fs_devices->total_devices = orig->total_devices; fs_devices->total_devices = orig->total_devices;
/* We have held the volume lock, it is safe to get the devices. */ /* We have held the volume lock, it is safe to get the devices. */
...@@ -626,10 +619,7 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info, ...@@ -626,10 +619,7 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info,
struct btrfs_fs_devices *fs_devices, int step) struct btrfs_fs_devices *fs_devices, int step)
{ {
struct btrfs_device *device, *next; struct btrfs_device *device, *next;
struct btrfs_device *latest_dev = NULL;
struct block_device *latest_bdev = NULL;
u64 latest_devid = 0;
u64 latest_transid = 0;
mutex_lock(&uuid_mutex); mutex_lock(&uuid_mutex);
again: again:
...@@ -637,11 +627,9 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info, ...@@ -637,11 +627,9 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info,
list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) { list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) {
if (device->in_fs_metadata) { if (device->in_fs_metadata) {
if (!device->is_tgtdev_for_dev_replace && if (!device->is_tgtdev_for_dev_replace &&
(!latest_transid || (!latest_dev ||
device->generation > latest_transid)) { device->generation > latest_dev->generation)) {
latest_devid = device->devid; latest_dev = device;
latest_transid = device->generation;
latest_bdev = device->bdev;
} }
continue; continue;
} }
...@@ -683,9 +671,7 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info, ...@@ -683,9 +671,7 @@ void btrfs_close_extra_devices(struct btrfs_fs_info *fs_info,
goto again; goto again;
} }
fs_devices->latest_bdev = latest_bdev; fs_devices->latest_bdev = latest_dev->bdev;
fs_devices->latest_devid = latest_devid;
fs_devices->latest_trans = latest_transid;
mutex_unlock(&uuid_mutex); mutex_unlock(&uuid_mutex);
} }
...@@ -800,11 +786,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, ...@@ -800,11 +786,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
struct block_device *bdev; struct block_device *bdev;
struct list_head *head = &fs_devices->devices; struct list_head *head = &fs_devices->devices;
struct btrfs_device *device; struct btrfs_device *device;
struct block_device *latest_bdev = NULL; struct btrfs_device *latest_dev = NULL;
struct buffer_head *bh; struct buffer_head *bh;
struct btrfs_super_block *disk_super; struct btrfs_super_block *disk_super;
u64 latest_devid = 0;
u64 latest_transid = 0;
u64 devid; u64 devid;
int seeding = 1; int seeding = 1;
int ret = 0; int ret = 0;
...@@ -832,11 +816,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, ...@@ -832,11 +816,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
goto error_brelse; goto error_brelse;
device->generation = btrfs_super_generation(disk_super); device->generation = btrfs_super_generation(disk_super);
if (!latest_transid || device->generation > latest_transid) { if (!latest_dev ||
latest_devid = devid; device->generation > latest_dev->generation)
latest_transid = device->generation; latest_dev = device;
latest_bdev = bdev;
}
if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING) { if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING) {
device->writeable = 0; device->writeable = 0;
...@@ -879,9 +861,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, ...@@ -879,9 +861,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
} }
fs_devices->seeding = seeding; fs_devices->seeding = seeding;
fs_devices->opened = 1; fs_devices->opened = 1;
fs_devices->latest_bdev = latest_bdev; fs_devices->latest_bdev = latest_dev->bdev;
fs_devices->latest_devid = latest_devid;
fs_devices->latest_trans = latest_transid;
fs_devices->total_rw_bytes = 0; fs_devices->total_rw_bytes = 0;
out: out:
return ret; return ret;
......
...@@ -119,9 +119,6 @@ struct btrfs_device { ...@@ -119,9 +119,6 @@ struct btrfs_device {
struct btrfs_fs_devices { struct btrfs_fs_devices {
u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
/* the device with this id has the most recent copy of the super */
u64 latest_devid;
u64 latest_trans;
u64 num_devices; u64 num_devices;
u64 open_devices; u64 open_devices;
u64 rw_devices; u64 rw_devices;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment