diff options
author | Jeff Mahoney <jeffm@suse.com> | 2016-06-22 18:54:23 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-12-06 10:06:59 -0500 |
commit | 0b246afa62b0cf5b09d078121f543135f28492ad (patch) | |
tree | 200ad296d09f1b2f5329658c8de81bc625007ace /fs/btrfs/dev-replace.c | |
parent | 6202df6921494f29308307e0ae6f567c2ab2ba19 (diff) |
btrfs: root->fs_info cleanup, add fs_info convenience variables
In routines where someptr->fs_info is referenced multiple times, we
introduce a convenience variable. This makes the code considerably
more readable.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 05169ef30596..c6558ed93301 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -142,7 +142,7 @@ no_valid_dev_replace_entry_found: | |||
142 | * missing | 142 | * missing |
143 | */ | 143 | */ |
144 | if (!dev_replace->srcdev && | 144 | if (!dev_replace->srcdev && |
145 | !btrfs_test_opt(dev_root->fs_info, DEGRADED)) { | 145 | !btrfs_test_opt(fs_info, DEGRADED)) { |
146 | ret = -EIO; | 146 | ret = -EIO; |
147 | btrfs_warn(fs_info, | 147 | btrfs_warn(fs_info, |
148 | "cannot mount because device replace operation is ongoing and"); | 148 | "cannot mount because device replace operation is ongoing and"); |
@@ -151,7 +151,7 @@ no_valid_dev_replace_entry_found: | |||
151 | src_devid); | 151 | src_devid); |
152 | } | 152 | } |
153 | if (!dev_replace->tgtdev && | 153 | if (!dev_replace->tgtdev && |
154 | !btrfs_test_opt(dev_root->fs_info, DEGRADED)) { | 154 | !btrfs_test_opt(fs_info, DEGRADED)) { |
155 | ret = -EIO; | 155 | ret = -EIO; |
156 | btrfs_warn(fs_info, | 156 | btrfs_warn(fs_info, |
157 | "cannot mount because device replace operation is ongoing and"); | 157 | "cannot mount because device replace operation is ongoing and"); |
@@ -387,7 +387,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root, char *tgtdev_name, | |||
387 | if (ret) | 387 | if (ret) |
388 | btrfs_err(fs_info, "kobj add dev failed %d", ret); | 388 | btrfs_err(fs_info, "kobj add dev failed %d", ret); |
389 | 389 | ||
390 | btrfs_wait_ordered_roots(root->fs_info, -1, 0, (u64)-1); | 390 | btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1); |
391 | 391 | ||
392 | /* force writing the updated state information to disk */ | 392 | /* force writing the updated state information to disk */ |
393 | trans = btrfs_start_transaction(root, 0); | 393 | trans = btrfs_start_transaction(root, 0); |
@@ -501,12 +501,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
501 | * flush all outstanding I/O and inode extent mappings before the | 501 | * flush all outstanding I/O and inode extent mappings before the |
502 | * copy operation is declared as being finished | 502 | * copy operation is declared as being finished |
503 | */ | 503 | */ |
504 | ret = btrfs_start_delalloc_roots(root->fs_info, 0, -1); | 504 | ret = btrfs_start_delalloc_roots(fs_info, 0, -1); |
505 | if (ret) { | 505 | if (ret) { |
506 | mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); | 506 | mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); |
507 | return ret; | 507 | return ret; |
508 | } | 508 | } |
509 | btrfs_wait_ordered_roots(root->fs_info, -1, 0, (u64)-1); | 509 | btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1); |
510 | 510 | ||
511 | trans = btrfs_start_transaction(root, 0); | 511 | trans = btrfs_start_transaction(root, 0); |
512 | if (IS_ERR(trans)) { | 512 | if (IS_ERR(trans)) { |
@@ -518,8 +518,8 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
518 | 518 | ||
519 | mutex_lock(&uuid_mutex); | 519 | mutex_lock(&uuid_mutex); |
520 | /* keep away write_all_supers() during the finishing procedure */ | 520 | /* keep away write_all_supers() during the finishing procedure */ |
521 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | 521 | mutex_lock(&fs_info->fs_devices->device_list_mutex); |
522 | mutex_lock(&root->fs_info->chunk_mutex); | 522 | mutex_lock(&fs_info->chunk_mutex); |
523 | btrfs_dev_replace_lock(dev_replace, 1); | 523 | btrfs_dev_replace_lock(dev_replace, 1); |
524 | dev_replace->replace_state = | 524 | dev_replace->replace_state = |
525 | scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED | 525 | scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED |
@@ -535,15 +535,15 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
535 | src_device, | 535 | src_device, |
536 | tgt_device); | 536 | tgt_device); |
537 | } else { | 537 | } else { |
538 | btrfs_err_in_rcu(root->fs_info, | 538 | btrfs_err_in_rcu(fs_info, |
539 | "btrfs_scrub_dev(%s, %llu, %s) failed %d", | 539 | "btrfs_scrub_dev(%s, %llu, %s) failed %d", |
540 | src_device->missing ? "<missing disk>" : | 540 | src_device->missing ? "<missing disk>" : |
541 | rcu_str_deref(src_device->name), | 541 | rcu_str_deref(src_device->name), |
542 | src_device->devid, | 542 | src_device->devid, |
543 | rcu_str_deref(tgt_device->name), scrub_ret); | 543 | rcu_str_deref(tgt_device->name), scrub_ret); |
544 | btrfs_dev_replace_unlock(dev_replace, 1); | 544 | btrfs_dev_replace_unlock(dev_replace, 1); |
545 | mutex_unlock(&root->fs_info->chunk_mutex); | 545 | mutex_unlock(&fs_info->chunk_mutex); |
546 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 546 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
547 | mutex_unlock(&uuid_mutex); | 547 | mutex_unlock(&uuid_mutex); |
548 | if (tgt_device) | 548 | if (tgt_device) |
549 | btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device); | 549 | btrfs_destroy_dev_replace_tgtdev(fs_info, tgt_device); |
@@ -552,12 +552,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
552 | return scrub_ret; | 552 | return scrub_ret; |
553 | } | 553 | } |
554 | 554 | ||
555 | btrfs_info_in_rcu(root->fs_info, | 555 | btrfs_info_in_rcu(fs_info, |
556 | "dev_replace from %s (devid %llu) to %s finished", | 556 | "dev_replace from %s (devid %llu) to %s finished", |
557 | src_device->missing ? "<missing disk>" : | 557 | src_device->missing ? "<missing disk>" : |
558 | rcu_str_deref(src_device->name), | 558 | rcu_str_deref(src_device->name), |
559 | src_device->devid, | 559 | src_device->devid, |
560 | rcu_str_deref(tgt_device->name)); | 560 | rcu_str_deref(tgt_device->name)); |
561 | tgt_device->is_tgtdev_for_dev_replace = 0; | 561 | tgt_device->is_tgtdev_for_dev_replace = 0; |
562 | tgt_device->devid = src_device->devid; | 562 | tgt_device->devid = src_device->devid; |
563 | src_device->devid = BTRFS_DEV_REPLACE_DEVID; | 563 | src_device->devid = BTRFS_DEV_REPLACE_DEVID; |
@@ -592,8 +592,8 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
592 | * superblock is scratched out so that it is no longer marked to | 592 | * superblock is scratched out so that it is no longer marked to |
593 | * belong to this filesystem. | 593 | * belong to this filesystem. |
594 | */ | 594 | */ |
595 | mutex_unlock(&root->fs_info->chunk_mutex); | 595 | mutex_unlock(&fs_info->chunk_mutex); |
596 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 596 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
597 | mutex_unlock(&uuid_mutex); | 597 | mutex_unlock(&uuid_mutex); |
598 | 598 | ||
599 | /* replace the sysfs entry */ | 599 | /* replace the sysfs entry */ |