diff mbox series

[16/18] btrfs: combine extra if statements in btrfs_truncate_inode_items

Message ID bddeb36f5e7df51bb84904f7311d549a7a6ae201.1638569556.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Truncate cleanups and preparation work | expand

Commit Message

Josef Bacik Dec. 3, 2021, 10:18 p.m. UTC
We have

if (del_item)
	// do something
else
	// something else
if (del_item)
	// do yet another thing
else
	// something else entirely

back to back in btrfs_truncate_inode_items, collapse these two sets of
if statements into one.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/inode-item.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 9c44cf30d930..257a72ec8993 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -650,14 +650,11 @@  int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 			}
 		}
 
-		if (del_item)
-			control->last_size = found_key.offset;
-		else
-			control->last_size = new_size;
 		if (del_item) {
 			ASSERT(!pending_del_nr ||
 			       ((path->slots[0] + 1) == pending_del_slot));
 
+			control->last_size = found_key.offset;
 			if (!pending_del_nr) {
 				/* no pending yet, add ourselves */
 				pending_del_slot = path->slots[0];
@@ -669,6 +666,7 @@  int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 				pending_del_slot = path->slots[0];
 			}
 		} else {
+			control->last_size = new_size;
 			break;
 		}
 		should_throttle = false;