Commit 125ccb0a authored by Li Zefan's avatar Li Zefan

Btrfs: don't pass a trans handle unnecessarily in volumes.c

Some functions never use the transaction handle passed to them.
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
parent 4da6f1a3
...@@ -7084,7 +7084,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) ...@@ -7084,7 +7084,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)
* space to fit our block group in. * space to fit our block group in.
*/ */
if (device->total_bytes > device->bytes_used + min_free) { if (device->total_bytes > device->bytes_used + min_free) {
ret = find_free_dev_extent(NULL, device, min_free, ret = find_free_dev_extent(device, min_free,
&dev_offset, NULL); &dev_offset, NULL);
if (!ret) if (!ret)
dev_nr++; dev_nr++;
......
...@@ -829,7 +829,6 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start, ...@@ -829,7 +829,6 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
/* /*
* find_free_dev_extent - find free space in the specified device * find_free_dev_extent - find free space in the specified device
* @trans: transaction handler
* @device: the device which we search the free space in * @device: the device which we search the free space in
* @num_bytes: the size of the free space that we need * @num_bytes: the size of the free space that we need
* @start: store the start of the free space. * @start: store the start of the free space.
...@@ -848,8 +847,7 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start, ...@@ -848,8 +847,7 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
* But if we don't find suitable free space, it is used to store the size of * But if we don't find suitable free space, it is used to store the size of
* the max free space. * the max free space.
*/ */
int find_free_dev_extent(struct btrfs_trans_handle *trans, int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
struct btrfs_device *device, u64 num_bytes,
u64 *start, u64 *len) u64 *start, u64 *len)
{ {
struct btrfs_key key; struct btrfs_key key;
...@@ -893,7 +891,7 @@ int find_free_dev_extent(struct btrfs_trans_handle *trans, ...@@ -893,7 +891,7 @@ int find_free_dev_extent(struct btrfs_trans_handle *trans,
key.offset = search_start; key.offset = search_start;
key.type = BTRFS_DEV_EXTENT_KEY; key.type = BTRFS_DEV_EXTENT_KEY;
ret = btrfs_search_slot(trans, root, &key, path, 0, 0); ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0) if (ret < 0)
goto out; goto out;
if (ret > 0) { if (ret > 0) {
...@@ -1469,8 +1467,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) ...@@ -1469,8 +1467,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
/* /*
* does all the dirty work required for changing file system's UUID. * does all the dirty work required for changing file system's UUID.
*/ */
static int btrfs_prepare_sprout(struct btrfs_trans_handle *trans, static int btrfs_prepare_sprout(struct btrfs_root *root)
struct btrfs_root *root)
{ {
struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices;
struct btrfs_fs_devices *old_devices; struct btrfs_fs_devices *old_devices;
...@@ -1695,7 +1692,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) ...@@ -1695,7 +1692,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
if (seeding_dev) { if (seeding_dev) {
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;
ret = btrfs_prepare_sprout(trans, root); ret = btrfs_prepare_sprout(root);
BUG_ON(ret); BUG_ON(ret);
} }
...@@ -2323,8 +2320,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -2323,8 +2320,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
return ret; return ret;
} }
static int btrfs_add_system_chunk(struct btrfs_trans_handle *trans, static int btrfs_add_system_chunk(struct btrfs_root *root,
struct btrfs_root *root,
struct btrfs_key *key, struct btrfs_key *key,
struct btrfs_chunk *chunk, int item_size) struct btrfs_chunk *chunk, int item_size)
{ {
...@@ -2496,7 +2492,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -2496,7 +2492,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if (total_avail == 0) if (total_avail == 0)
continue; continue;
ret = find_free_dev_extent(trans, device, ret = find_free_dev_extent(device,
max_stripe_size * dev_stripes, max_stripe_size * dev_stripes,
&dev_offset, &max_avail); &dev_offset, &max_avail);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
...@@ -2687,7 +2683,7 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans, ...@@ -2687,7 +2683,7 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans,
BUG_ON(ret); BUG_ON(ret);
if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) { if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) {
ret = btrfs_add_system_chunk(trans, chunk_root, &key, chunk, ret = btrfs_add_system_chunk(chunk_root, &key, chunk,
item_size); item_size);
BUG_ON(ret); BUG_ON(ret);
} }
......
...@@ -230,7 +230,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); ...@@ -230,7 +230,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
int btrfs_init_new_device(struct btrfs_root *root, char *path); int btrfs_init_new_device(struct btrfs_root *root, char *path);
int btrfs_balance(struct btrfs_root *dev_root); int btrfs_balance(struct btrfs_root *dev_root);
int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
int find_free_dev_extent(struct btrfs_trans_handle *trans, int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
struct btrfs_device *device, u64 num_bytes,
u64 *start, u64 *max_avail); u64 *start, u64 *max_avail);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment