Skip to content

Commit 2a13cfc

Browse files
fdmananakdave
authored andcommitted
btrfs: use the inode item boolean everywhere in overwrite_item()
We have this boolean 'inode_item' to tell if we are processing an inode item key and we use it in a couple of places while in another two places we open code by checking if the key type matches the inode item type. Make this consistent and use the boolean everywhere. Also rename it from 'inode_item' to 'is_inode_item', which makes it more clear that it's a boolean and not an instance of struct btrfs_inode_item, and make it const too. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 6cb7f0b commit 2a13cfc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/btrfs/tree-log.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static int overwrite_item(struct walk_control *wc,
424424
unsigned long dst_ptr;
425425
struct extent_buffer *dst_eb;
426426
int dst_slot;
427-
bool inode_item = key->type == BTRFS_INODE_ITEM_KEY;
427+
const bool is_inode_item = (key->type == BTRFS_INODE_ITEM_KEY);
428428

429429
/*
430430
* This is only used during log replay, so the root is always from a
@@ -486,7 +486,7 @@ static int overwrite_item(struct walk_control *wc,
486486
* We need to load the old nbytes into the inode so when we
487487
* replay the extents we've logged we get the right nbytes.
488488
*/
489-
if (inode_item) {
489+
if (is_inode_item) {
490490
struct btrfs_inode_item *item;
491491
u64 nbytes;
492492
u32 mode;
@@ -507,7 +507,7 @@ static int overwrite_item(struct walk_control *wc,
507507
if (S_ISDIR(mode))
508508
btrfs_set_inode_size(eb, item, 0);
509509
}
510-
} else if (inode_item) {
510+
} else if (is_inode_item) {
511511
struct btrfs_inode_item *item;
512512
u32 mode;
513513

@@ -561,7 +561,7 @@ static int overwrite_item(struct walk_control *wc,
561561
* state of the tree found in the subvolume, and i_size is modified
562562
* as it goes
563563
*/
564-
if (key->type == BTRFS_INODE_ITEM_KEY && ret == -EEXIST) {
564+
if (is_inode_item && ret == -EEXIST) {
565565
struct btrfs_inode_item *src_item;
566566
struct btrfs_inode_item *dst_item;
567567

@@ -602,7 +602,7 @@ static int overwrite_item(struct walk_control *wc,
602602
}
603603

604604
/* make sure the generation is filled in */
605-
if (key->type == BTRFS_INODE_ITEM_KEY) {
605+
if (is_inode_item) {
606606
struct btrfs_inode_item *dst_item;
607607

608608
dst_item = (struct btrfs_inode_item *)dst_ptr;

0 commit comments

Comments
 (0)