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>
unsigned int max_sectors)
{
int retried_segments = 0;
- unsigned int bi_phys_segments_orig;
struct bio_vec *bvec;
/*
bvec->bv_len = len;
bvec->bv_offset = offset;
bio->bi_vcnt++;
- bi_phys_segments_orig = bio->bi_phys_segments;
bio->bi_phys_segments++;
/*
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;
}