mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-13 09:11:36 +00:00
btrfs-progs: pass btrfs_trans_handle through btrfs_clear_buffer_dirty
This is the calling convention in the kernel because we track dirty blocks per transaction instead of globally in the fs_info. Simply mirror what we do in the kernel to make it easier to sync ctree.c locally. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ea58c1d9c2
commit
f94ad0c516
@ -340,7 +340,7 @@ static int clear_uuid_tree(struct btrfs_fs_info *fs_info)
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
list_del(&uuid_root->dirty_list);
|
||||
ret = btrfs_clear_buffer_dirty(uuid_root->node);
|
||||
ret = btrfs_clear_buffer_dirty(trans, uuid_root->node);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
ret = btrfs_free_tree_block(trans, btrfs_root_id(uuid_root),
|
||||
|
@ -571,7 +571,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
|
||||
ret = btrfs_dec_ref(trans, root, buf, 1);
|
||||
BUG_ON(ret);
|
||||
}
|
||||
btrfs_clear_buffer_dirty(buf);
|
||||
btrfs_clear_buffer_dirty(trans, buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -917,7 +917,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||
root->node = child;
|
||||
add_root_to_dirty_list(root);
|
||||
path->nodes[level] = NULL;
|
||||
btrfs_clear_buffer_dirty(mid);
|
||||
btrfs_clear_buffer_dirty(trans, mid);
|
||||
/* once for the path */
|
||||
free_extent_buffer(mid);
|
||||
|
||||
@ -971,7 +971,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||
u64 bytenr = right->start;
|
||||
u32 blocksize = right->len;
|
||||
|
||||
btrfs_clear_buffer_dirty(right);
|
||||
btrfs_clear_buffer_dirty(trans, right);
|
||||
free_extent_buffer(right);
|
||||
right = NULL;
|
||||
wret = btrfs_del_ptr(root, path, level + 1, pslot + 1);
|
||||
@ -1018,7 +1018,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||
/* we've managed to empty the middle node, drop it */
|
||||
u64 bytenr = mid->start;
|
||||
u32 blocksize = mid->len;
|
||||
btrfs_clear_buffer_dirty(mid);
|
||||
btrfs_clear_buffer_dirty(trans, mid);
|
||||
free_extent_buffer(mid);
|
||||
mid = NULL;
|
||||
wret = btrfs_del_ptr(root, path, level + 1, pslot);
|
||||
@ -2982,7 +2982,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
|
||||
if (leaf == root->node) {
|
||||
btrfs_set_header_level(leaf, 0);
|
||||
} else {
|
||||
btrfs_clear_buffer_dirty(leaf);
|
||||
btrfs_clear_buffer_dirty(trans, leaf);
|
||||
wret = btrfs_del_leaf(trans, root, path, leaf);
|
||||
BUG_ON(ret);
|
||||
if (wret)
|
||||
@ -3018,7 +3018,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
|
||||
}
|
||||
|
||||
if (btrfs_header_nritems(leaf) == 0) {
|
||||
btrfs_clear_buffer_dirty(leaf);
|
||||
btrfs_clear_buffer_dirty(trans, leaf);
|
||||
path->slots[1] = slot;
|
||||
ret = btrfs_del_leaf(trans, root, path, leaf);
|
||||
BUG_ON(ret);
|
||||
|
@ -2316,7 +2316,7 @@ int btrfs_delete_and_free_root(struct btrfs_trans_handle *trans,
|
||||
return ret;
|
||||
|
||||
list_del(&root->dirty_list);
|
||||
ret = btrfs_clear_buffer_dirty(root->node);
|
||||
ret = btrfs_clear_buffer_dirty(trans, root->node);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = btrfs_free_tree_block(trans, btrfs_root_id(root), root->node, 0, 1);
|
||||
|
@ -1898,7 +1898,7 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans, u64 bytenr,
|
||||
if (header_owner != BTRFS_TREE_LOG_OBJECTID &&
|
||||
header_transid == trans->transid &&
|
||||
!btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
|
||||
btrfs_clear_buffer_dirty(buf);
|
||||
btrfs_clear_buffer_dirty(trans, buf);
|
||||
free_extent_buffer(buf);
|
||||
return 1;
|
||||
}
|
||||
|
@ -585,7 +585,8 @@ int set_extent_buffer_dirty(struct extent_buffer *eb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int btrfs_clear_buffer_dirty(struct extent_buffer *eb)
|
||||
int btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
|
||||
struct extent_buffer *eb)
|
||||
{
|
||||
struct extent_io_tree *tree = &eb->fs_info->dirty_buffers;
|
||||
if (eb->flags & EXTENT_BUFFER_DIRTY) {
|
||||
|
@ -54,6 +54,7 @@ static inline int le_test_bit(int nr, const u8 *addr)
|
||||
}
|
||||
|
||||
struct btrfs_fs_info;
|
||||
struct btrfs_trans_handle;
|
||||
|
||||
struct extent_buffer {
|
||||
struct cache_extent cache_node;
|
||||
@ -128,7 +129,8 @@ void memset_extent_buffer(const struct extent_buffer *eb, char c,
|
||||
int extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start,
|
||||
unsigned long nr);
|
||||
int set_extent_buffer_dirty(struct extent_buffer *eb);
|
||||
int btrfs_clear_buffer_dirty(struct extent_buffer *eb);
|
||||
int btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans,
|
||||
struct extent_buffer *eb);
|
||||
int read_data_from_disk(struct btrfs_fs_info *info, void *buf, u64 logical,
|
||||
u64 *len, int mirror);
|
||||
int write_data_to_disk(struct btrfs_fs_info *info, const void *buf, u64 offset,
|
||||
|
@ -163,7 +163,7 @@ again:
|
||||
goto cleanup;
|
||||
}
|
||||
start += eb->len;
|
||||
btrfs_clear_buffer_dirty(eb);
|
||||
btrfs_clear_buffer_dirty(trans, eb);
|
||||
free_extent_buffer(eb);
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ cleanup:
|
||||
eb = find_first_extent_buffer(fs_info, start);
|
||||
BUG_ON(!eb || eb->start != start);
|
||||
start += eb->len;
|
||||
btrfs_clear_buffer_dirty(eb);
|
||||
btrfs_clear_buffer_dirty(trans, eb);
|
||||
free_extent_buffer(eb);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user