]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bio-modify-__bio_add_page-to-accept-pages-that-dont-start-a-new-segment-v3
authorMaurizio Lombardi <mlombard@redhat.com>
Thu, 22 May 2014 00:54:44 +0000 (10:54 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 10 Jun 2014 06:02:17 +0000 (16:02 +1000)
Changes in V3:

In case of error, V2 restored the previous number of segments but left
the BIO_SEG_FLAG set.
To avoid problems, after the page is removed from the bio vec,
V3 performs a recount of the segments in the error code path.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
block/bio.c

index 88c551acae1664b3f1571c2b656110740c2bd24e..ba479c7e5c2150e490751ae3dd5a03eae6dec682 100644 (file)
@@ -702,7 +702,6 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
                          unsigned int max_sectors)
 {
        int retried_segments = 0;
-       unsigned int bi_phys_segments_orig;
        struct bio_vec *bvec;
 
        /*
@@ -762,7 +761,6 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
        bvec->bv_len = len;
        bvec->bv_offset = offset;
        bio->bi_vcnt++;
-       bi_phys_segments_orig = bio->bi_phys_segments;
        bio->bi_phys_segments++;
 
        /*
@@ -813,8 +811,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
        bvec->bv_len = 0;
        bvec->bv_offset = 0;
        bio->bi_vcnt--;
-       bio->bi_phys_segments = bi_phys_segments_orig;
-
+       blk_recount_segments(q, bio);
        return 0;
 }