@@ -598,7 +598,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans,
598
598
static noinline int remove_extent_data_ref (struct btrfs_trans_handle * trans ,
599
599
struct btrfs_root * root ,
600
600
struct btrfs_path * path ,
601
- int refs_to_drop , int * last_ref )
601
+ int refs_to_drop )
602
602
{
603
603
struct btrfs_key key ;
604
604
struct btrfs_extent_data_ref * ref1 = NULL ;
@@ -631,7 +631,6 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans,
631
631
632
632
if (num_refs == 0 ) {
633
633
ret = btrfs_del_item (trans , root , path );
634
- * last_ref = 1 ;
635
634
} else {
636
635
if (key .type == BTRFS_EXTENT_DATA_REF_KEY )
637
636
btrfs_set_extent_data_ref_count (leaf , ref1 , num_refs );
@@ -1072,8 +1071,7 @@ static noinline_for_stack
1072
1071
void update_inline_extent_backref (struct btrfs_path * path ,
1073
1072
struct btrfs_extent_inline_ref * iref ,
1074
1073
int refs_to_mod ,
1075
- struct btrfs_delayed_extent_op * extent_op ,
1076
- int * last_ref )
1074
+ struct btrfs_delayed_extent_op * extent_op )
1077
1075
{
1078
1076
struct extent_buffer * leaf = path -> nodes [0 ];
1079
1077
struct btrfs_extent_item * ei ;
@@ -1121,7 +1119,6 @@ void update_inline_extent_backref(struct btrfs_path *path,
1121
1119
else
1122
1120
btrfs_set_shared_data_ref_count (leaf , sref , refs );
1123
1121
} else {
1124
- * last_ref = 1 ;
1125
1122
size = btrfs_extent_inline_ref_size (type );
1126
1123
item_size = btrfs_item_size (leaf , path -> slots [0 ]);
1127
1124
ptr = (unsigned long )iref ;
@@ -1166,8 +1163,7 @@ int insert_inline_extent_backref(struct btrfs_trans_handle *trans,
1166
1163
}
1167
1164
return - EUCLEAN ;
1168
1165
}
1169
- update_inline_extent_backref (path , iref , refs_to_add ,
1170
- extent_op , NULL );
1166
+ update_inline_extent_backref (path , iref , refs_to_add , extent_op );
1171
1167
} else if (ret == - ENOENT ) {
1172
1168
setup_inline_extent_backref (trans -> fs_info , path , iref , parent ,
1173
1169
root_objectid , owner , offset ,
@@ -1181,21 +1177,17 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,
1181
1177
struct btrfs_root * root ,
1182
1178
struct btrfs_path * path ,
1183
1179
struct btrfs_extent_inline_ref * iref ,
1184
- int refs_to_drop , int is_data , int * last_ref )
1180
+ int refs_to_drop , int is_data )
1185
1181
{
1186
1182
int ret = 0 ;
1187
1183
1188
1184
BUG_ON (!is_data && refs_to_drop != 1 );
1189
- if (iref ) {
1190
- update_inline_extent_backref (path , iref , - refs_to_drop , NULL ,
1191
- last_ref );
1192
- } else if (is_data ) {
1193
- ret = remove_extent_data_ref (trans , root , path , refs_to_drop ,
1194
- last_ref );
1195
- } else {
1196
- * last_ref = 1 ;
1185
+ if (iref )
1186
+ update_inline_extent_backref (path , iref , - refs_to_drop , NULL );
1187
+ else if (is_data )
1188
+ ret = remove_extent_data_ref (trans , root , path , refs_to_drop );
1189
+ else
1197
1190
ret = btrfs_del_item (trans , root , path );
1198
- }
1199
1191
return ret ;
1200
1192
}
1201
1193
@@ -2942,7 +2934,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
2942
2934
u64 refs ;
2943
2935
u64 bytenr = node -> bytenr ;
2944
2936
u64 num_bytes = node -> num_bytes ;
2945
- int last_ref = 0 ;
2946
2937
bool skinny_metadata = btrfs_fs_incompat (info , SKINNY_METADATA );
2947
2938
2948
2939
extent_root = btrfs_extent_root (info , bytenr );
@@ -3009,8 +3000,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
3009
3000
}
3010
3001
/* Must be SHARED_* item, remove the backref first */
3011
3002
ret = remove_extent_backref (trans , extent_root , path ,
3012
- NULL , refs_to_drop , is_data ,
3013
- & last_ref );
3003
+ NULL , refs_to_drop , is_data );
3014
3004
if (ret ) {
3015
3005
btrfs_abort_transaction (trans , ret );
3016
3006
goto out ;
@@ -3135,8 +3125,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
3135
3125
}
3136
3126
if (found_extent ) {
3137
3127
ret = remove_extent_backref (trans , extent_root , path ,
3138
- iref , refs_to_drop , is_data ,
3139
- & last_ref );
3128
+ iref , refs_to_drop , is_data );
3140
3129
if (ret ) {
3141
3130
btrfs_abort_transaction (trans , ret );
3142
3131
goto out ;
@@ -3181,7 +3170,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
3181
3170
}
3182
3171
}
3183
3172
3184
- last_ref = 1 ;
3185
3173
ret = btrfs_del_items (trans , extent_root , path , path -> slots [0 ],
3186
3174
num_to_del );
3187
3175
if (ret ) {
0 commit comments