aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2014-07-23 23:37:15 -0400
committerChris Mason <clm@fb.com>2014-09-17 16:37:49 -0400
commit443f24fee731703345e2e6eec8177bb7b7d094c6 (patch)
tree8b239b7dccc60f56b1bea15119fe05e84560ac24 /fs/btrfs/volumes.c
parent6ba40b615f6e2aac40c24b649c0170d43ae19165 (diff)
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: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e04424490f12..46cd29ad3156 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -475,14 +475,13 @@ static noinline int device_list_add(const char *path,
475 return PTR_ERR(fs_devices); 475 return PTR_ERR(fs_devices);
476 476
477 list_add(&fs_devices->list, &fs_uuids); 477 list_add(&fs_devices->list, &fs_uuids);
478 fs_devices->latest_devid = devid;
479 fs_devices->latest_trans = found_transid;
480 478
481 device = NULL; 479 device = NULL;
482 } else { 480 } else {
483 device = __find_device(&fs_devices->devices, devid, 481 device = __find_device(&fs_devices->devices, devid,
484 disk_super->dev_item.uuid); 482 disk_super->dev_item.uuid);
485 } 483 }
484
486 if (!device) { 485 if (!device) {
487 if (fs_devices->opened) 486 if (fs_devices->opened)
488 return -EBUSY; 487 return -EBUSY;
@@ -567,10 +566,6 @@ static noinline int device_list_add(const char *path,
567 if (!fs_devices->opened) 566 if (!fs_devices->opened)
568 device->generation = found_transid; 567 device->generation = found_transid;
569 568
570 if (found_transid > fs_devices->latest_trans) {
571 fs_devices->latest_devid = devid;
572 fs_devices->latest_trans = found_transid;
573 }
574 *fs_devices_ret = fs_devices; 569 *fs_devices_ret = fs_devices;
575 570
576 return ret; 571 return ret;
@@ -586,8 +581,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
586 if (IS_ERR(fs_devices)) 581 if (IS_ERR(fs_devices))
587 return fs_devices; 582 return fs_devices;
588 583
589 fs_devices->latest_devid = orig->latest_devid;
590 fs_devices->latest_trans = orig->latest_trans;
591 fs_devices->total_devices = orig->total_devices; 584 fs_devices->total_devices = orig->total_devices;
592 585
593 /* We have held the volume lock, it is safe to get the devices. */ 586 /* 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 struct btrfs_fs_devices *fs_devices, int step) 619 struct btrfs_fs_devices *fs_devices, int step)
627{ 620{
628 struct btrfs_device *device, *next; 621 struct btrfs_device *device, *next;
629 622 struct btrfs_device *latest_dev = NULL;
630 struct block_device *latest_bdev = NULL;
631 u64 latest_devid = 0;
632 u64 latest_transid = 0;
633 623
634 mutex_lock(&uuid_mutex); 624 mutex_lock(&uuid_mutex);
635again: 625again:
@@ -637,11 +627,9 @@ again:
637 list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) { 627 list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) {
638 if (device->in_fs_metadata) { 628 if (device->in_fs_metadata) {
639 if (!device->is_tgtdev_for_dev_replace && 629 if (!device->is_tgtdev_for_dev_replace &&
640 (!latest_transid || 630 (!latest_dev ||
641 device->generation > latest_transid)) { 631 device->generation > latest_dev->generation)) {
642 latest_devid = device->devid; 632 latest_dev = device;
643 latest_transid = device->generation;
644 latest_bdev = device->bdev;
645 } 633 }
646 continue; 634 continue;
647 } 635 }
@@ -683,9 +671,7 @@ again:
683 goto again; 671 goto again;
684 } 672 }
685 673
686 fs_devices->latest_bdev = latest_bdev; 674 fs_devices->latest_bdev = latest_dev->bdev;
687 fs_devices->latest_devid = latest_devid;
688 fs_devices->latest_trans = latest_transid;
689 675
690 mutex_unlock(&uuid_mutex); 676 mutex_unlock(&uuid_mutex);
691} 677}
@@ -800,11 +786,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
800 struct block_device *bdev; 786 struct block_device *bdev;
801 struct list_head *head = &fs_devices->devices; 787 struct list_head *head = &fs_devices->devices;
802 struct btrfs_device *device; 788 struct btrfs_device *device;
803 struct block_device *latest_bdev = NULL; 789 struct btrfs_device *latest_dev = NULL;
804 struct buffer_head *bh; 790 struct buffer_head *bh;
805 struct btrfs_super_block *disk_super; 791 struct btrfs_super_block *disk_super;
806 u64 latest_devid = 0;
807 u64 latest_transid = 0;
808 u64 devid; 792 u64 devid;
809 int seeding = 1; 793 int seeding = 1;
810 int ret = 0; 794 int ret = 0;
@@ -832,11 +816,9 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
832 goto error_brelse; 816 goto error_brelse;
833 817
834 device->generation = btrfs_super_generation(disk_super); 818 device->generation = btrfs_super_generation(disk_super);
835 if (!latest_transid || device->generation > latest_transid) { 819 if (!latest_dev ||
836 latest_devid = devid; 820 device->generation > latest_dev->generation)
837 latest_transid = device->generation; 821 latest_dev = device;
838 latest_bdev = bdev;
839 }
840 822
841 if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING) { 823 if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING) {
842 device->writeable = 0; 824 device->writeable = 0;
@@ -879,9 +861,7 @@ error_brelse:
879 } 861 }
880 fs_devices->seeding = seeding; 862 fs_devices->seeding = seeding;
881 fs_devices->opened = 1; 863 fs_devices->opened = 1;
882 fs_devices->latest_bdev = latest_bdev; 864 fs_devices->latest_bdev = latest_dev->bdev;
883 fs_devices->latest_devid = latest_devid;
884 fs_devices->latest_trans = latest_transid;
885 fs_devices->total_rw_bytes = 0; 865 fs_devices->total_rw_bytes = 0;
886out: 866out:
887 return ret; 867 return ret;