block: add a bi_error field to struct bio
[linux-2.6-block.git] / fs / btrfs / compression.c
index ce62324c78e7dbc734a2793c39a89de38238e27b..302266ec2cdb114ba89ce4a9dd1af0fe22677ba7 100644 (file)
@@ -152,7 +152,7 @@ fail:
  * The compressed pages are freed here, and it must be run
  * in process context
  */
-static void end_compressed_bio_read(struct bio *bio, int err)
+static void end_compressed_bio_read(struct bio *bio)
 {
        struct compressed_bio *cb = bio->bi_private;
        struct inode *inode;
@@ -160,7 +160,7 @@ static void end_compressed_bio_read(struct bio *bio, int err)
        unsigned long index;
        int ret;
 
-       if (err)
+       if (bio->bi_error)
                cb->errors = 1;
 
        /* if there are more bios still pending for this compressed
@@ -210,7 +210,7 @@ csum_failed:
                bio_for_each_segment_all(bvec, cb->orig_bio, i)
                        SetPageChecked(bvec->bv_page);
 
-               bio_endio(cb->orig_bio, 0);
+               bio_endio(cb->orig_bio);
        }
 
        /* finally free the cb struct */
@@ -266,7 +266,7 @@ static noinline void end_compressed_writeback(struct inode *inode,
  * This also calls the writeback end hooks for the file pages so that
  * metadata and checksums can be updated in the file.
  */
-static void end_compressed_bio_write(struct bio *bio, int err)
+static void end_compressed_bio_write(struct bio *bio)
 {
        struct extent_io_tree *tree;
        struct compressed_bio *cb = bio->bi_private;
@@ -274,7 +274,7 @@ static void end_compressed_bio_write(struct bio *bio, int err)
        struct page *page;
        unsigned long index;
 
-       if (err)
+       if (bio->bi_error)
                cb->errors = 1;
 
        /* if there are more bios still pending for this compressed
@@ -293,7 +293,7 @@ static void end_compressed_bio_write(struct bio *bio, int err)
                                         cb->start,
                                         cb->start + cb->len - 1,
                                         NULL,
-                                        err ? 0 : 1);
+                                        bio->bi_error ? 0 : 1);
        cb->compressed_pages[0]->mapping = NULL;
 
        end_compressed_writeback(inode, cb);
@@ -697,8 +697,10 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
 
                        ret = btrfs_map_bio(root, READ, comp_bio,
                                            mirror_num, 0);
-                       if (ret)
-                               bio_endio(comp_bio, ret);
+                       if (ret) {
+                               bio->bi_error = ret;
+                               bio_endio(comp_bio);
+                       }
 
                        bio_put(comp_bio);
 
@@ -724,8 +726,10 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
        }
 
        ret = btrfs_map_bio(root, READ, comp_bio, mirror_num, 0);
-       if (ret)
-               bio_endio(comp_bio, ret);
+       if (ret) {
+               bio->bi_error = ret;
+               bio_endio(comp_bio);
+       }
 
        bio_put(comp_bio);
        return 0;