diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-07-18 06:17:13 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | 3edf7d33f4edb1e4a9bb0a4c0a84d95fb4d22a09 (patch) | |
tree | 8698a6dd1d0d038f1b56f79c92783518d36f2145 /fs/btrfs/ordered-data.h | |
parent | eb84ae039e10f1f80443d846ba1350122bbdc753 (diff) |
Btrfs: Handle data checksumming on bios that span multiple ordered extents
Data checksumming is done right before the bio is sent down the IO stack,
which means a single bio might span more than one ordered extent. In
this case, the checksumming data is split between two ordered extents.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.h')
-rw-r--r-- | fs/btrfs/ordered-data.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index 98f491d1022b..1794efd13ca3 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h | |||
@@ -39,7 +39,11 @@ struct btrfs_sector_sum { | |||
39 | 39 | ||
40 | struct btrfs_ordered_sum { | 40 | struct btrfs_ordered_sum { |
41 | u64 file_offset; | 41 | u64 file_offset; |
42 | u64 len; | 42 | /* |
43 | * this is the length in bytes covered by the sums array below. | ||
44 | * But, the sums array may not be contiguous in the file. | ||
45 | */ | ||
46 | unsigned long len; | ||
43 | struct list_head list; | 47 | struct list_head list; |
44 | /* last field is a variable length array of btrfs_sector_sums */ | 48 | /* last field is a variable length array of btrfs_sector_sums */ |
45 | struct btrfs_sector_sum sums; | 49 | struct btrfs_sector_sum sums; |
@@ -95,6 +99,7 @@ static inline int btrfs_ordered_sum_size(struct btrfs_root *root, u64 bytes) | |||
95 | { | 99 | { |
96 | unsigned long num_sectors = (bytes + root->sectorsize - 1) / | 100 | unsigned long num_sectors = (bytes + root->sectorsize - 1) / |
97 | root->sectorsize; | 101 | root->sectorsize; |
102 | num_sectors++; | ||
98 | return sizeof(struct btrfs_ordered_sum) + | 103 | return sizeof(struct btrfs_ordered_sum) + |
99 | num_sectors * sizeof(struct btrfs_sector_sum); | 104 | num_sectors * sizeof(struct btrfs_sector_sum); |
100 | } | 105 | } |
@@ -114,7 +119,9 @@ int btrfs_dec_test_ordered_pending(struct inode *inode, | |||
114 | u64 file_offset, u64 io_size); | 119 | u64 file_offset, u64 io_size); |
115 | int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, | 120 | int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, |
116 | u64 start, u64 len); | 121 | u64 start, u64 len); |
117 | int btrfs_add_ordered_sum(struct inode *inode, struct btrfs_ordered_sum *sum); | 122 | int btrfs_add_ordered_sum(struct inode *inode, |
123 | struct btrfs_ordered_extent *entry, | ||
124 | struct btrfs_ordered_sum *sum); | ||
118 | struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct inode *inode, | 125 | struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct inode *inode, |
119 | u64 file_offset); | 126 | u64 file_offset); |
120 | void btrfs_start_ordered_extent(struct inode *inode, | 127 | void btrfs_start_ordered_extent(struct inode *inode, |