Skip to content

Commit 0bdb1db

Browse files
liewegaschrismason-xx
authored andcommitted
Btrfs: flush data on snapshot creation
Flush any delalloc extents when we create a snapshot, so that recently written file data is always included in the snapshot. A later commit will add the ability to snapshot without the flush, but most people expect flushing. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent bd4d108 commit 0bdb1db

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎fs/btrfs/transaction.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,10 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
997997

998998
mutex_unlock(&root->fs_info->trans_mutex);
999999

1000-
if (flush_on_commit) {
1000+
if (flush_on_commit || snap_pending) {
10011001
btrfs_start_delalloc_inodes(root, 1);
10021002
ret = btrfs_wait_ordered_extents(root, 0, 1);
10031003
BUG_ON(ret);
1004-
} else if (snap_pending) {
1005-
ret = btrfs_wait_ordered_extents(root, 0, 1);
1006-
BUG_ON(ret);
10071004
}
10081005

10091006
/*

0 commit comments

Comments
 (0)