dev-replace.c (a976c2951d8f376112361830aa7762beff83a205) dev-replace.c (6374e57ad8091b9c2db2eecc536c7f0166ce099e)
1/*
2 * Copyright (C) STRATO AG 2012. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 374 unchanged lines hidden (view full) ---

383 atomic64_set(&dev_replace->num_write_errors, 0);
384 atomic64_set(&dev_replace->num_uncorrectable_read_errors, 0);
385 btrfs_dev_replace_unlock(dev_replace, 1);
386
387 ret = btrfs_sysfs_add_device_link(tgt_device->fs_devices, tgt_device);
388 if (ret)
389 btrfs_err(fs_info, "kobj add dev failed %d", ret);
390
1/*
2 * Copyright (C) STRATO AG 2012. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 374 unchanged lines hidden (view full) ---

383 atomic64_set(&dev_replace->num_write_errors, 0);
384 atomic64_set(&dev_replace->num_uncorrectable_read_errors, 0);
385 btrfs_dev_replace_unlock(dev_replace, 1);
386
387 ret = btrfs_sysfs_add_device_link(tgt_device->fs_devices, tgt_device);
388 if (ret)
389 btrfs_err(fs_info, "kobj add dev failed %d", ret);
390
391 btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1);
391 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
392
393 /* force writing the updated state information to disk */
394 trans = btrfs_start_transaction(root, 0);
395 if (IS_ERR(trans)) {
396 ret = PTR_ERR(trans);
397 btrfs_dev_replace_lock(dev_replace, 1);
398 goto leave;
399 }

--- 102 unchanged lines hidden (view full) ---

502 * flush all outstanding I/O and inode extent mappings before the
503 * copy operation is declared as being finished
504 */
505 ret = btrfs_start_delalloc_roots(fs_info, 0, -1);
506 if (ret) {
507 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
508 return ret;
509 }
392
393 /* force writing the updated state information to disk */
394 trans = btrfs_start_transaction(root, 0);
395 if (IS_ERR(trans)) {
396 ret = PTR_ERR(trans);
397 btrfs_dev_replace_lock(dev_replace, 1);
398 goto leave;
399 }

--- 102 unchanged lines hidden (view full) ---

502 * flush all outstanding I/O and inode extent mappings before the
503 * copy operation is declared as being finished
504 */
505 ret = btrfs_start_delalloc_roots(fs_info, 0, -1);
506 if (ret) {
507 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
508 return ret;
509 }
510 btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1);
510 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
511
512 trans = btrfs_start_transaction(root, 0);
513 if (IS_ERR(trans)) {
514 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
515 return PTR_ERR(trans);
516 }
517 ret = btrfs_commit_transaction(trans);
518 WARN_ON(ret);

--- 426 unchanged lines hidden ---
511
512 trans = btrfs_start_transaction(root, 0);
513 if (IS_ERR(trans)) {
514 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
515 return PTR_ERR(trans);
516 }
517 ret = btrfs_commit_transaction(trans);
518 WARN_ON(ret);

--- 426 unchanged lines hidden ---