btrfs: Cleanup num_tolerated_disk_barrier_failures
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 9 Mar 2017 01:34:41 +0000 (09:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 16 Aug 2017 14:12:02 +0000 (16:12 +0200)
As we use per-chunk degradable check, the global
num_tolerated_disk_barrier_failures is of no use.

We can now remove it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/volumes.c

index 34ed3dabd43a897caded9caccf3aab9349eb3b67..06033b5f16576e7a40801b88aacf7c1e25b5d7fb 100644 (file)
@@ -1071,8 +1071,6 @@ struct btrfs_fs_info {
        /* next backup root to be overwritten */
        int backup_root_index;
 
-       int num_tolerated_disk_barrier_failures;
-
        /* device replace state */
        struct btrfs_dev_replace dev_replace;
 
index 552098e1b65b914f9cf3fbd932e2ad8242d014c9..2f366044d89179660a9a5100ea947eca5baea967 100644 (file)
@@ -3611,60 +3611,6 @@ int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags)
        return min_tolerated;
 }
 
-int btrfs_calc_num_tolerated_disk_barrier_failures(
-       struct btrfs_fs_info *fs_info)
-{
-       struct btrfs_ioctl_space_info space;
-       struct btrfs_space_info *sinfo;
-       u64 types[] = {BTRFS_BLOCK_GROUP_DATA,
-                      BTRFS_BLOCK_GROUP_SYSTEM,
-                      BTRFS_BLOCK_GROUP_METADATA,
-                      BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA};
-       int i;
-       int c;
-       int num_tolerated_disk_barrier_failures =
-               (int)fs_info->fs_devices->num_devices;
-
-       for (i = 0; i < ARRAY_SIZE(types); i++) {
-               struct btrfs_space_info *tmp;
-
-               sinfo = NULL;
-               rcu_read_lock();
-               list_for_each_entry_rcu(tmp, &fs_info->space_info, list) {
-                       if (tmp->flags == types[i]) {
-                               sinfo = tmp;
-                               break;
-                       }
-               }
-               rcu_read_unlock();
-
-               if (!sinfo)
-                       continue;
-
-               down_read(&sinfo->groups_sem);
-               for (c = 0; c < BTRFS_NR_RAID_TYPES; c++) {
-                       u64 flags;
-
-                       if (list_empty(&sinfo->block_groups[c]))
-                               continue;
-
-                       btrfs_get_block_group_info(&sinfo->block_groups[c],
-                                                  &space);
-                       if (space.total_bytes == 0 || space.used_bytes == 0)
-                               continue;
-                       flags = space.flags;
-
-                       num_tolerated_disk_barrier_failures = min(
-                               num_tolerated_disk_barrier_failures,
-                               btrfs_get_num_tolerated_disk_barrier_failures(
-                                       flags));
-               }
-               up_read(&sinfo->groups_sem);
-       }
-
-       return num_tolerated_disk_barrier_failures;
-}
-
 int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
 {
        struct list_head *head;
index 0a634d3ffc16d1069fbfeab1e02dc42c6bf481d2..b5d0c4cef819295635e837a19b936a7a1632a871 100644 (file)
@@ -142,8 +142,6 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 int btree_lock_page_hook(struct page *page, void *data,
                                void (*flush_fn)(void *));
 int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
-int btrfs_calc_num_tolerated_disk_barrier_failures(
-       struct btrfs_fs_info *fs_info);
 int __init btrfs_end_io_wq_init(void);
 void btrfs_end_io_wq_exit(void);
 
index 1bc822b5a4c090f83054c6d41c605e39f5fe16d6..2272ac48a8a9880431d8cbb2cda42216c448dbe0 100644 (file)
@@ -1987,9 +1987,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
                free_fs_devices(cur_devices);
        }
 
-       fs_info->num_tolerated_disk_barrier_failures =
-               btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
-
 out:
        mutex_unlock(&uuid_mutex);
        return ret;
@@ -2487,8 +2484,6 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
                                   "sysfs: failed to create fsid for sprout");
        }
 
-       fs_info->num_tolerated_disk_barrier_failures =
-               btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
        ret = btrfs_commit_transaction(trans);
 
        if (seeding_dev) {
@@ -3898,13 +3893,6 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
                           meta_target, data_target);
        }
 
-       if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) {
-               fs_info->num_tolerated_disk_barrier_failures = min(
-                       btrfs_calc_num_tolerated_disk_barrier_failures(fs_info),
-                       btrfs_get_num_tolerated_disk_barrier_failures(
-                               bctl->sys.target));
-       }
-
        ret = insert_balance_item(fs_info, bctl);
        if (ret && ret != -EEXIST)
                goto out;
@@ -3927,11 +3915,6 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
        mutex_lock(&fs_info->balance_mutex);
        atomic_dec(&fs_info->balance_running);
 
-       if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) {
-               fs_info->num_tolerated_disk_barrier_failures =
-                       btrfs_calc_num_tolerated_disk_barrier_failures(fs_info);
-       }
-
        if (bargs) {
                memset(bargs, 0, sizeof(*bargs));
                update_ioctl_balance_args(fs_info, 0, bargs);