btrfs: allocate scratch eb earlier at btrfs_log_new_name()
authorFilipe Manana <fdmanana@suse.com>
Sun, 1 Jun 2025 14:39:16 +0000 (15:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:53:30 +0000 (23:53 +0200)
commit93612a92bade22c813599388baca1896a0bbc802
tree8ce3e414ae4add6b0c42c5fe557be0cc72850ad2
parent841324a8e60b25b2fa56f93ccc1ef36887593b5a
btrfs: allocate scratch eb earlier at btrfs_log_new_name()

Instead of allocating the scratch eb after joining the log transaction,
allocate it before so that we're not delaying log commits for longer
than necessary, as allocating the scratch eb means allocating an
extent_buffer structure, which comes from a dedicated kmem_cache, plus
pages/folios to attach to the eb. Both of these allocations may take time
when we're under memory pressure.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c