btrfs-progs: update btrfs_cow_block to match the in-kernel definition
btrfs_cow_block takes the lockdep nesting enum in the kernel. Update the definition to match the kernel version to make syncing ctree.c into btrfs-progs more straightforward. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ec9cbf2f43
commit
0fe11183af
|
@ -674,7 +674,8 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans,
|
||||||
int btrfs_cow_block(struct btrfs_trans_handle *trans,
|
int btrfs_cow_block(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, struct extent_buffer *buf,
|
struct btrfs_root *root, struct extent_buffer *buf,
|
||||||
struct extent_buffer *parent, int parent_slot,
|
struct extent_buffer *parent, int parent_slot,
|
||||||
struct extent_buffer **cow_ret)
|
struct extent_buffer **cow_ret,
|
||||||
|
enum btrfs_lock_nesting nest)
|
||||||
{
|
{
|
||||||
u64 search_start;
|
u64 search_start;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -905,7 +906,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||||
/* promote the child to a root */
|
/* promote the child to a root */
|
||||||
child = btrfs_read_node_slot(mid, 0);
|
child = btrfs_read_node_slot(mid, 0);
|
||||||
BUG_ON(!extent_buffer_uptodate(child));
|
BUG_ON(!extent_buffer_uptodate(child));
|
||||||
ret = btrfs_cow_block(trans, root, child, mid, 0, &child);
|
ret = btrfs_cow_block(trans, root, child, mid, 0, &child,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
BUG_ON(ret);
|
BUG_ON(ret);
|
||||||
|
|
||||||
root->node = child;
|
root->node = child;
|
||||||
|
@ -930,7 +932,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||||
left = btrfs_read_node_slot(parent, pslot - 1);
|
left = btrfs_read_node_slot(parent, pslot - 1);
|
||||||
if (extent_buffer_uptodate(left)) {
|
if (extent_buffer_uptodate(left)) {
|
||||||
wret = btrfs_cow_block(trans, root, left,
|
wret = btrfs_cow_block(trans, root, left,
|
||||||
parent, pslot - 1, &left);
|
parent, pslot - 1, &left,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
if (wret) {
|
if (wret) {
|
||||||
ret = wret;
|
ret = wret;
|
||||||
goto enospc;
|
goto enospc;
|
||||||
|
@ -939,7 +942,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
||||||
right = btrfs_read_node_slot(parent, pslot + 1);
|
right = btrfs_read_node_slot(parent, pslot + 1);
|
||||||
if (extent_buffer_uptodate(right)) {
|
if (extent_buffer_uptodate(right)) {
|
||||||
wret = btrfs_cow_block(trans, root, right,
|
wret = btrfs_cow_block(trans, root, right,
|
||||||
parent, pslot + 1, &right);
|
parent, pslot + 1, &right,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
if (wret) {
|
if (wret) {
|
||||||
ret = wret;
|
ret = wret;
|
||||||
goto enospc;
|
goto enospc;
|
||||||
|
@ -1097,7 +1101,8 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
|
||||||
wret = 1;
|
wret = 1;
|
||||||
} else {
|
} else {
|
||||||
ret = btrfs_cow_block(trans, root, left, parent,
|
ret = btrfs_cow_block(trans, root, left, parent,
|
||||||
pslot - 1, &left);
|
pslot - 1, &left,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
if (ret)
|
if (ret)
|
||||||
wret = 1;
|
wret = 1;
|
||||||
else {
|
else {
|
||||||
|
@ -1140,7 +1145,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
|
||||||
} else {
|
} else {
|
||||||
ret = btrfs_cow_block(trans, root, right,
|
ret = btrfs_cow_block(trans, root, right,
|
||||||
parent, pslot + 1,
|
parent, pslot + 1,
|
||||||
&right);
|
&right, BTRFS_NESTING_NORMAL);
|
||||||
if (ret)
|
if (ret)
|
||||||
wret = 1;
|
wret = 1;
|
||||||
else {
|
else {
|
||||||
|
@ -1330,7 +1335,7 @@ again:
|
||||||
wret = btrfs_cow_block(trans, root, b,
|
wret = btrfs_cow_block(trans, root, b,
|
||||||
p->nodes[level + 1],
|
p->nodes[level + 1],
|
||||||
p->slots[level + 1],
|
p->slots[level + 1],
|
||||||
&b);
|
&b, BTRFS_NESTING_NORMAL);
|
||||||
if (wret) {
|
if (wret) {
|
||||||
free_extent_buffer(b);
|
free_extent_buffer(b);
|
||||||
return wret;
|
return wret;
|
||||||
|
@ -1939,7 +1944,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||||
|
|
||||||
/* cow and double check */
|
/* cow and double check */
|
||||||
ret = btrfs_cow_block(trans, root, right, upper,
|
ret = btrfs_cow_block(trans, root, right, upper,
|
||||||
slot + 1, &right);
|
slot + 1, &right, BTRFS_NESTING_NORMAL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
free_extent_buffer(right);
|
free_extent_buffer(right);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2085,7 +2090,8 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||||
|
|
||||||
/* cow and double check */
|
/* cow and double check */
|
||||||
ret = btrfs_cow_block(trans, root, left,
|
ret = btrfs_cow_block(trans, root, left,
|
||||||
path->nodes[1], slot - 1, &left);
|
path->nodes[1], slot - 1, &left,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
/* we hit -ENOSPC, but it isn't fatal here */
|
/* we hit -ENOSPC, but it isn't fatal here */
|
||||||
free_extent_buffer(left);
|
free_extent_buffer(left);
|
||||||
|
|
|
@ -963,7 +963,8 @@ int btrfs_previous_extent_item(struct btrfs_root *root,
|
||||||
int btrfs_cow_block(struct btrfs_trans_handle *trans,
|
int btrfs_cow_block(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, struct extent_buffer *buf,
|
struct btrfs_root *root, struct extent_buffer *buf,
|
||||||
struct extent_buffer *parent, int parent_slot,
|
struct extent_buffer *parent, int parent_slot,
|
||||||
struct extent_buffer **cow_ret);
|
struct extent_buffer **cow_ret,
|
||||||
|
enum btrfs_lock_nesting nest);
|
||||||
int btrfs_copy_root(struct btrfs_trans_handle *trans,
|
int btrfs_copy_root(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
struct extent_buffer *buf,
|
struct extent_buffer *buf,
|
||||||
|
|
|
@ -100,7 +100,8 @@ int commit_tree_roots(struct btrfs_trans_handle *trans,
|
||||||
|
|
||||||
eb = fs_info->tree_root->node;
|
eb = fs_info->tree_root->node;
|
||||||
extent_buffer_get(eb);
|
extent_buffer_get(eb);
|
||||||
ret = btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb);
|
ret = btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb,
|
||||||
|
BTRFS_NESTING_NORMAL);
|
||||||
free_extent_buffer(eb);
|
free_extent_buffer(eb);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue