@@ -287,7 +287,7 @@ static int btrfs_get_dev_zones(struct btrfs_device *device, u64 pos,
287
287
/* The emulated zone size is determined from the size of device extent */
288
288
static int calculate_emulated_zone_size (struct btrfs_fs_info * fs_info )
289
289
{
290
- struct btrfs_path * path ;
290
+ BTRFS_PATH_AUTO_FREE ( path ) ;
291
291
struct btrfs_root * root = fs_info -> dev_root ;
292
292
struct btrfs_key key ;
293
293
struct extent_buffer * leaf ;
@@ -304,28 +304,21 @@ static int calculate_emulated_zone_size(struct btrfs_fs_info *fs_info)
304
304
305
305
ret = btrfs_search_slot (NULL , root , & key , path , 0 , 0 );
306
306
if (ret < 0 )
307
- goto out ;
307
+ return ret ;
308
308
309
309
if (path -> slots [0 ] >= btrfs_header_nritems (path -> nodes [0 ])) {
310
310
ret = btrfs_next_leaf (root , path );
311
311
if (ret < 0 )
312
- goto out ;
312
+ return ret ;
313
313
/* No dev extents at all? Not good */
314
- if (ret > 0 ) {
315
- ret = - EUCLEAN ;
316
- goto out ;
317
- }
314
+ if (ret > 0 )
315
+ return - EUCLEAN ;
318
316
}
319
317
320
318
leaf = path -> nodes [0 ];
321
319
dext = btrfs_item_ptr (leaf , path -> slots [0 ], struct btrfs_dev_extent );
322
320
fs_info -> zone_size = btrfs_dev_extent_length (leaf , dext );
323
- ret = 0 ;
324
-
325
- out :
326
- btrfs_free_path (path );
327
-
328
- return ret ;
321
+ return 0 ;
329
322
}
330
323
331
324
int btrfs_get_dev_zone_info_all_devices (struct btrfs_fs_info * fs_info )
@@ -1211,7 +1204,7 @@ static int calculate_alloc_pointer(struct btrfs_block_group *cache,
1211
1204
{
1212
1205
struct btrfs_fs_info * fs_info = cache -> fs_info ;
1213
1206
struct btrfs_root * root ;
1214
- struct btrfs_path * path ;
1207
+ BTRFS_PATH_AUTO_FREE ( path ) ;
1215
1208
struct btrfs_key key ;
1216
1209
struct btrfs_key found_key ;
1217
1210
int ret ;
@@ -1246,15 +1239,15 @@ static int calculate_alloc_pointer(struct btrfs_block_group *cache,
1246
1239
if (!ret )
1247
1240
ret = - EUCLEAN ;
1248
1241
if (ret < 0 )
1249
- goto out ;
1242
+ return ret ;
1250
1243
1251
1244
ret = btrfs_previous_extent_item (root , path , cache -> start );
1252
1245
if (ret ) {
1253
1246
if (ret == 1 ) {
1254
1247
ret = 0 ;
1255
1248
* offset_ret = 0 ;
1256
1249
}
1257
- goto out ;
1250
+ return ret ;
1258
1251
}
1259
1252
1260
1253
btrfs_item_key_to_cpu (path -> nodes [0 ], & found_key , path -> slots [0 ]);
@@ -1266,15 +1259,10 @@ static int calculate_alloc_pointer(struct btrfs_block_group *cache,
1266
1259
1267
1260
if (!(found_key .objectid >= cache -> start &&
1268
1261
found_key .objectid + length <= cache -> start + cache -> length )) {
1269
- ret = - EUCLEAN ;
1270
- goto out ;
1262
+ return - EUCLEAN ;
1271
1263
}
1272
1264
* offset_ret = found_key .objectid + length - cache -> start ;
1273
- ret = 0 ;
1274
-
1275
- out :
1276
- btrfs_free_path (path );
1277
- return ret ;
1265
+ return 0 ;
1278
1266
}
1279
1267
1280
1268
struct zone_info {
0 commit comments