Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: consolidate btrfs_error() to btrfs_std_error()

btrfs_error() and btrfs_std_error() does the same thing
and calls _btrfs_std_error(), so consolidate them together.
And the main motivation is that btrfs_error() is closely
named with btrfs_err(), one handles error action the other
is to log the error, so don't closely name them.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Suggested-by: David Sterba <dsterba@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Anand Jain and committed by
David Sterba
a4553fef 57d816a1

+26 -33
+3 -3
fs/btrfs/ctree.c
··· 1011 1011 return ret; 1012 1012 if (refs == 0) { 1013 1013 ret = -EROFS; 1014 - btrfs_std_error(root->fs_info, ret); 1014 + btrfs_std_error(root->fs_info, ret, NULL); 1015 1015 return ret; 1016 1016 } 1017 1017 } else { ··· 1927 1927 child = read_node_slot(root, mid, 0); 1928 1928 if (!child) { 1929 1929 ret = -EROFS; 1930 - btrfs_std_error(root->fs_info, ret); 1930 + btrfs_std_error(root->fs_info, ret, NULL); 1931 1931 goto enospc; 1932 1932 } 1933 1933 ··· 2030 2030 */ 2031 2031 if (!left) { 2032 2032 ret = -EROFS; 2033 - btrfs_std_error(root->fs_info, ret); 2033 + btrfs_std_error(root->fs_info, ret, NULL); 2034 2034 goto enospc; 2035 2035 } 2036 2036 wret = balance_node_right(trans, root, mid, left);
+1 -8
fs/btrfs/ctree.h
··· 4127 4127 __LINE__, (errno)); \ 4128 4128 } while (0) 4129 4129 4130 - #define btrfs_std_error(fs_info, errno) \ 4131 - do { \ 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...) \ 4130 + #define btrfs_std_error(fs_info, errno, fmt, args...) \ 4138 4131 do { \ 4139 4132 __btrfs_std_error((fs_info), __func__, __LINE__, \ 4140 4133 (errno), fmt, ##args); \
+4 -4
fs/btrfs/disk-io.c
··· 2377 2377 /* returns with log_tree_root freed on success */ 2378 2378 ret = btrfs_recover_log_trees(log_tree_root); 2379 2379 if (ret) { 2380 - btrfs_error(tree_root->fs_info, ret, 2380 + btrfs_std_error(tree_root->fs_info, ret, 2381 2381 "Failed to recover log tree"); 2382 2382 free_extent_buffer(log_tree_root->node); 2383 2383 kfree(log_tree_root); ··· 3556 3556 if (ret) { 3557 3557 mutex_unlock( 3558 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 3560 "errors while submitting device barriers."); 3561 3561 return ret; 3562 3562 } ··· 3596 3596 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 3597 3597 3598 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 3600 "%d errors while writing supers", total_errors); 3601 3601 return -EIO; 3602 3602 } ··· 3614 3614 } 3615 3615 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); 3616 3616 if (total_errors > max_errors) { 3617 - btrfs_error(root->fs_info, -EIO, 3617 + btrfs_std_error(root->fs_info, -EIO, 3618 3618 "%d errors while writing supers", total_errors); 3619 3619 return -EIO; 3620 3620 }
+1 -1
fs/btrfs/extent-tree.c
··· 8688 8688 if (!for_reloc && root_dropped == false) 8689 8689 btrfs_add_dead_root(root); 8690 8690 if (err && err != -EAGAIN) 8691 - btrfs_std_error(root->fs_info, err); 8691 + btrfs_std_error(root->fs_info, err, NULL); 8692 8692 return err; 8693 8693 } 8694 8694
+1 -1
fs/btrfs/inode-item.c
··· 157 157 */ 158 158 if (!btrfs_find_name_in_ext_backref(path, ref_objectid, 159 159 name, name_len, &extref)) { 160 - btrfs_std_error(root->fs_info, -ENOENT); 160 + btrfs_std_error(root->fs_info, -ENOENT, NULL); 161 161 ret = -EROFS; 162 162 goto out; 163 163 }
+1 -1
fs/btrfs/ioctl.c
··· 4806 4806 /* update qgroup status and info */ 4807 4807 err = btrfs_run_qgroups(trans, root->fs_info); 4808 4808 if (err < 0) 4809 - btrfs_error(root->fs_info, ret, 4809 + btrfs_std_error(root->fs_info, ret, 4810 4810 "failed to update qgroup status and info\n"); 4811 4811 err = btrfs_end_transaction(trans, root); 4812 4812 if (err && !ret)
+1 -1
fs/btrfs/relocation.c
··· 2418 2418 } 2419 2419 out: 2420 2420 if (ret) { 2421 - btrfs_std_error(root->fs_info, ret); 2421 + btrfs_std_error(root->fs_info, ret, NULL); 2422 2422 if (!list_empty(&reloc_roots)) 2423 2423 free_reloc_roots(&reloc_roots); 2424 2424
+2 -2
fs/btrfs/root-tree.c
··· 283 283 trans = btrfs_join_transaction(tree_root); 284 284 if (IS_ERR(trans)) { 285 285 err = PTR_ERR(trans); 286 - btrfs_error(tree_root->fs_info, err, 286 + btrfs_std_error(tree_root->fs_info, err, 287 287 "Failed to start trans to delete " 288 288 "orphan item"); 289 289 break; ··· 292 292 root_key.objectid); 293 293 btrfs_end_transaction(trans, tree_root); 294 294 if (err) { 295 - btrfs_error(tree_root->fs_info, err, 295 + btrfs_std_error(tree_root->fs_info, err, 296 296 "Failed to delete root orphan " 297 297 "item"); 298 298 break;
+1 -1
fs/btrfs/transaction.c
··· 2135 2135 2136 2136 ret = btrfs_write_and_wait_transaction(trans, root); 2137 2137 if (ret) { 2138 - btrfs_error(root->fs_info, ret, 2138 + btrfs_std_error(root->fs_info, ret, 2139 2139 "Error while writing out transaction"); 2140 2140 mutex_unlock(&root->fs_info->tree_log_mutex); 2141 2141 goto scrub_continue;
+4 -4
fs/btrfs/tree-log.c
··· 5314 5314 5315 5315 ret = walk_log_tree(trans, log_root_tree, &wc); 5316 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 5318 "recovering log root tree."); 5319 5319 goto error; 5320 5320 } ··· 5328 5328 ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0); 5329 5329 5330 5330 if (ret < 0) { 5331 - btrfs_error(fs_info, ret, 5331 + btrfs_std_error(fs_info, ret, 5332 5332 "Couldn't find tree log root."); 5333 5333 goto error; 5334 5334 } ··· 5346 5346 log = btrfs_read_fs_root(log_root_tree, &found_key); 5347 5347 if (IS_ERR(log)) { 5348 5348 ret = PTR_ERR(log); 5349 - btrfs_error(fs_info, ret, 5349 + btrfs_std_error(fs_info, ret, 5350 5350 "Couldn't read tree log root."); 5351 5351 goto error; 5352 5352 } ··· 5361 5361 free_extent_buffer(log->node); 5362 5362 free_extent_buffer(log->commit_root); 5363 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 5365 "for tree log recovery."); 5366 5366 goto error; 5367 5367 }
+7 -7
fs/btrfs/volumes.c
··· 1402 1402 extent = btrfs_item_ptr(leaf, path->slots[0], 1403 1403 struct btrfs_dev_extent); 1404 1404 } else { 1405 - btrfs_error(root->fs_info, ret, "Slot search failed"); 1405 + btrfs_std_error(root->fs_info, ret, "Slot search failed"); 1406 1406 goto out; 1407 1407 } 1408 1408 ··· 1410 1410 1411 1411 ret = btrfs_del_item(trans, root, path); 1412 1412 if (ret) { 1413 - btrfs_error(root->fs_info, ret, 1413 + btrfs_std_error(root->fs_info, ret, 1414 1414 "Failed to remove dev extent item"); 1415 1415 } else { 1416 1416 trans->transaction->have_free_bgs = 1; ··· 2368 2368 2369 2369 ret = btrfs_relocate_sys_chunks(root); 2370 2370 if (ret < 0) 2371 - btrfs_error(root->fs_info, ret, 2371 + btrfs_std_error(root->fs_info, ret, 2372 2372 "Failed to relocate sys chunks after " 2373 2373 "device initialization. This can be fixed " 2374 2374 "using the \"btrfs balance\" command."); ··· 2613 2613 if (ret < 0) 2614 2614 goto out; 2615 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 2617 "Failed lookup while freeing chunk."); 2618 2618 ret = -ENOENT; 2619 2619 goto out; ··· 2621 2621 2622 2622 ret = btrfs_del_item(trans, root, path); 2623 2623 if (ret < 0) 2624 - btrfs_error(root->fs_info, ret, 2624 + btrfs_std_error(root->fs_info, ret, 2625 2625 "Failed to delete chunk item."); 2626 2626 out: 2627 2627 btrfs_free_path(path); ··· 2806 2806 trans = btrfs_start_transaction(root, 0); 2807 2807 if (IS_ERR(trans)) { 2808 2808 ret = PTR_ERR(trans); 2809 - btrfs_std_error(root->fs_info, ret); 2809 + btrfs_std_error(root->fs_info, ret, NULL); 2810 2810 return ret; 2811 2811 } 2812 2812 ··· 3461 3461 unset_balance_control(fs_info); 3462 3462 ret = del_balance_item(fs_info->tree_root); 3463 3463 if (ret) 3464 - btrfs_std_error(fs_info, ret); 3464 + btrfs_std_error(fs_info, ret, NULL); 3465 3465 3466 3466 atomic_set(&fs_info->mutually_exclusive_operation_running, 0); 3467 3467 }