Re: [PATCH 2/2] btrfs: zoned: fix compressed writes
From: David Sterba <hidden>
Date: 2021-05-17 11:42:14
On Mon, May 17, 2021 at 11:21:49AM +0000, Johannes Thumshirn wrote:
On 17/05/2021 09:07, Johannes Thumshirn wrote:quoted
quoted
quoted
+ if (use_append) { + struct extent_map *em; + struct map_lookup *map; + + em = btrfs_get_chunk_map(fs_info, disk_start, PAGE_SIZE);The caller already does the em lookup, so this is duplicate, allocating memory, taking locks and doing a tree lookup. All happening on write out path so this seems heavy.Right, I did not check this, sorry. Is it OK to add another patch as preparation swapping some of the parameters to btrfs_submit_compressed_write() from the em? Otherwise btrfs_submit_compressed_write() will have 10 parameters which sounds awefull.Actually I can't do that. The caller does calls create_io_em() while this patch needs to call brtfs_get_chunk_map(). The 'em' returned by create_io_em() does not have em->map_lookup populated and we need the stripe's block device from em->map_lookup. So it looks like we need to live with the additional memory allocation and locks.
Ok then, it's limited to zoned mode so the allocation won't affect regular mode.