Skip to content

Commit 2ea8921

Browse files
fdmananakdave
authored andcommitted
btrfs: use saner variable type and name to indicate extrefs at add_inode_ref()
We are using a variable named 'log_ref_ver' of type int to indicate if we are processing an extref item or not, using a value of 1 if so, otherwise 0. This is an odd name and type, so rename it to 'is_extref_item' and change its type to bool. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 83e98b0 commit 2ea8921

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/btrfs/tree-log.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
13851385
unsigned long ref_end;
13861386
struct fscrypt_str name = { 0 };
13871387
int ret;
1388-
int log_ref_ver = 0;
1388+
const bool is_extref_item = (key->type == BTRFS_INODE_EXTREF_KEY);
13891389
u64 parent_objectid;
13901390
u64 inode_objectid;
13911391
u64 ref_index = 0;
@@ -1394,11 +1394,10 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
13941394
ref_ptr = btrfs_item_ptr_offset(eb, slot);
13951395
ref_end = ref_ptr + btrfs_item_size(eb, slot);
13961396

1397-
if (key->type == BTRFS_INODE_EXTREF_KEY) {
1397+
if (is_extref_item) {
13981398
struct btrfs_inode_extref *r;
13991399

14001400
ref_struct_size = sizeof(struct btrfs_inode_extref);
1401-
log_ref_ver = 1;
14021401
r = (struct btrfs_inode_extref *)ref_ptr;
14031402
parent_objectid = btrfs_inode_extref_parent(eb, r);
14041403
} else {
@@ -1430,7 +1429,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
14301429
}
14311430

14321431
while (ref_ptr < ref_end) {
1433-
if (log_ref_ver) {
1432+
if (is_extref_item) {
14341433
ret = extref_get_fields(eb, ref_ptr, &name,
14351434
&ref_index, &parent_objectid);
14361435
if (ret)
@@ -1505,7 +1504,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
15051504
ref_ptr = (unsigned long)(ref_ptr + ref_struct_size) + name.len;
15061505
kfree(name.name);
15071506
name.name = NULL;
1508-
if (log_ref_ver && dir) {
1507+
if (is_extref_item && dir) {
15091508
iput(&dir->vfs_inode);
15101509
dir = NULL;
15111510
}

0 commit comments

Comments
 (0)