Btrfs: Make sure bio pages are adjacent during bulk csumming
authorChris Mason <chris.mason@oracle.com>
Wed, 20 Feb 2008 20:44:32 +0000 (15:44 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:00 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/file-item.c

index ee25e50e7c0400072fb7e411de98244298b13db0..e17cce33fe95873f01157943b5a416325dd64b94 100644 (file)
@@ -161,7 +161,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
        unsigned long map_len;
        unsigned long map_start;
 
-
        path = btrfs_alloc_path();
        BUG_ON(!path);
 again:
@@ -315,8 +314,11 @@ next_bvec:
        if (bio_index < bio->bi_vcnt) {
                item = (struct btrfs_csum_item *)((char *)item +
                                                  BTRFS_CRC32_SIZE);
-               if (item < item_end)
+               if (item < item_end && offset + PAGE_CACHE_SIZE ==
+                   page_offset(bvec->bv_page)) {
+                       offset = page_offset(bvec->bv_page);
                        goto next_bvec;
+               }
        }
        if (eb_token) {
                unmap_extent_buffer(leaf, eb_token, KM_IRQ1);