summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2014-05-22 10:54:44 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-05-22 20:13:09 +1000
commit7d02766c915ae673650c90f7cedcc61c25d19cc5 (patch)
tree4333323f9bb0b2d21342ecede6a312fa1b262ef6
parent2110b242ba39d0342f08f5134663ecb2f105205b (diff)
bio-modify-__bio_add_page-to-accept-pages-that-dont-start-a-new-segment-v3
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>
-rw-r--r--block/bio.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/block/bio.c b/block/bio.c
index 12892e644fde..0443694ccbb4 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -701,7 +701,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;
/*
@@ -761,7 +760,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++;
/*
@@ -812,8 +810,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;
}