summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2026-08-25 12:04:20 -0400
committerDavid Sterba <dsterba@suse.com>2026-10-12 19:16:20 +0200
commit1c9fdf06d7c2ab67ea3b9e88ddcc1c3150d5f10c (patch)
treeb1cb8a6a08cb8c8b3cf6c9436225d357ca487de6 /tools/perf/scripts/python/stackcollapse.py
parent83fc65e09088b62a424ce13d8162f451a1415457 (diff)
downloadlinux-1c9fdf06d7c2ab67ea3b9e88ddcc1c3150d5f10c.tar.gz
linux-1c9fdf06d7c2ab67ea3b9e88ddcc1c3150d5f10c.zip
btrfs: pre-allocate delayed dir index for non-overwrite rename
For rename() without an overwrite target, pre-allocate the delayed dir index before any btree modifications so that ENOMEM can be returned before the source is unlinked from the old directory. Add a prealloc parameter to btrfs_add_link() that allows callers to pass pre-allocated delayed dir index resources. When provided, btrfs_add_link() takes ownership: it either passes the prealloc to btrfs_insert_dir_item() (which commits or frees it), or frees it on early error. All existing callers pass NULL to preserve the current behavior. In btrfs_rename(), when new_inode is NULL (no overwrite), call btrfs_prealloc_delayed_dir_index() before the first btree modification and pass the result through to btrfs_add_link(). If the prealloc fails, -ENOMEM is returned before any btree state has changed. The local prealloc pointer is cleared once ownership passes to btrfs_add_link(), so the out_fail path only frees one we still own. For overwrite rename (new_inode != NULL), the transaction still aborts on ENOMEM since earlier unlink operations have already made irreversible btree modifications. Assisted-by: LLM Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions