Commit c1a548db authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: free path at can_nocow_extent() before checking for checksum items

When we look for checksum items, through csum_exist_in_range(), at
can_nocow_extent(), we no longer need the path that we have previously
allocated. Through csum_exist_in_range() -> btrfs_lookup_csums_range(),
we also end up allocating a path, so we are adding unnecessary extra
memory usage. So free the path before calling csum_exist_in_range().
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1a89f173
...@@ -7229,6 +7229,14 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, ...@@ -7229,6 +7229,14 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
goto out; goto out;
} }
/*
* We don't need the path anymore, plus through the csum_exist_in_range()
* call below we will end up allocating another path. So free the path
* to avoid unnecessary extra memory usage.
*/
btrfs_free_path(path);
path = NULL;
/* /*
* adjust disk_bytenr and num_bytes to cover just the bytes * adjust disk_bytenr and num_bytes to cover just the bytes
* in this extent we are about to write. If there * in this extent we are about to write. If there
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment