diff options
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index e07f3376b7df..a5ce99a6c936 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -4396,6 +4396,23 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, | |||
4396 | logged_end = end; | 4396 | logged_end = end; |
4397 | 4397 | ||
4398 | list_for_each_entry_safe(em, n, &tree->modified_extents, list) { | 4398 | list_for_each_entry_safe(em, n, &tree->modified_extents, list) { |
4399 | /* | ||
4400 | * Skip extents outside our logging range. It's important to do | ||
4401 | * it for correctness because if we don't ignore them, we may | ||
4402 | * log them before their ordered extent completes, and therefore | ||
4403 | * we could log them without logging their respective checksums | ||
4404 | * (the checksum items are added to the csum tree at the very | ||
4405 | * end of btrfs_finish_ordered_io()). Also leave such extents | ||
4406 | * outside of our range in the list, since we may have another | ||
4407 | * ranged fsync in the near future that needs them. If an extent | ||
4408 | * outside our range corresponds to a hole, log it to avoid | ||
4409 | * leaving gaps between extents (fsck will complain when we are | ||
4410 | * not using the NO_HOLES feature). | ||
4411 | */ | ||
4412 | if ((em->start > end || em->start + em->len <= start) && | ||
4413 | em->block_start != EXTENT_MAP_HOLE) | ||
4414 | continue; | ||
4415 | |||
4399 | list_del_init(&em->list); | 4416 | list_del_init(&em->list); |
4400 | /* | 4417 | /* |
4401 | * Just an arbitrary number, this can be really CPU intensive | 4418 | * Just an arbitrary number, this can be really CPU intensive |