aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.c6
-rw-r--r--fs/btrfs/ctree.h9
-rw-r--r--fs/btrfs/disk-io.c8
-rw-r--r--fs/btrfs/extent-tree.c2
-rw-r--r--fs/btrfs/inode-item.c2
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/relocation.c2
-rw-r--r--fs/btrfs/root-tree.c4
-rw-r--r--fs/btrfs/transaction.c2
-rw-r--r--fs/btrfs/tree-log.c8
-rw-r--r--fs/btrfs/volumes.c14
11 files changed, 26 insertions, 33 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5f745eadf77d..1063315fb387 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1011,7 +1011,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
1011 return ret; 1011 return ret;
1012 if (refs == 0) { 1012 if (refs == 0) {
1013 ret = -EROFS; 1013 ret = -EROFS;
1014 btrfs_std_error(root->fs_info, ret); 1014 btrfs_std_error(root->fs_info, ret, NULL);
1015 return ret; 1015 return ret;
1016 } 1016 }
1017 } else { 1017 } else {
@@ -1927,7 +1927,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1927 child = read_node_slot(root, mid, 0); 1927 child = read_node_slot(root, mid, 0);
1928 if (!child) { 1928 if (!child) {
1929 ret = -EROFS; 1929 ret = -EROFS;
1930 btrfs_std_error(root->fs_info, ret); 1930 btrfs_std_error(root->fs_info, ret, NULL);
1931 goto enospc; 1931 goto enospc;
1932 } 1932 }
1933 1933
@@ -2030,7 +2030,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
2030 */ 2030 */
2031 if (!left) { 2031 if (!left) {
2032 ret = -EROFS; 2032 ret = -EROFS;
2033 btrfs_std_error(root->fs_info, ret); 2033 btrfs_std_error(root->fs_info, ret, NULL);
2034 goto enospc; 2034 goto enospc;
2035 } 2035 }
2036 wret = balance_node_right(trans, root, mid, left); 2036 wret = balance_node_right(trans, root, mid, left);
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 448406307272..a86051e332ff 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -4127,14 +4127,7 @@ do { \
4127 __LINE__, (errno)); \ 4127 __LINE__, (errno)); \
4128} while (0) 4128} while (0)
4129 4129
4130#define btrfs_std_error(fs_info, errno) \ 4130#define btrfs_std_error(fs_info, errno, fmt, args...) \
4131do { \
4132 if ((errno)) \
4133 __btrfs_std_error((fs_info), __func__, \
4134 __LINE__, (errno), NULL); \
4135} while (0)
4136
4137#define btrfs_error(fs_info, errno, fmt, args...) \
4138do { \ 4131do { \
4139 __btrfs_std_error((fs_info), __func__, __LINE__, \ 4132 __btrfs_std_error((fs_info), __func__, __LINE__, \
4140 (errno), fmt, ##args); \ 4133 (errno), fmt, ##args); \
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 357d9f9c9968..0f8e33f2bcea 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2377,7 +2377,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
2377 /* returns with log_tree_root freed on success */ 2377 /* returns with log_tree_root freed on success */
2378 ret = btrfs_recover_log_trees(log_tree_root); 2378 ret = btrfs_recover_log_trees(log_tree_root);
2379 if (ret) { 2379 if (ret) {
2380 btrfs_error(tree_root->fs_info, ret, 2380 btrfs_std_error(tree_root->fs_info, ret,
2381 "Failed to recover log tree"); 2381 "Failed to recover log tree");
2382 free_extent_buffer(log_tree_root->node); 2382 free_extent_buffer(log_tree_root->node);
2383 kfree(log_tree_root); 2383 kfree(log_tree_root);
@@ -3556,7 +3556,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3556 if (ret) { 3556 if (ret) {
3557 mutex_unlock( 3557 mutex_unlock(
3558 &root->fs_info->fs_devices->device_list_mutex); 3558 &root->fs_info->fs_devices->device_list_mutex);
3559 btrfs_error(root->fs_info, ret, 3559 btrfs_std_error(root->fs_info, ret,
3560 "errors while submitting device barriers."); 3560 "errors while submitting device barriers.");
3561 return ret; 3561 return ret;
3562 } 3562 }
@@ -3596,7 +3596,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3596 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 3596 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
3597 3597
3598 /* FUA is masked off if unsupported and can't be the reason */ 3598 /* FUA is masked off if unsupported and can't be the reason */
3599 btrfs_error(root->fs_info, -EIO, 3599 btrfs_std_error(root->fs_info, -EIO,
3600 "%d errors while writing supers", total_errors); 3600 "%d errors while writing supers", total_errors);
3601 return -EIO; 3601 return -EIO;
3602 } 3602 }
@@ -3614,7 +3614,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3614 } 3614 }
3615 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 3615 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
3616 if (total_errors > max_errors) { 3616 if (total_errors > max_errors) {
3617 btrfs_error(root->fs_info, -EIO, 3617 btrfs_std_error(root->fs_info, -EIO,
3618 "%d errors while writing supers", total_errors); 3618 "%d errors while writing supers", total_errors);
3619 return -EIO; 3619 return -EIO;
3620 } 3620 }
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9f9604201333..5069f1b73395 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -8688,7 +8688,7 @@ out:
8688 if (!for_reloc && root_dropped == false) 8688 if (!for_reloc && root_dropped == false)
8689 btrfs_add_dead_root(root); 8689 btrfs_add_dead_root(root);
8690 if (err && err != -EAGAIN) 8690 if (err && err != -EAGAIN)
8691 btrfs_std_error(root->fs_info, err); 8691 btrfs_std_error(root->fs_info, err, NULL);
8692 return err; 8692 return err;
8693} 8693}
8694 8694
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 265e03c73f4d..be4d22a5022f 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -157,7 +157,7 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
157 */ 157 */
158 if (!btrfs_find_name_in_ext_backref(path, ref_objectid, 158 if (!btrfs_find_name_in_ext_backref(path, ref_objectid,
159 name, name_len, &extref)) { 159 name, name_len, &extref)) {
160 btrfs_std_error(root->fs_info, -ENOENT); 160 btrfs_std_error(root->fs_info, -ENOENT, NULL);
161 ret = -EROFS; 161 ret = -EROFS;
162 goto out; 162 goto out;
163 } 163 }
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 0adf5422fce9..f704d1c79739 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4806,7 +4806,7 @@ static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
4806 /* update qgroup status and info */ 4806 /* update qgroup status and info */
4807 err = btrfs_run_qgroups(trans, root->fs_info); 4807 err = btrfs_run_qgroups(trans, root->fs_info);
4808 if (err < 0) 4808 if (err < 0)
4809 btrfs_error(root->fs_info, ret, 4809 btrfs_std_error(root->fs_info, ret,
4810 "failed to update qgroup status and info\n"); 4810 "failed to update qgroup status and info\n");
4811 err = btrfs_end_transaction(trans, root); 4811 err = btrfs_end_transaction(trans, root);
4812 if (err && !ret) 4812 if (err && !ret)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 303babeef505..58ede0a56456 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2418,7 +2418,7 @@ again:
2418 } 2418 }
2419out: 2419out:
2420 if (ret) { 2420 if (ret) {
2421 btrfs_std_error(root->fs_info, ret); 2421 btrfs_std_error(root->fs_info, ret, NULL);
2422 if (!list_empty(&reloc_roots)) 2422 if (!list_empty(&reloc_roots))
2423 free_reloc_roots(&reloc_roots); 2423 free_reloc_roots(&reloc_roots);
2424 2424
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 360a728a639f..6d90851af4f0 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -283,7 +283,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
283 trans = btrfs_join_transaction(tree_root); 283 trans = btrfs_join_transaction(tree_root);
284 if (IS_ERR(trans)) { 284 if (IS_ERR(trans)) {
285 err = PTR_ERR(trans); 285 err = PTR_ERR(trans);
286 btrfs_error(tree_root->fs_info, err, 286 btrfs_std_error(tree_root->fs_info, err,
287 "Failed to start trans to delete " 287 "Failed to start trans to delete "
288 "orphan item"); 288 "orphan item");
289 break; 289 break;
@@ -292,7 +292,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
292 root_key.objectid); 292 root_key.objectid);
293 btrfs_end_transaction(trans, tree_root); 293 btrfs_end_transaction(trans, tree_root);
294 if (err) { 294 if (err) {
295 btrfs_error(tree_root->fs_info, err, 295 btrfs_std_error(tree_root->fs_info, err,
296 "Failed to delete root orphan " 296 "Failed to delete root orphan "
297 "item"); 297 "item");
298 break; 298 break;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 74bc3338418b..3482d9eeb62d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2135,7 +2135,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
2135 2135
2136 ret = btrfs_write_and_wait_transaction(trans, root); 2136 ret = btrfs_write_and_wait_transaction(trans, root);
2137 if (ret) { 2137 if (ret) {
2138 btrfs_error(root->fs_info, ret, 2138 btrfs_std_error(root->fs_info, ret,
2139 "Error while writing out transaction"); 2139 "Error while writing out transaction");
2140 mutex_unlock(&root->fs_info->tree_log_mutex); 2140 mutex_unlock(&root->fs_info->tree_log_mutex);
2141 goto scrub_continue; 2141 goto scrub_continue;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1bbaace73383..c3f9a9c71f28 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5314,7 +5314,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
5314 5314
5315 ret = walk_log_tree(trans, log_root_tree, &wc); 5315 ret = walk_log_tree(trans, log_root_tree, &wc);
5316 if (ret) { 5316 if (ret) {
5317 btrfs_error(fs_info, ret, "Failed to pin buffers while " 5317 btrfs_std_error(fs_info, ret, "Failed to pin buffers while "
5318 "recovering log root tree."); 5318 "recovering log root tree.");
5319 goto error; 5319 goto error;
5320 } 5320 }
@@ -5328,7 +5328,7 @@ again:
5328 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); 5328 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
5329 5329
5330 if (ret < 0) { 5330 if (ret < 0) {
5331 btrfs_error(fs_info, ret, 5331 btrfs_std_error(fs_info, ret,
5332 "Couldn't find tree log root."); 5332 "Couldn't find tree log root.");
5333 goto error; 5333 goto error;
5334 } 5334 }
@@ -5346,7 +5346,7 @@ again:
5346 log = btrfs_read_fs_root(log_root_tree, &found_key); 5346 log = btrfs_read_fs_root(log_root_tree, &found_key);
5347 if (IS_ERR(log)) { 5347 if (IS_ERR(log)) {
5348 ret = PTR_ERR(log); 5348 ret = PTR_ERR(log);
5349 btrfs_error(fs_info, ret, 5349 btrfs_std_error(fs_info, ret,
5350 "Couldn't read tree log root."); 5350 "Couldn't read tree log root.");
5351 goto error; 5351 goto error;
5352 } 5352 }
@@ -5361,7 +5361,7 @@ again:
5361 free_extent_buffer(log->node); 5361 free_extent_buffer(log->node);
5362 free_extent_buffer(log->commit_root); 5362 free_extent_buffer(log->commit_root);
5363 kfree(log); 5363 kfree(log);
5364 btrfs_error(fs_info, ret, "Couldn't read target root " 5364 btrfs_std_error(fs_info, ret, "Couldn't read target root "
5365 "for tree log recovery."); 5365 "for tree log recovery.");
5366 goto error; 5366 goto error;
5367 } 5367 }
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e8a618261218..99f294cfdcc0 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1402,7 +1402,7 @@ again:
1402 extent = btrfs_item_ptr(leaf, path->slots[0], 1402 extent = btrfs_item_ptr(leaf, path->slots[0],
1403 struct btrfs_dev_extent); 1403 struct btrfs_dev_extent);
1404 } else { 1404 } else {
1405 btrfs_error(root->fs_info, ret, "Slot search failed"); 1405 btrfs_std_error(root->fs_info, ret, "Slot search failed");
1406 goto out; 1406 goto out;
1407 } 1407 }
1408 1408
@@ -1410,7 +1410,7 @@ again:
1410 1410
1411 ret = btrfs_del_item(trans, root, path); 1411 ret = btrfs_del_item(trans, root, path);
1412 if (ret) { 1412 if (ret) {
1413 btrfs_error(root->fs_info, ret, 1413 btrfs_std_error(root->fs_info, ret,
1414 "Failed to remove dev extent item"); 1414 "Failed to remove dev extent item");
1415 } else { 1415 } else {
1416 trans->transaction->have_free_bgs = 1; 1416 trans->transaction->have_free_bgs = 1;
@@ -2368,7 +2368,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
2368 2368
2369 ret = btrfs_relocate_sys_chunks(root); 2369 ret = btrfs_relocate_sys_chunks(root);
2370 if (ret < 0) 2370 if (ret < 0)
2371 btrfs_error(root->fs_info, ret, 2371 btrfs_std_error(root->fs_info, ret,
2372 "Failed to relocate sys chunks after " 2372 "Failed to relocate sys chunks after "
2373 "device initialization. This can be fixed " 2373 "device initialization. This can be fixed "
2374 "using the \"btrfs balance\" command."); 2374 "using the \"btrfs balance\" command.");
@@ -2613,7 +2613,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
2613 if (ret < 0) 2613 if (ret < 0)
2614 goto out; 2614 goto out;
2615 else if (ret > 0) { /* Logic error or corruption */ 2615 else if (ret > 0) { /* Logic error or corruption */
2616 btrfs_error(root->fs_info, -ENOENT, 2616 btrfs_std_error(root->fs_info, -ENOENT,
2617 "Failed lookup while freeing chunk."); 2617 "Failed lookup while freeing chunk.");
2618 ret = -ENOENT; 2618 ret = -ENOENT;
2619 goto out; 2619 goto out;
@@ -2621,7 +2621,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
2621 2621
2622 ret = btrfs_del_item(trans, root, path); 2622 ret = btrfs_del_item(trans, root, path);
2623 if (ret < 0) 2623 if (ret < 0)
2624 btrfs_error(root->fs_info, ret, 2624 btrfs_std_error(root->fs_info, ret,
2625 "Failed to delete chunk item."); 2625 "Failed to delete chunk item.");
2626out: 2626out:
2627 btrfs_free_path(path); 2627 btrfs_free_path(path);
@@ -2806,7 +2806,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, u64 chunk_offset)
2806 trans = btrfs_start_transaction(root, 0); 2806 trans = btrfs_start_transaction(root, 0);
2807 if (IS_ERR(trans)) { 2807 if (IS_ERR(trans)) {
2808 ret = PTR_ERR(trans); 2808 ret = PTR_ERR(trans);
2809 btrfs_std_error(root->fs_info, ret); 2809 btrfs_std_error(root->fs_info, ret, NULL);
2810 return ret; 2810 return ret;
2811 } 2811 }
2812 2812
@@ -3461,7 +3461,7 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info)
3461 unset_balance_control(fs_info); 3461 unset_balance_control(fs_info);
3462 ret = del_balance_item(fs_info->tree_root); 3462 ret = del_balance_item(fs_info->tree_root);
3463 if (ret) 3463 if (ret)
3464 btrfs_std_error(fs_info, ret); 3464 btrfs_std_error(fs_info, ret, NULL);
3465 3465
3466 atomic_set(&fs_info->mutually_exclusive_operation_running, 0); 3466 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
3467} 3467}