]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
btrfs: rename btrfs_std_error to btrfs_handle_fs_error
authorAnand Jain <anand.jain@oracle.com>
Wed, 16 Mar 2016 08:43:06 +0000 (16:43 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 28 Apr 2016 08:36:54 +0000 (10:36 +0200)
btrfs_std_error() handles errors, puts FS into readonly mode
(as of now). So its good idea to rename it to btrfs_handle_fs_error().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ edit changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
12 files changed:
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/inode-item.c
fs/btrfs/ioctl.c
fs/btrfs/relocation.c
fs/btrfs/root-tree.c
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c

index ec7928a27aaad4c2241ef5b9dcd2048401861085..decd0a3f5d610f54ed7b509d4b171872b5200e2f 100644 (file)
@@ -1011,7 +1011,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
                        return ret;
                if (refs == 0) {
                        ret = -EROFS;
-                       btrfs_std_error(root->fs_info, ret, NULL);
+                       btrfs_handle_fs_error(root->fs_info, ret, NULL);
                        return ret;
                }
        } else {
@@ -1928,7 +1928,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
                child = read_node_slot(root, mid, 0);
                if (!child) {
                        ret = -EROFS;
-                       btrfs_std_error(root->fs_info, ret, NULL);
+                       btrfs_handle_fs_error(root->fs_info, ret, NULL);
                        goto enospc;
                }
 
@@ -2031,7 +2031,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
                 */
                if (!left) {
                        ret = -EROFS;
-                       btrfs_std_error(root->fs_info, ret, NULL);
+                       btrfs_handle_fs_error(root->fs_info, ret, NULL);
                        goto enospc;
                }
                wret = balance_node_right(trans, root, mid, left);
index 84a6a5b3384a7be63ae6808527228a28c9f72674..12f80cd230abd41dfca31becb7c6ae7fa8158675 100644 (file)
@@ -4329,7 +4329,7 @@ static inline void assfail(char *expr, char *file, int line)
 #define btrfs_assert()
 __printf(5, 6)
 __cold
-void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
+void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
                     unsigned int line, int errno, const char *fmt, ...);
 
 const char *btrfs_decode_error(int errno);
@@ -4472,9 +4472,9 @@ do {                                                              \
                                  __LINE__, (errno));           \
 } while (0)
 
-#define btrfs_std_error(fs_info, errno, fmt, args...)          \
+#define btrfs_handle_fs_error(fs_info, errno, fmt, args...)            \
 do {                                                           \
-       __btrfs_std_error((fs_info), __func__, __LINE__,        \
+       __btrfs_handle_fs_error((fs_info), __func__, __LINE__,  \
                          (errno), fmt, ##args);                \
 } while (0)
 
index 4e47849d7427247dd179e8d4f320c5fcda687809..aeb090583b782399cbbb4923e66d55132b3ba8bf 100644 (file)
@@ -2417,7 +2417,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
        /* returns with log_tree_root freed on success */
        ret = btrfs_recover_log_trees(log_tree_root);
        if (ret) {
-               btrfs_std_error(tree_root->fs_info, ret,
+               btrfs_handle_fs_error(tree_root->fs_info, ret,
                            "Failed to recover log tree");
                free_extent_buffer(log_tree_root->node);
                kfree(log_tree_root);
@@ -3646,7 +3646,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
                if (ret) {
                        mutex_unlock(
                                &root->fs_info->fs_devices->device_list_mutex);
-                       btrfs_std_error(root->fs_info, ret,
+                       btrfs_handle_fs_error(root->fs_info, ret,
                                    "errors while submitting device barriers.");
                        return ret;
                }
@@ -3686,7 +3686,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
                mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
 
                /* FUA is masked off if unsupported and can't be the reason */
-               btrfs_std_error(root->fs_info, -EIO,
+               btrfs_handle_fs_error(root->fs_info, -EIO,
                            "%d errors while writing supers", total_errors);
                return -EIO;
        }
@@ -3704,7 +3704,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
        }
        mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
        if (total_errors > max_errors) {
-               btrfs_std_error(root->fs_info, -EIO,
+               btrfs_handle_fs_error(root->fs_info, -EIO,
                            "%d errors while writing supers", total_errors);
                return -EIO;
        }
index 84e060eb0de8c6aca562bcfb537f5236a71e9e66..c0520a94a333cea60a986b54a41ecf279866c13e 100644 (file)
@@ -9058,7 +9058,7 @@ out:
        if (!for_reloc && root_dropped == false)
                btrfs_add_dead_root(root);
        if (err && err != -EAGAIN)
-               btrfs_std_error(root->fs_info, err, NULL);
+               btrfs_handle_fs_error(root->fs_info, err, NULL);
        return err;
 }
 
index be4d22a5022fa09974488a001d859e574f686645..b8acc07ac6c2b31b41951384b2b8b051b2cbc910 100644 (file)
@@ -157,7 +157,7 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
         */
        if (!btrfs_find_name_in_ext_backref(path, ref_objectid,
                                            name, name_len, &extref)) {
-               btrfs_std_error(root->fs_info, -ENOENT, NULL);
+               btrfs_handle_fs_error(root->fs_info, -ENOENT, NULL);
                ret = -EROFS;
                goto out;
        }
index 5a23806ae418af8e3952b4cbf65df06aae384b57..06fcc448108b56e526b862d233efaa1af8dbd7a8 100644 (file)
@@ -4847,7 +4847,7 @@ static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
        /* update qgroup status and info */
        err = btrfs_run_qgroups(trans, root->fs_info);
        if (err < 0)
-               btrfs_std_error(root->fs_info, ret,
+               btrfs_handle_fs_error(root->fs_info, ret,
                            "failed to update qgroup status and info\n");
        err = btrfs_end_transaction(trans, root);
        if (err && !ret)
index 08ef890deca69fdce7a35d26bcf5ae45d9f67d8b..1c29514d8aff828c3e696f9d8fe6dd21af83a232 100644 (file)
@@ -2418,7 +2418,7 @@ again:
        }
 out:
        if (ret) {
-               btrfs_std_error(root->fs_info, ret, NULL);
+               btrfs_handle_fs_error(root->fs_info, ret, NULL);
                if (!list_empty(&reloc_roots))
                        free_reloc_roots(&reloc_roots);
 
index 9fcd6dfc3266f934dfa7d86550c88ff1d49b22a4..b2b14e7115f1989319145b54e7fc4fa3d2d4e727 100644 (file)
@@ -284,7 +284,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
                        trans = btrfs_join_transaction(tree_root);
                        if (IS_ERR(trans)) {
                                err = PTR_ERR(trans);
-                               btrfs_std_error(tree_root->fs_info, err,
+                               btrfs_handle_fs_error(tree_root->fs_info, err,
                                            "Failed to start trans to delete "
                                            "orphan item");
                                break;
@@ -293,7 +293,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
                                                    root_key.objectid);
                        btrfs_end_transaction(trans, tree_root);
                        if (err) {
-                               btrfs_std_error(tree_root->fs_info, err,
+                               btrfs_handle_fs_error(tree_root->fs_info, err,
                                            "Failed to delete root orphan "
                                            "item");
                                break;
index 00b8f37cc306df540989a9a888f0fb6cf0eb8a0e..cc077887bd9dffa85bfc4eb396c2cb2580d3c8d0 100644 (file)
@@ -131,11 +131,11 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
 }
 
 /*
- * __btrfs_std_error decodes expected errors from the caller and
+ * __btrfs_handle_fs_error decodes expected errors from the caller and
  * invokes the approciate error response.
  */
 __cold
-void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
+void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
                       unsigned int line, int errno, const char *fmt, ...)
 {
        struct super_block *sb = fs_info->sb;
@@ -252,7 +252,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
        /* Wake up anybody who may be waiting on this transaction */
        wake_up(&root->fs_info->transaction_wait);
        wake_up(&root->fs_info->transaction_blocked_wait);
-       __btrfs_std_error(root->fs_info, function, line, errno, NULL);
+       __btrfs_handle_fs_error(root->fs_info, function, line, errno, NULL);
 }
 /*
  * __btrfs_panic decodes unexpected, fatal errors from the caller,
index 43885e51b88299d1015d75c3eb2d138b67d2b6d8..a469b55a7ac1f1209c498b122ac11ae406c84768 100644 (file)
@@ -2145,7 +2145,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
 
        ret = btrfs_write_and_wait_transaction(trans, root);
        if (ret) {
-               btrfs_std_error(root->fs_info, ret,
+               btrfs_handle_fs_error(root->fs_info, ret,
                            "Error while writing out transaction");
                mutex_unlock(&root->fs_info->tree_log_mutex);
                goto scrub_continue;
index 517d0ccb351e205a4f415c15c4735c3a76647b91..16a74d1a272024e5c734fd876b664d7c769f0ee9 100644 (file)
@@ -5519,7 +5519,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
 
        ret = walk_log_tree(trans, log_root_tree, &wc);
        if (ret) {
-               btrfs_std_error(fs_info, ret, "Failed to pin buffers while "
+               btrfs_handle_fs_error(fs_info, ret, "Failed to pin buffers while "
                            "recovering log root tree.");
                goto error;
        }
@@ -5533,7 +5533,7 @@ again:
                ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
 
                if (ret < 0) {
-                       btrfs_std_error(fs_info, ret,
+                       btrfs_handle_fs_error(fs_info, ret,
                                    "Couldn't find tree log root.");
                        goto error;
                }
@@ -5551,7 +5551,7 @@ again:
                log = btrfs_read_fs_root(log_root_tree, &found_key);
                if (IS_ERR(log)) {
                        ret = PTR_ERR(log);
-                       btrfs_std_error(fs_info, ret,
+                       btrfs_handle_fs_error(fs_info, ret,
                                    "Couldn't read tree log root.");
                        goto error;
                }
@@ -5566,7 +5566,7 @@ again:
                        free_extent_buffer(log->node);
                        free_extent_buffer(log->commit_root);
                        kfree(log);
-                       btrfs_std_error(fs_info, ret, "Couldn't read target root "
+                       btrfs_handle_fs_error(fs_info, ret, "Couldn't read target root "
                                    "for tree log recovery.");
                        goto error;
                }
index bd0f45fb38c462bf932462cfda57bcc2baac63cc..0d3dd3e10e3106264952d91f4dddcf926bd69cfc 100644 (file)
@@ -1454,7 +1454,7 @@ again:
                extent = btrfs_item_ptr(leaf, path->slots[0],
                                        struct btrfs_dev_extent);
        } else {
-               btrfs_std_error(root->fs_info, ret, "Slot search failed");
+               btrfs_handle_fs_error(root->fs_info, ret, "Slot search failed");
                goto out;
        }
 
@@ -1462,7 +1462,7 @@ again:
 
        ret = btrfs_del_item(trans, root, path);
        if (ret) {
-               btrfs_std_error(root->fs_info, ret,
+               btrfs_handle_fs_error(root->fs_info, ret,
                            "Failed to remove dev extent item");
        } else {
                set_bit(BTRFS_TRANS_HAVE_FREE_BGS, &trans->transaction->flags);
@@ -2418,7 +2418,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
 
                ret = btrfs_relocate_sys_chunks(root);
                if (ret < 0)
-                       btrfs_std_error(root->fs_info, ret,
+                       btrfs_handle_fs_error(root->fs_info, ret,
                                    "Failed to relocate sys chunks after "
                                    "device initialization. This can be fixed "
                                    "using the \"btrfs balance\" command.");
@@ -2663,7 +2663,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
        if (ret < 0)
                goto out;
        else if (ret > 0) { /* Logic error or corruption */
-               btrfs_std_error(root->fs_info, -ENOENT,
+               btrfs_handle_fs_error(root->fs_info, -ENOENT,
                            "Failed lookup while freeing chunk.");
                ret = -ENOENT;
                goto out;
@@ -2671,7 +2671,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans,
 
        ret = btrfs_del_item(trans, root, path);
        if (ret < 0)
-               btrfs_std_error(root->fs_info, ret,
+               btrfs_handle_fs_error(root->fs_info, ret,
                            "Failed to delete chunk item.");
 out:
        btrfs_free_path(path);
@@ -2857,7 +2857,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, u64 chunk_offset)
                                                     chunk_offset);
        if (IS_ERR(trans)) {
                ret = PTR_ERR(trans);
-               btrfs_std_error(root->fs_info, ret, NULL);
+               btrfs_handle_fs_error(root->fs_info, ret, NULL);
                return ret;
        }
 
@@ -3632,7 +3632,7 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info)
        unset_balance_control(fs_info);
        ret = del_balance_item(fs_info->tree_root);
        if (ret)
-               btrfs_std_error(fs_info, ret, NULL);
+               btrfs_handle_fs_error(fs_info, ret, NULL);
 
        atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
 }