aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorFilipe Manana <[email protected]>2025-05-29 15:32:37 +0000
committerDavid Sterba <[email protected]>2025-07-21 21:53:29 +0000
commitb32efae7b853585b1453f169fa5a14565b652326 (patch)
tree80037235e04ce6f5d3317cbbb69ef8edabb52ee3 /fs/btrfs/tree-log.c
parentbtrfs: assert we join log transaction at btrfs_del_dir_entries_in_log() (diff)
downloadkernel-b32efae7b853585b1453f169fa5a14565b652326.tar.gz
kernel-b32efae7b853585b1453f169fa5a14565b652326.zip
btrfs: allocate path earlier at btrfs_del_dir_entries_in_log()
Instead of allocating the path after joining the log transaction, allocate it before so that we're not delaying log commits for the rare cases where the allocation takes a significant time (under memory pressure and all slabs are full, there's the need to allocate a new page, etc). Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 58984ca2bfad..c3d7238ba2cb 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3472,27 +3472,27 @@ void btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
return;
}
+ path = btrfs_alloc_path();
+ if (!path) {
+ btrfs_set_log_full_commit(trans);
+ return;
+ }
+
ret = join_running_log_trans(root);
ASSERT(ret == 0, "join_running_log_trans() ret=%d", ret);
if (WARN_ON(ret))
- return;
+ goto out;
mutex_lock(&dir->log_mutex);
- path = btrfs_alloc_path();
- if (!path) {
- ret = -ENOMEM;
- goto out_unlock;
- }
-
ret = del_logged_dentry(trans, root->log_root, path, btrfs_ino(dir),
name, index);
- btrfs_free_path(path);
-out_unlock:
mutex_unlock(&dir->log_mutex);
if (ret < 0)
btrfs_set_log_full_commit(trans);
btrfs_end_log_trans(root);
+out:
+ btrfs_free_path(path);
}
/* see comments for btrfs_del_dir_entries_in_log */