Commit 0adbc619 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: combine extra if statements in btrfs_truncate_inode_items



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.

Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 376b91d5
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -646,14 +646,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];
@@ -665,6 +662,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;