@@ -1681,7 +1681,7 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
1681
1681
struct btrfs_root * root = fs_info -> dev_root ;
1682
1682
struct btrfs_key key ;
1683
1683
struct btrfs_dev_extent * dev_extent ;
1684
- struct btrfs_path * path ;
1684
+ BTRFS_PATH_AUTO_FREE ( path ) ;
1685
1685
u64 search_start ;
1686
1686
u64 hole_size ;
1687
1687
u64 max_hole_start ;
@@ -1812,7 +1812,6 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
1812
1812
"max_hole_start=%llu max_hole_size=%llu search_end=%llu" ,
1813
1813
max_hole_start , max_hole_size , search_end );
1814
1814
out :
1815
- btrfs_free_path (path );
1816
1815
* start = max_hole_start ;
1817
1816
if (len )
1818
1817
* len = max_hole_size ;
@@ -1826,7 +1825,7 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
1826
1825
struct btrfs_fs_info * fs_info = device -> fs_info ;
1827
1826
struct btrfs_root * root = fs_info -> dev_root ;
1828
1827
int ret ;
1829
- struct btrfs_path * path ;
1828
+ BTRFS_PATH_AUTO_FREE ( path ) ;
1830
1829
struct btrfs_key key ;
1831
1830
struct btrfs_key found_key ;
1832
1831
struct extent_buffer * leaf = NULL ;
@@ -1869,7 +1868,6 @@ static int btrfs_free_dev_extent(struct btrfs_trans_handle *trans,
1869
1868
if (ret == 0 )
1870
1869
set_bit (BTRFS_TRANS_HAVE_FREE_BGS , & trans -> transaction -> flags );
1871
1870
out :
1872
- btrfs_free_path (path );
1873
1871
return ret ;
1874
1872
}
1875
1873
@@ -1897,7 +1895,7 @@ static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
1897
1895
int ret ;
1898
1896
struct btrfs_key key ;
1899
1897
struct btrfs_key found_key ;
1900
- struct btrfs_path * path ;
1898
+ BTRFS_PATH_AUTO_FREE ( path ) ;
1901
1899
1902
1900
path = btrfs_alloc_path ();
1903
1901
if (!path )
@@ -1930,7 +1928,6 @@ static noinline int find_next_devid(struct btrfs_fs_info *fs_info,
1930
1928
}
1931
1929
ret = 0 ;
1932
1930
error :
1933
- btrfs_free_path (path );
1934
1931
return ret ;
1935
1932
}
1936
1933
@@ -1942,7 +1939,7 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
1942
1939
struct btrfs_device * device )
1943
1940
{
1944
1941
int ret ;
1945
- struct btrfs_path * path ;
1942
+ BTRFS_PATH_AUTO_FREE ( path ) ;
1946
1943
struct btrfs_dev_item * dev_item ;
1947
1944
struct extent_buffer * leaf ;
1948
1945
struct btrfs_key key ;
@@ -1989,7 +1986,6 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans,
1989
1986
1990
1987
ret = 0 ;
1991
1988
out :
1992
- btrfs_free_path (path );
1993
1989
return ret ;
1994
1990
}
1995
1991
@@ -2017,7 +2013,7 @@ static int btrfs_rm_dev_item(struct btrfs_trans_handle *trans,
2017
2013
{
2018
2014
struct btrfs_root * root = device -> fs_info -> chunk_root ;
2019
2015
int ret ;
2020
- struct btrfs_path * path ;
2016
+ BTRFS_PATH_AUTO_FREE ( path ) ;
2021
2017
struct btrfs_key key ;
2022
2018
2023
2019
path = btrfs_alloc_path ();
@@ -2039,7 +2035,6 @@ static int btrfs_rm_dev_item(struct btrfs_trans_handle *trans,
2039
2035
2040
2036
ret = btrfs_del_item (trans , root , path );
2041
2037
out :
2042
- btrfs_free_path (path );
2043
2038
return ret ;
2044
2039
}
2045
2040
@@ -2626,7 +2621,7 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
2626
2621
BTRFS_DEV_LOOKUP_ARGS (args );
2627
2622
struct btrfs_fs_info * fs_info = trans -> fs_info ;
2628
2623
struct btrfs_root * root = fs_info -> chunk_root ;
2629
- struct btrfs_path * path ;
2624
+ BTRFS_PATH_AUTO_FREE ( path ) ;
2630
2625
struct extent_buffer * leaf ;
2631
2626
struct btrfs_dev_item * dev_item ;
2632
2627
struct btrfs_device * device ;
@@ -2690,7 +2685,6 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
2690
2685
}
2691
2686
ret = 0 ;
2692
2687
error :
2693
- btrfs_free_path (path );
2694
2688
return ret ;
2695
2689
}
2696
2690
@@ -2946,7 +2940,7 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
2946
2940
struct btrfs_device * device )
2947
2941
{
2948
2942
int ret ;
2949
- struct btrfs_path * path ;
2943
+ BTRFS_PATH_AUTO_FREE ( path ) ;
2950
2944
struct btrfs_root * root = device -> fs_info -> chunk_root ;
2951
2945
struct btrfs_dev_item * dev_item ;
2952
2946
struct extent_buffer * leaf ;
@@ -2982,7 +2976,6 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
2982
2976
btrfs_set_device_bytes_used (leaf , dev_item ,
2983
2977
btrfs_device_get_bytes_used (device ));
2984
2978
out :
2985
- btrfs_free_path (path );
2986
2979
return ret ;
2987
2980
}
2988
2981
@@ -3035,7 +3028,7 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset)
3035
3028
struct btrfs_fs_info * fs_info = trans -> fs_info ;
3036
3029
struct btrfs_root * root = fs_info -> chunk_root ;
3037
3030
int ret ;
3038
- struct btrfs_path * path ;
3031
+ BTRFS_PATH_AUTO_FREE ( path ) ;
3039
3032
struct btrfs_key key ;
3040
3033
3041
3034
path = btrfs_alloc_path ();
@@ -3064,7 +3057,6 @@ static int btrfs_free_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset)
3064
3057
goto out ;
3065
3058
}
3066
3059
out :
3067
- btrfs_free_path (path );
3068
3060
return ret ;
3069
3061
}
3070
3062
@@ -3501,7 +3493,7 @@ int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset,
3501
3493
static int btrfs_relocate_sys_chunks (struct btrfs_fs_info * fs_info )
3502
3494
{
3503
3495
struct btrfs_root * chunk_root = fs_info -> chunk_root ;
3504
- struct btrfs_path * path ;
3496
+ BTRFS_PATH_AUTO_FREE ( path ) ;
3505
3497
struct extent_buffer * leaf ;
3506
3498
struct btrfs_chunk * chunk ;
3507
3499
struct btrfs_key key ;
@@ -3580,7 +3572,6 @@ static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info)
3580
3572
ret = - ENOSPC ;
3581
3573
}
3582
3574
error :
3583
- btrfs_free_path (path );
3584
3575
return ret ;
3585
3576
}
3586
3577
@@ -4709,7 +4700,7 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
4709
4700
struct btrfs_balance_control * bctl ;
4710
4701
struct btrfs_balance_item * item ;
4711
4702
struct btrfs_disk_balance_args disk_bargs ;
4712
- struct btrfs_path * path ;
4703
+ BTRFS_PATH_AUTO_FREE ( path ) ;
4713
4704
struct extent_buffer * leaf ;
4714
4705
struct btrfs_key key ;
4715
4706
int ret ;
@@ -4772,7 +4763,6 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
4772
4763
spin_unlock (& fs_info -> balance_lock );
4773
4764
mutex_unlock (& fs_info -> balance_mutex );
4774
4765
out :
4775
- btrfs_free_path (path );
4776
4766
return ret ;
4777
4767
}
4778
4768
@@ -7450,7 +7440,7 @@ static void readahead_tree_node_children(struct extent_buffer *node)
7450
7440
int btrfs_read_chunk_tree (struct btrfs_fs_info * fs_info )
7451
7441
{
7452
7442
struct btrfs_root * root = fs_info -> chunk_root ;
7453
- struct btrfs_path * path ;
7443
+ BTRFS_PATH_AUTO_FREE ( path ) ;
7454
7444
struct extent_buffer * leaf ;
7455
7445
struct btrfs_key key ;
7456
7446
struct btrfs_key found_key ;
@@ -7567,8 +7557,6 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
7567
7557
ret = 0 ;
7568
7558
error :
7569
7559
mutex_unlock (& uuid_mutex );
7570
-
7571
- btrfs_free_path (path );
7572
7560
return ret ;
7573
7561
}
7574
7562
@@ -7668,7 +7656,7 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
7668
7656
{
7669
7657
struct btrfs_fs_devices * fs_devices = fs_info -> fs_devices , * seed_devs ;
7670
7658
struct btrfs_device * device ;
7671
- struct btrfs_path * path = NULL ;
7659
+ BTRFS_PATH_AUTO_FREE ( path ) ;
7672
7660
int ret = 0 ;
7673
7661
7674
7662
path = btrfs_alloc_path ();
@@ -7690,8 +7678,6 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
7690
7678
}
7691
7679
out :
7692
7680
mutex_unlock (& fs_devices -> device_list_mutex );
7693
-
7694
- btrfs_free_path (path );
7695
7681
return ret ;
7696
7682
}
7697
7683
@@ -7700,7 +7686,7 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
7700
7686
{
7701
7687
struct btrfs_fs_info * fs_info = trans -> fs_info ;
7702
7688
struct btrfs_root * dev_root = fs_info -> dev_root ;
7703
- struct btrfs_path * path ;
7689
+ BTRFS_PATH_AUTO_FREE ( path ) ;
7704
7690
struct btrfs_key key ;
7705
7691
struct extent_buffer * eb ;
7706
7692
struct btrfs_dev_stats_item * ptr ;
@@ -7754,7 +7740,6 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
7754
7740
btrfs_set_dev_stats_value (eb , ptr , i ,
7755
7741
btrfs_dev_stat_read (device , i ));
7756
7742
out :
7757
- btrfs_free_path (path );
7758
7743
return ret ;
7759
7744
}
7760
7745
@@ -8044,7 +8029,7 @@ static int verify_chunk_dev_extent_mapping(struct btrfs_fs_info *fs_info)
8044
8029
*/
8045
8030
int btrfs_verify_dev_extents (struct btrfs_fs_info * fs_info )
8046
8031
{
8047
- struct btrfs_path * path ;
8032
+ BTRFS_PATH_AUTO_FREE ( path ) ;
8048
8033
struct btrfs_root * root = fs_info -> dev_root ;
8049
8034
struct btrfs_key key ;
8050
8035
u64 prev_devid = 0 ;
@@ -8134,7 +8119,6 @@ int btrfs_verify_dev_extents(struct btrfs_fs_info *fs_info)
8134
8119
/* Ensure all chunks have corresponding dev extents */
8135
8120
ret = verify_chunk_dev_extent_mapping (fs_info );
8136
8121
out :
8137
- btrfs_free_path (path );
8138
8122
return ret ;
8139
8123
}
8140
8124
0 commit comments