diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-12-08 02:07:24 -0500 |
---|---|---|
committer | Li Zefan <lizf@cn.fujitsu.com> | 2012-01-10 21:26:42 -0500 |
commit | 125ccb0ae6806dbec31abf4a85448971df3b4e39 (patch) | |
tree | f530e85bea0639379997000a37e914d180e9e5b4 /fs | |
parent | 4da6f1a332f6c16b6594c7892f13c31459b9b1c8 (diff) |
Btrfs: don't pass a trans handle unnecessarily in volumes.c
Some functions never use the transaction handle passed to them.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 18 | ||||
-rw-r--r-- | fs/btrfs/volumes.h | 3 |
3 files changed, 9 insertions, 14 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8603ee4e3dfd..5b53479ce07b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7084,7 +7084,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) | |||
7084 | * space to fit our block group in. | 7084 | * space to fit our block group in. |
7085 | */ | 7085 | */ |
7086 | if (device->total_bytes > device->bytes_used + min_free) { | 7086 | if (device->total_bytes > device->bytes_used + min_free) { |
7087 | ret = find_free_dev_extent(NULL, device, min_free, | 7087 | ret = find_free_dev_extent(device, min_free, |
7088 | &dev_offset, NULL); | 7088 | &dev_offset, NULL); |
7089 | if (!ret) | 7089 | if (!ret) |
7090 | dev_nr++; | 7090 | dev_nr++; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f4b839fd3c9d..73f673c8d8d8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -829,7 +829,6 @@ out: | |||
829 | 829 | ||
830 | /* | 830 | /* |
831 | * find_free_dev_extent - find free space in the specified device | 831 | * find_free_dev_extent - find free space in the specified device |
832 | * @trans: transaction handler | ||
833 | * @device: the device which we search the free space in | 832 | * @device: the device which we search the free space in |
834 | * @num_bytes: the size of the free space that we need | 833 | * @num_bytes: the size of the free space that we need |
835 | * @start: store the start of the free space. | 834 | * @start: store the start of the free space. |
@@ -848,8 +847,7 @@ out: | |||
848 | * But if we don't find suitable free space, it is used to store the size of | 847 | * But if we don't find suitable free space, it is used to store the size of |
849 | * the max free space. | 848 | * the max free space. |
850 | */ | 849 | */ |
851 | int find_free_dev_extent(struct btrfs_trans_handle *trans, | 850 | int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, |
852 | struct btrfs_device *device, u64 num_bytes, | ||
853 | u64 *start, u64 *len) | 851 | u64 *start, u64 *len) |
854 | { | 852 | { |
855 | struct btrfs_key key; | 853 | struct btrfs_key key; |
@@ -893,7 +891,7 @@ int find_free_dev_extent(struct btrfs_trans_handle *trans, | |||
893 | key.offset = search_start; | 891 | key.offset = search_start; |
894 | key.type = BTRFS_DEV_EXTENT_KEY; | 892 | key.type = BTRFS_DEV_EXTENT_KEY; |
895 | 893 | ||
896 | ret = btrfs_search_slot(trans, root, &key, path, 0, 0); | 894 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
897 | if (ret < 0) | 895 | if (ret < 0) |
898 | goto out; | 896 | goto out; |
899 | if (ret > 0) { | 897 | if (ret > 0) { |
@@ -1469,8 +1467,7 @@ error_undo: | |||
1469 | /* | 1467 | /* |
1470 | * does all the dirty work required for changing file system's UUID. | 1468 | * does all the dirty work required for changing file system's UUID. |
1471 | */ | 1469 | */ |
1472 | static int btrfs_prepare_sprout(struct btrfs_trans_handle *trans, | 1470 | static int btrfs_prepare_sprout(struct btrfs_root *root) |
1473 | struct btrfs_root *root) | ||
1474 | { | 1471 | { |
1475 | struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; | 1472 | struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; |
1476 | struct btrfs_fs_devices *old_devices; | 1473 | struct btrfs_fs_devices *old_devices; |
@@ -1695,7 +1692,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1695 | 1692 | ||
1696 | if (seeding_dev) { | 1693 | if (seeding_dev) { |
1697 | sb->s_flags &= ~MS_RDONLY; | 1694 | sb->s_flags &= ~MS_RDONLY; |
1698 | ret = btrfs_prepare_sprout(trans, root); | 1695 | ret = btrfs_prepare_sprout(root); |
1699 | BUG_ON(ret); | 1696 | BUG_ON(ret); |
1700 | } | 1697 | } |
1701 | 1698 | ||
@@ -2323,8 +2320,7 @@ done: | |||
2323 | return ret; | 2320 | return ret; |
2324 | } | 2321 | } |
2325 | 2322 | ||
2326 | static int btrfs_add_system_chunk(struct btrfs_trans_handle *trans, | 2323 | static int btrfs_add_system_chunk(struct btrfs_root *root, |
2327 | struct btrfs_root *root, | ||
2328 | struct btrfs_key *key, | 2324 | struct btrfs_key *key, |
2329 | struct btrfs_chunk *chunk, int item_size) | 2325 | struct btrfs_chunk *chunk, int item_size) |
2330 | { | 2326 | { |
@@ -2496,7 +2492,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
2496 | if (total_avail == 0) | 2492 | if (total_avail == 0) |
2497 | continue; | 2493 | continue; |
2498 | 2494 | ||
2499 | ret = find_free_dev_extent(trans, device, | 2495 | ret = find_free_dev_extent(device, |
2500 | max_stripe_size * dev_stripes, | 2496 | max_stripe_size * dev_stripes, |
2501 | &dev_offset, &max_avail); | 2497 | &dev_offset, &max_avail); |
2502 | if (ret && ret != -ENOSPC) | 2498 | if (ret && ret != -ENOSPC) |
@@ -2687,7 +2683,7 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans, | |||
2687 | BUG_ON(ret); | 2683 | BUG_ON(ret); |
2688 | 2684 | ||
2689 | if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) { | 2685 | if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) { |
2690 | ret = btrfs_add_system_chunk(trans, chunk_root, &key, chunk, | 2686 | ret = btrfs_add_system_chunk(chunk_root, &key, chunk, |
2691 | item_size); | 2687 | item_size); |
2692 | BUG_ON(ret); | 2688 | BUG_ON(ret); |
2693 | } | 2689 | } |
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 78f2d4d4f37f..c1701ec9d49f 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -230,7 +230,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); | |||
230 | int btrfs_init_new_device(struct btrfs_root *root, char *path); | 230 | int btrfs_init_new_device(struct btrfs_root *root, char *path); |
231 | int btrfs_balance(struct btrfs_root *dev_root); | 231 | int btrfs_balance(struct btrfs_root *dev_root); |
232 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); | 232 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); |
233 | int find_free_dev_extent(struct btrfs_trans_handle *trans, | 233 | int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, |
234 | struct btrfs_device *device, u64 num_bytes, | ||
235 | u64 *start, u64 *max_avail); | 234 | u64 *start, u64 *max_avail); |
236 | #endif | 235 | #endif |