summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-06-08 15:47:45 +0300
committerDavid Sterba <dsterba@suse.com>2018-08-06 15:01:46 +0200
commitdddc3f44c9b74695fb5860d9fdb246f5f78ebbaa (patch)
tree31e8091303926a9ca3ea49cd7060002c191a9563
parent819ac5393149a1c8b09a58f84214395071929b5c (diff)
btrfs-progs: Remove root argument from btrfs_del_csums
It's not needed, since we can obtain a reference to fs_info from the passed transaction handle. This is needed by delayed refs code. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--btrfs-corrupt-block.c2
-rw-r--r--ctree.h3
-rw-r--r--extent-tree.c2
-rw-r--r--file-item.c20
4 files changed, 13 insertions, 14 deletions
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c
index 4fbea26c..3add8e63 100644
--- a/btrfs-corrupt-block.c
+++ b/btrfs-corrupt-block.c
@@ -926,7 +926,7 @@ static int delete_csum(struct btrfs_root *root, u64 bytenr, u64 bytes)
return PTR_ERR(trans);
}
- ret = btrfs_del_csums(trans, root, bytenr, bytes);
+ ret = btrfs_del_csums(trans, bytenr, bytes);
if (ret)
fprintf(stderr, "Error deleting csums %d\n", ret);
btrfs_commit_transaction(trans, root);
diff --git a/ctree.h b/ctree.h
index 04a77550..7d4e9b63 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2730,8 +2730,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
u64 ino, u64 parent_ino, u64 *index);
/* file-item.c */
-int btrfs_del_csums(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 bytenr, u64 len);
+int btrfs_del_csums(struct btrfs_trans_handle *trans, u64 bytenr, u64 len);
int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 objectid, u64 pos, u64 offset,
diff --git a/extent-tree.c b/extent-tree.c
index cbc022f6..c6f09b52 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2372,7 +2372,7 @@ static int __free_extent(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
if (is_data) {
- ret = btrfs_del_csums(trans, root, bytenr, num_bytes);
+ ret = btrfs_del_csums(trans, bytenr, num_bytes);
BUG_ON(ret);
}
diff --git a/file-item.c b/file-item.c
index 7b0ff358..71d4e89f 100644
--- a/file-item.c
+++ b/file-item.c
@@ -394,8 +394,7 @@ static noinline int truncate_one_csum(struct btrfs_root *root,
* deletes the csum items from the csum tree for a given
* range of bytes.
*/
-int btrfs_del_csums(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 bytenr, u64 len)
+int btrfs_del_csums(struct btrfs_trans_handle *trans, u64 bytenr, u64 len)
{
struct btrfs_path *path;
struct btrfs_key key;
@@ -403,11 +402,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
u64 csum_end;
struct extent_buffer *leaf;
int ret;
- u16 csum_size =
- btrfs_super_csum_size(root->fs_info->super_copy);
- int blocksize = root->fs_info->sectorsize;
+ u16 csum_size = btrfs_super_csum_size(trans->fs_info->super_copy);
+ int blocksize = trans->fs_info->sectorsize;
+ struct btrfs_root *csum_root = trans->fs_info->csum_root;
- root = root->fs_info->csum_root;
path = btrfs_alloc_path();
if (!path)
@@ -418,7 +416,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
key.offset = end_byte - 1;
key.type = BTRFS_EXTENT_CSUM_KEY;
- ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
+ ret = btrfs_search_slot(trans, csum_root, &key, path, -1, 1);
if (ret > 0) {
if (path->slots[0] == 0)
goto out;
@@ -445,7 +443,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
/* delete the entire item, it is inside our range */
if (key.offset >= bytenr && csum_end <= end_byte) {
- ret = btrfs_del_item(trans, root, path);
+ ret = btrfs_del_item(trans, csum_root, path);
BUG_ON(ret);
} else if (key.offset < bytenr && csum_end > end_byte) {
unsigned long offset;
@@ -485,12 +483,14 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
* btrfs_split_item returns -EAGAIN when the
* item changed size or key
*/
- ret = btrfs_split_item(trans, root, path, &key, offset);
+ ret = btrfs_split_item(trans, csum_root, path, &key,
+ offset);
BUG_ON(ret && ret != -EAGAIN);
key.offset = end_byte - 1;
} else {
- ret = truncate_one_csum(root, path, &key, bytenr, len);
+ ret = truncate_one_csum(csum_root, path, &key, bytenr,
+ len);
BUG_ON(ret);
}
btrfs_release_path(path);