btrfs: stop trying to log subdirectories created in past transactions
When logging a directory we are trying to log subdirectories that were
changed in the current transaction and created in a past transaction.
This type of behaviour was introduced by commit 2f2ff0ee5e
("Btrfs:
fix metadata inconsistencies after directory fsync"), to fix some metadata
inconsistencies that in the meanwhile no longer need this behaviour due to
numerous other changes that happened throughout the years.
This behaviour, besides not needed anymore, it's also undesirable because:
1) It's not reliable because it's only triggered for the directories
of dentries (dir items) that happen to be present on a leaf that
was changed in the current transaction. If a dentry that points to
a directory resides on a leaf that was not changed in the current
transaction, then it's not logged, as at log_dir_items() and
log_new_dir_dentries() we use btrfs_search_forward();
2) It's not required by posix or any standard, it's undefined territory.
The only way to guarantee a subdirectory is logged, it to explicitly
fsync it;
Making the behaviour guaranteed would require scanning all directory
items, check which point to a directory, and then fsync each subdirectory
which was modified in the current transaction. This could be very
expensive for large directories with many subdirectories and/or large
subdirectories.
So remove that obsolete logic.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
732d591a5d
commit
de6bc7f598
|
@ -6012,8 +6012,7 @@ again:
|
|||
|
||||
di = btrfs_item_ptr(leaf, i, struct btrfs_dir_item);
|
||||
type = btrfs_dir_type(leaf, di);
|
||||
if (btrfs_dir_transid(leaf, di) < trans->transid &&
|
||||
type != BTRFS_FT_DIR)
|
||||
if (btrfs_dir_transid(leaf, di) < trans->transid)
|
||||
continue;
|
||||
btrfs_dir_item_key_to_cpu(leaf, di, &di_key);
|
||||
if (di_key.type == BTRFS_ROOT_ITEM_KEY)
|
||||
|
|
Loading…
Reference in New Issue