mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
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 <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
24e066ded4
commit
3a074cc659
|
|
@ -1385,7 +1385,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
|
|||
unsigned long ref_end;
|
||||
struct fscrypt_str name = { 0 };
|
||||
int ret;
|
||||
int log_ref_ver = 0;
|
||||
const bool is_extref_item = (key->type == BTRFS_INODE_EXTREF_KEY);
|
||||
u64 parent_objectid;
|
||||
u64 inode_objectid;
|
||||
u64 ref_index = 0;
|
||||
|
|
@ -1394,11 +1394,10 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
|
|||
ref_ptr = btrfs_item_ptr_offset(eb, slot);
|
||||
ref_end = ref_ptr + btrfs_item_size(eb, slot);
|
||||
|
||||
if (key->type == BTRFS_INODE_EXTREF_KEY) {
|
||||
if (is_extref_item) {
|
||||
struct btrfs_inode_extref *r;
|
||||
|
||||
ref_struct_size = sizeof(struct btrfs_inode_extref);
|
||||
log_ref_ver = 1;
|
||||
r = (struct btrfs_inode_extref *)ref_ptr;
|
||||
parent_objectid = btrfs_inode_extref_parent(eb, r);
|
||||
} else {
|
||||
|
|
@ -1430,7 +1429,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
|
|||
}
|
||||
|
||||
while (ref_ptr < ref_end) {
|
||||
if (log_ref_ver) {
|
||||
if (is_extref_item) {
|
||||
ret = extref_get_fields(eb, ref_ptr, &name,
|
||||
&ref_index, &parent_objectid);
|
||||
if (ret)
|
||||
|
|
@ -1505,7 +1504,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
|
|||
ref_ptr = (unsigned long)(ref_ptr + ref_struct_size) + name.len;
|
||||
kfree(name.name);
|
||||
name.name = NULL;
|
||||
if (log_ref_ver && dir) {
|
||||
if (is_extref_item && dir) {
|
||||
iput(&dir->vfs_inode);
|
||||
dir = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user