@@ -1681,7 +1681,7 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
16811681 struct btrfs_root * root = fs_info -> dev_root ;
16821682 struct btrfs_key key ;
16831683 struct btrfs_dev_extent * dev_extent ;
1684- struct btrfs_path * path ;
1684+ BTRFS_PATH_AUTO_FREE ( path ) ;
16851685 u64 search_start ;
16861686 u64 hole_size ;
16871687 u64 max_hole_start ;
@@ -1812,7 +1812,6 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
18121812 "max_hole_start=%llu max_hole_size=%llu search_end=%llu" ,
18131813 max_hole_start , max_hole_size , search_end );
18141814out :
1815- btrfs_free_path (path );
18161815 * start = max_hole_start ;
18171816 if (len )
18181817 * len = max_hole_size ;
@@ -1826,7 +1825,7 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
18261825 struct btrfs_fs_info * fs_info = device -> fs_info ;
18271826 struct btrfs_root * root = fs_info -> dev_root ;
18281827 int ret ;
1829- struct btrfs_path * path ;
1828+ BTRFS_PATH_AUTO_FREE ( path ) ;
18301829 struct btrfs_key key ;
18311830 struct btrfs_key found_key ;
18321831 struct extent_buffer * leaf = NULL ;
@@ -1869,7 +1868,6 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
18691868 if (ret == 0 )
18701869 set_bit (BTRFS_TRANS_HAVE_FREE_BGS , & trans -> transaction -> flags );
18711870out :
1872- btrfs_free_path (path );
18731871 return ret ;
18741872}
18751873
@@ -1897,7 +1895,7 @@ static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
18971895 int ret ;
18981896 struct btrfs_key key ;
18991897 struct btrfs_key found_key ;
1900- struct btrfs_path * path ;
1898+ BTRFS_PATH_AUTO_FREE ( path ) ;
19011899
19021900 path = btrfs_alloc_path ();
19031901 if (!path )
@@ -1930,7 +1928,6 @@ static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
19301928 }
19311929 ret = 0 ;
19321930error :
1933- btrfs_free_path (path );
19341931 return ret ;
19351932}
19361933
@@ -1942,7 +1939,7 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
19421939 struct btrfs_device * device )
19431940{
19441941 int ret ;
1945- struct btrfs_path * path ;
1942+ BTRFS_PATH_AUTO_FREE ( path ) ;
19461943 struct btrfs_dev_item * dev_item ;
19471944 struct extent_buffer * leaf ;
19481945 struct btrfs_key key ;
@@ -1989,7 +1986,6 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
19891986
19901987 ret = 0 ;
19911988out :
1992- btrfs_free_path (path );
19931989 return ret ;
19941990}
19951991
@@ -2017,7 +2013,7 @@ static int btrfs_rm_dev_item(struct btrfs_trans_handle *trans,
20172013{
20182014 struct btrfs_root * root = device -> fs_info -> chunk_root ;
20192015 int ret ;
2020- struct btrfs_path * path ;
2016+ BTRFS_PATH_AUTO_FREE ( path ) ;
20212017 struct btrfs_key key ;
20222018
20232019 path = btrfs_alloc_path ();
@@ -2039,7 +2035,6 @@ static int btrfs_rm_dev_item(struct btrfs_trans_handle *trans,
20392035
20402036 ret = btrfs_del_item (trans , root , path );
20412037out :
2042- btrfs_free_path (path );
20432038 return ret ;
20442039}
20452040
@@ -2626,7 +2621,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
26262621 BTRFS_DEV_LOOKUP_ARGS (args );
26272622 struct btrfs_fs_info * fs_info = trans -> fs_info ;
26282623 struct btrfs_root * root = fs_info -> chunk_root ;
2629- struct btrfs_path * path ;
2624+ BTRFS_PATH_AUTO_FREE ( path ) ;
26302625 struct extent_buffer * leaf ;
26312626 struct btrfs_dev_item * dev_item ;
26322627 struct btrfs_device * device ;
@@ -2690,7 +2685,6 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
26902685 }
26912686 ret = 0 ;
26922687error :
2693- btrfs_free_path (path );
26942688 return ret ;
26952689}
26962690
@@ -2946,7 +2940,7 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
29462940 struct btrfs_device * device )
29472941{
29482942 int ret ;
2949- struct btrfs_path * path ;
2943+ BTRFS_PATH_AUTO_FREE ( path ) ;
29502944 struct btrfs_root * root = device -> fs_info -> chunk_root ;
29512945 struct btrfs_dev_item * dev_item ;
29522946 struct extent_buffer * leaf ;
@@ -2982,7 +2976,6 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
29822976 btrfs_set_device_bytes_used (leaf , dev_item ,
29832977 btrfs_device_get_bytes_used (device ));
29842978out :
2985- btrfs_free_path (path );
29862979 return ret ;
29872980}
29882981
@@ -3035,7 +3028,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset)
30353028 struct btrfs_fs_info * fs_info = trans -> fs_info ;
30363029 struct btrfs_root * root = fs_info -> chunk_root ;
30373030 int ret ;
3038- struct btrfs_path * path ;
3031+ BTRFS_PATH_AUTO_FREE ( path ) ;
30393032 struct btrfs_key key ;
30403033
30413034 path = btrfs_alloc_path ();
@@ -3064,7 +3057,6 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset)
30643057 goto out ;
30653058 }
30663059out :
3067- btrfs_free_path (path );
30683060 return ret ;
30693061}
30703062
@@ -3501,7 +3493,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset,
35013493static int btrfs_relocate_sys_chunks (struct btrfs_fs_info * fs_info )
35023494{
35033495 struct btrfs_root * chunk_root = fs_info -> chunk_root ;
3504- struct btrfs_path * path ;
3496+ BTRFS_PATH_AUTO_FREE ( path ) ;
35053497 struct extent_buffer * leaf ;
35063498 struct btrfs_chunk * chunk ;
35073499 struct btrfs_key key ;
@@ -3580,7 +3572,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info)
35803572 ret = - ENOSPC ;
35813573 }
35823574error :
3583- btrfs_free_path (path );
35843575 return ret ;
35853576}
35863577
@@ -4709,7 +4700,7 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
47094700 struct btrfs_balance_control * bctl ;
47104701 struct btrfs_balance_item * item ;
47114702 struct btrfs_disk_balance_args disk_bargs ;
4712- struct btrfs_path * path ;
4703+ BTRFS_PATH_AUTO_FREE ( path ) ;
47134704 struct extent_buffer * leaf ;
47144705 struct btrfs_key key ;
47154706 int ret ;
@@ -4772,7 +4763,6 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
47724763 spin_unlock (& fs_info -> balance_lock );
47734764 mutex_unlock (& fs_info -> balance_mutex );
47744765out :
4775- btrfs_free_path (path );
47764766 return ret ;
47774767}
47784768
@@ -7450,7 +7440,7 @@ static void readahead_tree_node_children(struct extent_buffer *node)
74507440int btrfs_read_chunk_tree (struct btrfs_fs_info * fs_info )
74517441{
74527442 struct btrfs_root * root = fs_info -> chunk_root ;
7453- struct btrfs_path * path ;
7443+ BTRFS_PATH_AUTO_FREE ( path ) ;
74547444 struct extent_buffer * leaf ;
74557445 struct btrfs_key key ;
74567446 struct btrfs_key found_key ;
@@ -7567,8 +7557,6 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
75677557 ret = 0 ;
75687558error :
75697559 mutex_unlock (& uuid_mutex );
7570-
7571- btrfs_free_path (path );
75727560 return ret ;
75737561}
75747562
@@ -7668,7 +7656,7 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
76687656{
76697657 struct btrfs_fs_devices * fs_devices = fs_info -> fs_devices , * seed_devs ;
76707658 struct btrfs_device * device ;
7671- struct btrfs_path * path = NULL ;
7659+ BTRFS_PATH_AUTO_FREE ( path ) ;
76727660 int ret = 0 ;
76737661
76747662 path = btrfs_alloc_path ();
@@ -7690,8 +7678,6 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
76907678 }
76917679out :
76927680 mutex_unlock (& fs_devices -> device_list_mutex );
7693-
7694- btrfs_free_path (path );
76957681 return ret ;
76967682}
76977683
@@ -7700,7 +7686,7 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
77007686{
77017687 struct btrfs_fs_info * fs_info = trans -> fs_info ;
77027688 struct btrfs_root * dev_root = fs_info -> dev_root ;
7703- struct btrfs_path * path ;
7689+ BTRFS_PATH_AUTO_FREE ( path ) ;
77047690 struct btrfs_key key ;
77057691 struct extent_buffer * eb ;
77067692 struct btrfs_dev_stats_item * ptr ;
@@ -7754,7 +7740,6 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
77547740 btrfs_set_dev_stats_value (eb , ptr , i ,
77557741 btrfs_dev_stat_read (device , i ));
77567742out :
7757- btrfs_free_path (path );
77587743 return ret ;
77597744}
77607745
@@ -8044,7 +8029,7 @@ static int verify_chunk_dev_extent_mapping(struct btrfs_fs_info *fs_info)
80448029 */
80458030int btrfs_verify_dev_extents (struct btrfs_fs_info * fs_info )
80468031{
8047- struct btrfs_path * path ;
8032+ BTRFS_PATH_AUTO_FREE ( path ) ;
80488033 struct btrfs_root * root = fs_info -> dev_root ;
80498034 struct btrfs_key key ;
80508035 u64 prev_devid = 0 ;
@@ -8134,7 +8119,6 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info)
81348119 /* Ensure all chunks have corresponding dev extents */
81358120 ret = verify_chunk_dev_extent_mapping (fs_info );
81368121out :
8137- btrfs_free_path (path );
81388122 return ret ;
81398123}
81408124
0 commit comments