Skip to content

Commit 62701f4

Browse files
fdmananakdave
authored andcommitted
btrfs: remove pointless key offset setup in create_pending_snapshot()
There's no point in setting the key's offset to (u64)-1 since we never use it before setting it to the current transaction's ID. So remove the assignment of (u64)-1 to the key's offset and move the remainder of the key initialization close to where it's used. Reviewed-by: Qu Wenruo <wqu@suse.com> 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 db524fd commit 62701f4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

fs/btrfs/transaction.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,10 +1694,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
16941694
goto clear_skip_qgroup;
16951695
}
16961696

1697-
key.objectid = objectid;
1698-
key.type = BTRFS_ROOT_ITEM_KEY;
1699-
key.offset = (u64)-1;
1700-
17011697
rsv = trans->block_rsv;
17021698
trans->block_rsv = &pending->block_rsv;
17031699
trans->bytes_reserved = trans->block_rsv->reserved;
@@ -1810,6 +1806,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
18101806

18111807
btrfs_set_root_node(new_root_item, tmp);
18121808
/* record when the snapshot was created in key.offset */
1809+
key.objectid = objectid;
1810+
key.type = BTRFS_ROOT_ITEM_KEY;
18131811
key.offset = trans->transid;
18141812
ret = btrfs_insert_root(trans, tree_root, &key, new_root_item);
18151813
btrfs_tree_unlock(tmp);

0 commit comments

Comments
 (0)