Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200550
| From | Wanpeng Li <wanpeng.li@hotmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] block: fix update first/last mergeable segment sizes |
| Date | 2015-08-05 11:00 +0200 |
| Message-ID | <pU2Ik-4Ky-29@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
To keep track of the max segment size, the sizes of the first and last
mergeable segments in the bio are accounted, prev->bio->bi_seg_front_size
and next->biotail->bi_seg_back_size will be updated if blk_phys_contig_segment
is true, however, there are still some scenarios such like nonconsistent
blk integrity which leads to merge fail, in addtion, futher merge fail is
incurred due to bio->bi_seg_back_size + next->bi_seg_front_size >
queue_max_segment_size(q) check in function blk_phys_contig_segment(). This
patch fix it by updating first/last mergeable segments size iff all the
conditions of merging are meet.
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
block/blk-merge.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 30a0d9f..7e7bda4 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -367,6 +367,7 @@ static int req_gap_to_prev(struct request *req, struct request *next)
static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
struct request *next)
{
+ bool update_segment_size = false;
int total_phys_segments;
unsigned int seg_size =
req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size;
@@ -391,10 +392,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
- if (req->nr_phys_segments == 1)
- req->bio->bi_seg_front_size = seg_size;
- if (next->nr_phys_segments == 1)
- next->biotail->bi_seg_back_size = seg_size;
+ update_segment_size = true;
total_phys_segments--;
}
@@ -405,6 +403,12 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
return 0;
/* Merge is OK... */
+ if (update_segment_size) {
+ if (req->nr_phys_segments == 1)
+ req->bio->bi_seg_front_size = seg_size;
+ if (next->nr_phys_segments == 1)
+ next->biotail->bi_seg_back_size = seg_size;
+ }
req->nr_phys_segments = total_phys_segments;
return 1;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] block: fix update first/last mergeable segment sizes Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-05 11:00 +0200 Re: [PATCH] block: fix update first/last mergeable segment sizes Jeff Moyer <jmoyer@redhat.com> - 2015-08-07 18:00 +0200
csiph-web