aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-24 09:41:53 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit89642229a582a5c2b6d2ed8ec16986387d9a9047 (patch)
tree6ece7a9b7d92159096229e27b4862c3685f198f6 /fs/btrfs/extent_io.c
parent9ba4611a3a7902c6bad70c5c205de5161fcfc17b (diff)
Btrfs: Search data ordered extents first for checksums on read
Checksum items are not inserted into the tree until all of the io from a given extent is complete. This means one dirty page from an extent may be written, freed, and then read again before the entire extent is on disk and the checksum item is inserted. The checksums themselves are stored in the ordered extent so they can be inserted in bulk when IO is complete. On read, if a checksum item isn't found, the ordered extents were being searched for a checksum record. This all worked most of the time, but the checksum insertion code tries to reduce the number of tree operations by pre-inserting checksum items based on i_size and a few other factors. This means the read code might find a checksum item that hasn't yet really been filled in. This commit changes things to check the ordered extents first and only dive into the btree if nothing was found. This removes the need for extra locking and is more reliable. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9965993748d0..e3547a992d5c 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1949,18 +1949,18 @@ printk("2bad mapping end %Lu cur %Lu\n", end, cur);
1949 cur + iosize - 1); 1949 cur + iosize - 1);
1950 } 1950 }
1951 if (!ret) { 1951 if (!ret) {
1952 unsigned long nr = (last_byte >> PAGE_CACHE_SHIFT) + 1; 1952 unsigned long pnr = (last_byte >> PAGE_CACHE_SHIFT) + 1;
1953 nr -= page->index; 1953 pnr -= page->index;
1954 ret = submit_extent_page(READ, tree, page, 1954 ret = submit_extent_page(READ, tree, page,
1955 sector, iosize, page_offset, 1955 sector, iosize, page_offset,
1956 bdev, bio, nr, 1956 bdev, bio, pnr,
1957 end_bio_extent_readpage, mirror_num); 1957 end_bio_extent_readpage, mirror_num);
1958 nr++;
1958 } 1959 }
1959 if (ret) 1960 if (ret)
1960 SetPageError(page); 1961 SetPageError(page);
1961 cur = cur + iosize; 1962 cur = cur + iosize;
1962 page_offset += iosize; 1963 page_offset += iosize;
1963 nr++;
1964 } 1964 }
1965 if (!nr) { 1965 if (!nr) {
1966 if (!PageError(page)) 1966 if (!PageError(page))