mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
btrfs: locking: rip out path->leave_spinning
We no longer distinguish between blocking and spinning, so rip out all this code. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ac5887c8e0
commit
b9729ce014
@ -1669,13 +1669,11 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
|
||||
s64 bytes_left = ((s64)size) - 1;
|
||||
struct extent_buffer *eb = eb_in;
|
||||
struct btrfs_key found_key;
|
||||
int leave_spinning = path->leave_spinning;
|
||||
struct btrfs_inode_ref *iref;
|
||||
|
||||
if (bytes_left >= 0)
|
||||
dest[bytes_left] = '\0';
|
||||
|
||||
path->leave_spinning = 1;
|
||||
while (1) {
|
||||
bytes_left -= name_len;
|
||||
if (bytes_left >= 0)
|
||||
@ -1719,7 +1717,6 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
|
||||
}
|
||||
|
||||
btrfs_release_path(path);
|
||||
path->leave_spinning = leave_spinning;
|
||||
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
@ -5327,7 +5327,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
|
||||
struct btrfs_key key;
|
||||
u32 nritems;
|
||||
int ret;
|
||||
int old_spinning = path->leave_spinning;
|
||||
int next_rw_lock = 0;
|
||||
|
||||
nritems = btrfs_header_nritems(path->nodes[0]);
|
||||
@ -5342,7 +5341,6 @@ again:
|
||||
btrfs_release_path(path);
|
||||
|
||||
path->keep_locks = 1;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
if (time_seq)
|
||||
ret = btrfs_search_old_slot(root, &key, path, time_seq);
|
||||
@ -5477,7 +5475,6 @@ again:
|
||||
ret = 0;
|
||||
done:
|
||||
unlock_up(path, 0, 1, 0, NULL);
|
||||
path->leave_spinning = old_spinning;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -371,7 +371,6 @@ struct btrfs_path {
|
||||
unsigned int search_for_split:1;
|
||||
unsigned int keep_locks:1;
|
||||
unsigned int skip_locking:1;
|
||||
unsigned int leave_spinning:1;
|
||||
unsigned int search_commit_root:1;
|
||||
unsigned int need_commit_sem:1;
|
||||
unsigned int skip_release_on_error:1;
|
||||
|
@ -1147,7 +1147,6 @@ static int __btrfs_run_delayed_items(struct btrfs_trans_handle *trans, int nr)
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
block_rsv = trans->block_rsv;
|
||||
trans->block_rsv = &fs_info->delayed_block_rsv;
|
||||
@ -1212,7 +1211,6 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
|
||||
btrfs_release_delayed_node(delayed_node);
|
||||
return -ENOMEM;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
|
||||
block_rsv = trans->block_rsv;
|
||||
trans->block_rsv = &delayed_node->root->fs_info->delayed_block_rsv;
|
||||
@ -1257,7 +1255,6 @@ int btrfs_commit_inode_delayed_inode(struct btrfs_inode *inode)
|
||||
ret = -ENOMEM;
|
||||
goto trans_out;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
|
||||
block_rsv = trans->block_rsv;
|
||||
trans->block_rsv = &fs_info->delayed_block_rsv;
|
||||
@ -1326,7 +1323,6 @@ static void btrfs_async_run_delayed_root(struct btrfs_work *work)
|
||||
if (!delayed_node)
|
||||
break;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
root = delayed_node->root;
|
||||
|
||||
trans = btrfs_join_transaction(root);
|
||||
|
@ -127,7 +127,6 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, const char *name,
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
btrfs_cpu_key_to_disk(&disk_key, location);
|
||||
|
||||
|
@ -222,7 +222,6 @@ static int btrfs_get_name(struct dentry *parent, char *name,
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
if (ino == BTRFS_FIRST_FREE_OBJECTID) {
|
||||
key.objectid = BTRFS_I(inode)->root->root_key.objectid;
|
||||
|
@ -1465,7 +1465,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
/* this will setup the path even if it fails to insert the back ref */
|
||||
ret = insert_inline_extent_backref(trans, path, bytenr, num_bytes,
|
||||
parent, root_objectid, owner,
|
||||
@ -1489,7 +1488,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
|
||||
btrfs_mark_buffer_dirty(leaf);
|
||||
btrfs_release_path(path);
|
||||
|
||||
path->leave_spinning = 1;
|
||||
/* now insert the actual backref */
|
||||
if (owner < BTRFS_FIRST_FREE_OBJECTID) {
|
||||
BUG_ON(refs_to_add != 1);
|
||||
@ -1605,7 +1603,6 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
|
||||
}
|
||||
|
||||
again:
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 1);
|
||||
if (ret < 0) {
|
||||
err = ret;
|
||||
@ -3021,8 +3018,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
|
||||
is_data = owner_objectid >= BTRFS_FIRST_FREE_OBJECTID;
|
||||
|
||||
if (!is_data && refs_to_drop != 1) {
|
||||
@ -3087,7 +3082,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
|
||||
goto out;
|
||||
}
|
||||
btrfs_release_path(path);
|
||||
path->leave_spinning = 1;
|
||||
|
||||
/* Slow path to locate EXTENT/METADATA_ITEM */
|
||||
key.objectid = bytenr;
|
||||
@ -4429,7 +4423,6 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path,
|
||||
ins, size);
|
||||
if (ret) {
|
||||
@ -4514,7 +4507,6 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path,
|
||||
&extent_key, size);
|
||||
if (ret) {
|
||||
|
@ -4696,7 +4696,6 @@ int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
roots = ulist_alloc(GFP_KERNEL);
|
||||
tmp_ulist = ulist_alloc(GFP_KERNEL);
|
||||
|
@ -142,7 +142,6 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
|
||||
file_key.offset = pos;
|
||||
file_key.type = BTRFS_EXTENT_DATA_KEY;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
||||
sizeof(*item));
|
||||
if (ret < 0)
|
||||
@ -706,7 +705,6 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
|
||||
key.offset = end_byte - 1;
|
||||
key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
||||
if (ret > 0) {
|
||||
if (path->slots[0] == 0)
|
||||
@ -990,10 +988,8 @@ insert:
|
||||
} else {
|
||||
ins_size = csum_size;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
||||
ins_size);
|
||||
path->leave_spinning = 0;
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (WARN_ON(ret != 0))
|
||||
|
@ -1193,8 +1193,6 @@ static int clear_free_space_tree(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
|
||||
key.objectid = 0;
|
||||
key.type = 0;
|
||||
key.offset = 0;
|
||||
|
@ -119,8 +119,6 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
|
||||
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
||||
if (ret > 0)
|
||||
ret = -ENOENT;
|
||||
@ -193,8 +191,6 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
|
||||
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
||||
if (ret > 0) {
|
||||
ret = -ENOENT;
|
||||
@ -270,7 +266,6 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||
ins_len);
|
||||
if (ret == -EEXIST) {
|
||||
@ -327,7 +322,6 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
path->skip_release_on_error = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||
ins_len);
|
||||
|
@ -234,7 +234,6 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
|
||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||
|
||||
datasize = btrfs_file_extent_calc_inline_size(cur_size);
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||
datasize);
|
||||
if (ret)
|
||||
@ -2596,7 +2595,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
|
||||
ins.offset = file_pos;
|
||||
ins.type = BTRFS_EXTENT_DATA_KEY;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(trans, root, path, &ins,
|
||||
sizeof(*stack_fi));
|
||||
if (ret)
|
||||
@ -3588,7 +3586,6 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_lookup_inode(trans, root, path, &BTRFS_I(inode)->location,
|
||||
1);
|
||||
if (ret) {
|
||||
@ -3677,7 +3674,6 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
|
||||
goto out;
|
||||
}
|
||||
|
||||
path->leave_spinning = 1;
|
||||
di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
|
||||
name, name_len, -1);
|
||||
if (IS_ERR_OR_NULL(di)) {
|
||||
@ -6129,7 +6125,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems);
|
||||
if (ret != 0)
|
||||
goto fail_unlock;
|
||||
@ -6680,13 +6675,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
|
||||
|
||||
/* Chances are we'll be called again, so go ahead and do readahead */
|
||||
path->reada = READA_FORWARD;
|
||||
|
||||
/*
|
||||
* Unless we're going to uncompress the inline extent, no sleep would
|
||||
* happen.
|
||||
*/
|
||||
path->leave_spinning = 1;
|
||||
|
||||
path->recurse = btrfs_is_free_space_inode(inode);
|
||||
|
||||
ret = btrfs_lookup_file_extent(NULL, root, path, objectid, start, 0);
|
||||
|
@ -3393,7 +3393,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
|
||||
ret = -ENOMEM;
|
||||
goto out_free;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
|
||||
trans = btrfs_start_transaction(root, 1);
|
||||
if (IS_ERR(trans)) {
|
||||
|
@ -894,8 +894,6 @@ static int btrfs_clean_quota_tree(struct btrfs_trans_handle *trans,
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
path->leave_spinning = 1;
|
||||
|
||||
key.objectid = 0;
|
||||
key.offset = 0;
|
||||
key.type = 0;
|
||||
|
@ -347,7 +347,6 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
|
||||
u64 drop_start;
|
||||
|
||||
/* Note the key will change type as we walk through the tree */
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_search_slot(NULL, BTRFS_I(src)->root, &key, path,
|
||||
0, 0);
|
||||
if (ret < 0)
|
||||
@ -417,7 +416,6 @@ process_slot:
|
||||
size);
|
||||
|
||||
btrfs_release_path(path);
|
||||
path->leave_spinning = 0;
|
||||
|
||||
memcpy(&new_key, &key, sizeof(new_key));
|
||||
new_key.objectid = btrfs_ino(BTRFS_I(inode));
|
||||
@ -533,7 +531,6 @@ process_slot:
|
||||
* mixing buffered and direct IO writes against this file.
|
||||
*/
|
||||
btrfs_release_path(path);
|
||||
path->leave_spinning = 0;
|
||||
|
||||
ret = btrfs_replace_file_extents(inode, path, last_dest_end,
|
||||
destoff + len - 1, NULL, &trans);
|
||||
|
@ -1163,7 +1163,6 @@ char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
|
||||
name = kmalloc(PATH_MAX, GFP_KERNEL);
|
||||
if (!name) {
|
||||
@ -1292,7 +1291,6 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
|
||||
path = btrfs_alloc_path();
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
path->leave_spinning = 1;
|
||||
|
||||
/*
|
||||
* Find the "default" dir item which points to the root item that we
|
||||
|
@ -36,7 +36,6 @@ static int insert_normal_tree_ref(struct btrfs_root *root, u64 bytenr,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_insert_empty_item(&trans, root, path, &ins, size);
|
||||
if (ret) {
|
||||
test_err("couldn't insert ref %d", ret);
|
||||
@ -86,7 +85,6 @@ static int add_tree_ref(struct btrfs_root *root, u64 bytenr, u64 num_bytes,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_search_slot(&trans, root, &key, path, 0, 1);
|
||||
if (ret) {
|
||||
test_err("couldn't find extent ref");
|
||||
@ -135,7 +133,6 @@ static int remove_extent_item(struct btrfs_root *root, u64 bytenr,
|
||||
test_std_err(TEST_ALLOC_ROOT);
|
||||
return -ENOMEM;
|
||||
}
|
||||
path->leave_spinning = 1;
|
||||
|
||||
ret = btrfs_search_slot(&trans, root, &key, path, -1, 1);
|
||||
if (ret) {
|
||||
@ -170,7 +167,6 @@ static int remove_extent_ref(struct btrfs_root *root, u64 bytenr,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
path->leave_spinning = 1;
|
||||
ret = btrfs_search_slot(&trans, root, &key, path, 0, 1);
|
||||
if (ret) {
|
||||
test_err("couldn't find extent ref");
|
||||
|
Loading…
Reference in New Issue
Block a user