btrfs: move accessor helpers into accessors.h
[linux-block.git] / fs / btrfs / tree-mod-log.c
index 8a3a14686d3e7e09d41cde0390c3f8fa090a8f55..3bea19698a1003447e1564fa47d005267dcae97b 100644 (file)
@@ -1,7 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 
+#include "messages.h"
 #include "tree-mod-log.h"
 #include "disk-io.h"
+#include "fs.h"
+#include "accessors.h"
 
 struct tree_mod_root {
        u64 logical;
@@ -197,12 +200,11 @@ static inline bool tree_mod_need_log(const struct btrfs_fs_info *fs_info,
 
 static struct tree_mod_elem *alloc_tree_mod_elem(struct extent_buffer *eb,
                                                 int slot,
-                                                enum btrfs_mod_log_op op,
-                                                gfp_t flags)
+                                                enum btrfs_mod_log_op op)
 {
        struct tree_mod_elem *tm;
 
-       tm = kzalloc(sizeof(*tm), flags);
+       tm = kzalloc(sizeof(*tm), GFP_NOFS);
        if (!tm)
                return NULL;
 
@@ -220,7 +222,7 @@ static struct tree_mod_elem *alloc_tree_mod_elem(struct extent_buffer *eb,
 }
 
 int btrfs_tree_mod_log_insert_key(struct extent_buffer *eb, int slot,
-                                 enum btrfs_mod_log_op op, gfp_t flags)
+                                 enum btrfs_mod_log_op op)
 {
        struct tree_mod_elem *tm;
        int ret;
@@ -228,7 +230,7 @@ int btrfs_tree_mod_log_insert_key(struct extent_buffer *eb, int slot,
        if (!tree_mod_need_log(eb->fs_info, eb))
                return 0;
 
-       tm = alloc_tree_mod_elem(eb, slot, op, flags);
+       tm = alloc_tree_mod_elem(eb, slot, op);
        if (!tm)
                return -ENOMEM;
 
@@ -276,7 +278,7 @@ int btrfs_tree_mod_log_insert_move(struct extent_buffer *eb,
 
        for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) {
                tm_list[i] = alloc_tree_mod_elem(eb, i + dst_slot,
-                               BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING, GFP_NOFS);
+                               BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING);
                if (!tm_list[i]) {
                        ret = -ENOMEM;
                        goto free_tms;
@@ -364,7 +366,7 @@ int btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root,
                }
                for (i = 0; i < nritems; i++) {
                        tm_list[i] = alloc_tree_mod_elem(old_root, i,
-                           BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING, GFP_NOFS);
+                           BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING);
                        if (!tm_list[i]) {
                                ret = -ENOMEM;
                                goto free_tms;
@@ -502,14 +504,14 @@ int btrfs_tree_mod_log_eb_copy(struct extent_buffer *dst,
        tm_list_rem = tm_list + nr_items;
        for (i = 0; i < nr_items; i++) {
                tm_list_rem[i] = alloc_tree_mod_elem(src, i + src_offset,
-                   BTRFS_MOD_LOG_KEY_REMOVE, GFP_NOFS);
+                                                    BTRFS_MOD_LOG_KEY_REMOVE);
                if (!tm_list_rem[i]) {
                        ret = -ENOMEM;
                        goto free_tms;
                }
 
                tm_list_add[i] = alloc_tree_mod_elem(dst, i + dst_offset,
-                                               BTRFS_MOD_LOG_KEY_ADD, GFP_NOFS);
+                                                    BTRFS_MOD_LOG_KEY_ADD);
                if (!tm_list_add[i]) {
                        ret = -ENOMEM;
                        goto free_tms;
@@ -564,7 +566,7 @@ int btrfs_tree_mod_log_free_eb(struct extent_buffer *eb)
 
        for (i = 0; i < nritems; i++) {
                tm_list[i] = alloc_tree_mod_elem(eb, i,
-                   BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING, GFP_NOFS);
+                                   BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING);
                if (!tm_list[i]) {
                        ret = -ENOMEM;
                        goto free_tms;