diff options
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 323e12cc9d2f..978c3a810893 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -4127,7 +4127,9 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, | |||
4127 | struct inode *inode, | 4127 | struct inode *inode, |
4128 | struct btrfs_path *path, | 4128 | struct btrfs_path *path, |
4129 | struct list_head *logged_list, | 4129 | struct list_head *logged_list, |
4130 | struct btrfs_log_ctx *ctx) | 4130 | struct btrfs_log_ctx *ctx, |
4131 | const u64 start, | ||
4132 | const u64 end) | ||
4131 | { | 4133 | { |
4132 | struct extent_map *em, *n; | 4134 | struct extent_map *em, *n; |
4133 | struct list_head extents; | 4135 | struct list_head extents; |
@@ -4166,7 +4168,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, | |||
4166 | } | 4168 | } |
4167 | 4169 | ||
4168 | list_sort(NULL, &extents, extent_cmp); | 4170 | list_sort(NULL, &extents, extent_cmp); |
4169 | 4171 | /* | |
4172 | * Collect any new ordered extents within the range. This is to | ||
4173 | * prevent logging file extent items without waiting for the disk | ||
4174 | * location they point to being written. We do this only to deal | ||
4175 | * with races against concurrent lockless direct IO writes. | ||
4176 | */ | ||
4177 | btrfs_get_logged_extents(inode, logged_list, start, end); | ||
4170 | process: | 4178 | process: |
4171 | while (!list_empty(&extents)) { | 4179 | while (!list_empty(&extents)) { |
4172 | em = list_entry(extents.next, struct extent_map, list); | 4180 | em = list_entry(extents.next, struct extent_map, list); |
@@ -4701,7 +4709,7 @@ log_extents: | |||
4701 | goto out_unlock; | 4709 | goto out_unlock; |
4702 | } | 4710 | } |
4703 | ret = btrfs_log_changed_extents(trans, root, inode, dst_path, | 4711 | ret = btrfs_log_changed_extents(trans, root, inode, dst_path, |
4704 | &logged_list, ctx); | 4712 | &logged_list, ctx, start, end); |
4705 | if (ret) { | 4713 | if (ret) { |
4706 | err = ret; | 4714 | err = ret; |
4707 | goto out_unlock; | 4715 | goto out_unlock; |