diff options
author | Benjamin Tissoires <bentiss@kernel.org> | 2024-07-16 12:19:28 +0200 |
---|---|---|
committer | Benjamin Tissoires <bentiss@kernel.org> | 2024-07-16 12:19:28 +0200 |
commit | 3c69140734a27f8b145f12fa0ae80c1fe36a02ca (patch) | |
tree | ad36bf7e6a5400212fbf917eceb4c7ad4df5d557 /fs/btrfs/tree-log.c | |
parent | 5ba28be6be8ac6cd4fa1ac67cd4da237d39917d2 (diff) | |
parent | 8a25418ba65a5d2494b369f6178a284c449bc399 (diff) |
Merge branch 'for-6.11/trivial' into for-linus
Couple of trivial fixes:
- extra semicolon (Chen Ni)
- typo (Thorsten Blum)
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 5146387b416b..26a2e5aa08e9 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -4860,18 +4860,23 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, path->slots[0]++; continue; } - if (!dropped_extents) { - /* - * Avoid logging extent items logged in past fsync calls - * and leading to duplicate keys in the log tree. - */ + /* + * Avoid overlapping items in the log tree. The first time we + * get here, get rid of everything from a past fsync. After + * that, if the current extent starts before the end of the last + * extent we copied, truncate the last one. This can happen if + * an ordered extent completion modifies the subvolume tree + * while btrfs_next_leaf() has the tree unlocked. + */ + if (!dropped_extents || key.offset < truncate_offset) { ret = truncate_inode_items(trans, root->log_root, inode, - truncate_offset, + min(key.offset, truncate_offset), BTRFS_EXTENT_DATA_KEY); if (ret) goto out; dropped_extents = true; } + truncate_offset = btrfs_file_extent_end(path); if (ins_nr == 0) start_slot = slot; ins_nr++; |