diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/compression.c | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_map.h | 1 | ||||
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 7397c622fb6a..8e7a78acf81a 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -505,7 +505,6 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
505 | struct block_device *bdev; | 505 | struct block_device *bdev; |
506 | struct bio *comp_bio; | 506 | struct bio *comp_bio; |
507 | u64 cur_disk_byte = (u64)bio->bi_sector << 9; | 507 | u64 cur_disk_byte = (u64)bio->bi_sector << 9; |
508 | u64 em_len; | ||
509 | struct extent_map *em; | 508 | struct extent_map *em; |
510 | int ret; | 509 | int ret; |
511 | 510 | ||
@@ -524,9 +523,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
524 | cb->errors = 0; | 523 | cb->errors = 0; |
525 | cb->inode = inode; | 524 | cb->inode = inode; |
526 | 525 | ||
527 | cb->start = em->start; | 526 | cb->start = em->orig_start; |
528 | compressed_len = em->block_len; | 527 | compressed_len = em->block_len; |
529 | em_len = em->len; | ||
530 | free_extent_map(em); | 528 | free_extent_map(em); |
531 | 529 | ||
532 | cb->len = uncompressed_len; | 530 | cb->len = uncompressed_len; |
@@ -545,7 +543,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
545 | } | 543 | } |
546 | cb->nr_pages = nr_pages; | 544 | cb->nr_pages = nr_pages; |
547 | 545 | ||
548 | add_ra_bio_pages(inode, cb->start + em_len, cb); | 546 | add_ra_bio_pages(inode, em->start + em->len, cb); |
549 | 547 | ||
550 | if (!btrfs_test_opt(root, NODATASUM) && | 548 | if (!btrfs_test_opt(root, NODATASUM) && |
551 | !btrfs_test_flag(inode, NODATASUM)) { | 549 | !btrfs_test_flag(inode, NODATASUM)) { |
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h index accfedaeb513..fb6eeef06bb0 100644 --- a/fs/btrfs/extent_map.h +++ b/fs/btrfs/extent_map.h | |||
@@ -20,6 +20,7 @@ struct extent_map { | |||
20 | /* all of these are in bytes */ | 20 | /* all of these are in bytes */ |
21 | u64 start; | 21 | u64 start; |
22 | u64 len; | 22 | u64 len; |
23 | u64 orig_start; | ||
23 | u64 block_start; | 24 | u64 block_start; |
24 | u64 block_len; | 25 | u64 block_len; |
25 | unsigned long flags; | 26 | unsigned long flags; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 337221ecca27..85841c538805 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -222,6 +222,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
222 | em->start < start) { | 222 | em->start < start) { |
223 | split->start = em->start; | 223 | split->start = em->start; |
224 | split->len = start - em->start; | 224 | split->len = start - em->start; |
225 | split->orig_start = em->orig_start; | ||
225 | split->block_start = em->block_start; | 226 | split->block_start = em->block_start; |
226 | 227 | ||
227 | if (compressed) | 228 | if (compressed) |
@@ -243,6 +244,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
243 | 244 | ||
244 | split->start = start + len; | 245 | split->start = start + len; |
245 | split->len = em->start + em->len - (start + len); | 246 | split->len = em->start + em->len - (start + len); |
247 | split->orig_start = em->orig_start; | ||
246 | split->bdev = em->bdev; | 248 | split->bdev = em->bdev; |
247 | split->flags = flags; | 249 | split->flags = flags; |
248 | 250 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e01c0d0310ab..59660293d291 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3949,6 +3949,8 @@ again: | |||
3949 | found_type == BTRFS_FILE_EXTENT_PREALLOC) { | 3949 | found_type == BTRFS_FILE_EXTENT_PREALLOC) { |
3950 | em->start = extent_start; | 3950 | em->start = extent_start; |
3951 | em->len = extent_end - extent_start; | 3951 | em->len = extent_end - extent_start; |
3952 | em->orig_start = extent_start - | ||
3953 | btrfs_file_extent_offset(leaf, item); | ||
3952 | bytenr = btrfs_file_extent_disk_bytenr(leaf, item); | 3954 | bytenr = btrfs_file_extent_disk_bytenr(leaf, item); |
3953 | if (bytenr == 0) { | 3955 | if (bytenr == 0) { |
3954 | em->block_start = EXTENT_MAP_HOLE; | 3956 | em->block_start = EXTENT_MAP_HOLE; |
@@ -3988,6 +3990,7 @@ again: | |||
3988 | em->start = extent_start + extent_offset; | 3990 | em->start = extent_start + extent_offset; |
3989 | em->len = (copy_size + root->sectorsize - 1) & | 3991 | em->len = (copy_size + root->sectorsize - 1) & |
3990 | ~((u64)root->sectorsize - 1); | 3992 | ~((u64)root->sectorsize - 1); |
3993 | em->orig_start = EXTENT_MAP_INLINE; | ||
3991 | if (compressed) | 3994 | if (compressed) |
3992 | set_bit(EXTENT_FLAG_COMPRESSED, &em->flags); | 3995 | set_bit(EXTENT_FLAG_COMPRESSED, &em->flags); |
3993 | ptr = btrfs_file_extent_inline_start(item) + extent_offset; | 3996 | ptr = btrfs_file_extent_inline_start(item) + extent_offset; |