diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2008-08-15 04:20:02 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:03 -0400 |
commit | 5df97b91b5d7ed426034fcc84cb6e7cf682b8838 (patch) | |
tree | 727b9fb778f72d2b1ff44c007fb5209bacf67f4a | |
parent | b8b3e16cfe6435d961f6aaebcfd52a1ff2a988c5 (diff) |
drop vmerge accounting
Remove hw_segments field from struct bio and struct request. Without virtual
merge accounting they have no purpose.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/blk-core.c | 1 | ||||
-rw-r--r-- | block/blk-merge.c | 31 | ||||
-rw-r--r-- | block/elevator.c | 2 | ||||
-rw-r--r-- | drivers/md/raid1.c | 3 | ||||
-rw-r--r-- | drivers/md/raid10.c | 3 | ||||
-rw-r--r-- | fs/bio.c | 12 | ||||
-rw-r--r-- | include/linux/bio.h | 16 | ||||
-rw-r--r-- | include/linux/blkdev.h | 7 |
8 files changed, 6 insertions, 69 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 1261516dd42a..2616cdd049a8 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2026,7 +2026,6 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq, | |||
2026 | 2026 | ||
2027 | if (bio_has_data(bio)) { | 2027 | if (bio_has_data(bio)) { |
2028 | rq->nr_phys_segments = bio_phys_segments(q, bio); | 2028 | rq->nr_phys_segments = bio_phys_segments(q, bio); |
2029 | rq->nr_hw_segments = bio_hw_segments(q, bio); | ||
2030 | rq->buffer = bio_data(bio); | 2029 | rq->buffer = bio_data(bio); |
2031 | } | 2030 | } |
2032 | rq->current_nr_sectors = bio_cur_sectors(bio); | 2031 | rq->current_nr_sectors = bio_cur_sectors(bio); |
diff --git a/block/blk-merge.c b/block/blk-merge.c index 2c2a2ee716ec..d81d91419ff5 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -41,12 +41,9 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect) | |||
41 | void blk_recalc_rq_segments(struct request *rq) | 41 | void blk_recalc_rq_segments(struct request *rq) |
42 | { | 42 | { |
43 | int nr_phys_segs; | 43 | int nr_phys_segs; |
44 | int nr_hw_segs; | ||
45 | unsigned int phys_size; | 44 | unsigned int phys_size; |
46 | unsigned int hw_size; | ||
47 | struct bio_vec *bv, *bvprv = NULL; | 45 | struct bio_vec *bv, *bvprv = NULL; |
48 | int seg_size; | 46 | int seg_size; |
49 | int hw_seg_size; | ||
50 | int cluster; | 47 | int cluster; |
51 | struct req_iterator iter; | 48 | struct req_iterator iter; |
52 | int high, highprv = 1; | 49 | int high, highprv = 1; |
@@ -56,8 +53,8 @@ void blk_recalc_rq_segments(struct request *rq) | |||
56 | return; | 53 | return; |
57 | 54 | ||
58 | cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 55 | cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
59 | hw_seg_size = seg_size = 0; | 56 | seg_size = 0; |
60 | phys_size = hw_size = nr_phys_segs = nr_hw_segs = 0; | 57 | phys_size = nr_phys_segs = 0; |
61 | rq_for_each_segment(bv, rq, iter) { | 58 | rq_for_each_segment(bv, rq, iter) { |
62 | /* | 59 | /* |
63 | * the trick here is making sure that a high page is never | 60 | * the trick here is making sure that a high page is never |
@@ -76,30 +73,17 @@ void blk_recalc_rq_segments(struct request *rq) | |||
76 | goto new_segment; | 73 | goto new_segment; |
77 | 74 | ||
78 | seg_size += bv->bv_len; | 75 | seg_size += bv->bv_len; |
79 | hw_seg_size += bv->bv_len; | ||
80 | bvprv = bv; | 76 | bvprv = bv; |
81 | continue; | 77 | continue; |
82 | } | 78 | } |
83 | new_segment: | 79 | new_segment: |
84 | if (nr_hw_segs == 1 && | ||
85 | hw_seg_size > rq->bio->bi_hw_front_size) | ||
86 | rq->bio->bi_hw_front_size = hw_seg_size; | ||
87 | hw_seg_size = bv->bv_len; | ||
88 | nr_hw_segs++; | ||
89 | |||
90 | nr_phys_segs++; | 80 | nr_phys_segs++; |
91 | bvprv = bv; | 81 | bvprv = bv; |
92 | seg_size = bv->bv_len; | 82 | seg_size = bv->bv_len; |
93 | highprv = high; | 83 | highprv = high; |
94 | } | 84 | } |
95 | 85 | ||
96 | if (nr_hw_segs == 1 && | ||
97 | hw_seg_size > rq->bio->bi_hw_front_size) | ||
98 | rq->bio->bi_hw_front_size = hw_seg_size; | ||
99 | if (hw_seg_size > rq->biotail->bi_hw_back_size) | ||
100 | rq->biotail->bi_hw_back_size = hw_seg_size; | ||
101 | rq->nr_phys_segments = nr_phys_segs; | 86 | rq->nr_phys_segments = nr_phys_segs; |
102 | rq->nr_hw_segments = nr_hw_segs; | ||
103 | } | 87 | } |
104 | 88 | ||
105 | void blk_recount_segments(struct request_queue *q, struct bio *bio) | 89 | void blk_recount_segments(struct request_queue *q, struct bio *bio) |
@@ -112,7 +96,6 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio) | |||
112 | blk_recalc_rq_segments(&rq); | 96 | blk_recalc_rq_segments(&rq); |
113 | bio->bi_next = nxt; | 97 | bio->bi_next = nxt; |
114 | bio->bi_phys_segments = rq.nr_phys_segments; | 98 | bio->bi_phys_segments = rq.nr_phys_segments; |
115 | bio->bi_hw_segments = rq.nr_hw_segments; | ||
116 | bio->bi_flags |= (1 << BIO_SEG_VALID); | 99 | bio->bi_flags |= (1 << BIO_SEG_VALID); |
117 | } | 100 | } |
118 | EXPORT_SYMBOL(blk_recount_segments); | 101 | EXPORT_SYMBOL(blk_recount_segments); |
@@ -255,10 +238,9 @@ static inline int ll_new_hw_segment(struct request_queue *q, | |||
255 | struct request *req, | 238 | struct request *req, |
256 | struct bio *bio) | 239 | struct bio *bio) |
257 | { | 240 | { |
258 | int nr_hw_segs = bio_hw_segments(q, bio); | ||
259 | int nr_phys_segs = bio_phys_segments(q, bio); | 241 | int nr_phys_segs = bio_phys_segments(q, bio); |
260 | 242 | ||
261 | if (req->nr_hw_segments + nr_hw_segs > q->max_hw_segments | 243 | if (req->nr_phys_segments + nr_phys_segs > q->max_hw_segments |
262 | || req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) { | 244 | || req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) { |
263 | req->cmd_flags |= REQ_NOMERGE; | 245 | req->cmd_flags |= REQ_NOMERGE; |
264 | if (req == q->last_merge) | 246 | if (req == q->last_merge) |
@@ -270,7 +252,6 @@ static inline int ll_new_hw_segment(struct request_queue *q, | |||
270 | * This will form the start of a new hw segment. Bump both | 252 | * This will form the start of a new hw segment. Bump both |
271 | * counters. | 253 | * counters. |
272 | */ | 254 | */ |
273 | req->nr_hw_segments += nr_hw_segs; | ||
274 | req->nr_phys_segments += nr_phys_segs; | 255 | req->nr_phys_segments += nr_phys_segs; |
275 | return 1; | 256 | return 1; |
276 | } | 257 | } |
@@ -328,7 +309,6 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | |||
328 | struct request *next) | 309 | struct request *next) |
329 | { | 310 | { |
330 | int total_phys_segments; | 311 | int total_phys_segments; |
331 | int total_hw_segments; | ||
332 | 312 | ||
333 | /* | 313 | /* |
334 | * First check if the either of the requests are re-queued | 314 | * First check if the either of the requests are re-queued |
@@ -350,14 +330,11 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, | |||
350 | if (total_phys_segments > q->max_phys_segments) | 330 | if (total_phys_segments > q->max_phys_segments) |
351 | return 0; | 331 | return 0; |
352 | 332 | ||
353 | total_hw_segments = req->nr_hw_segments + next->nr_hw_segments; | 333 | if (total_phys_segments > q->max_hw_segments) |
354 | |||
355 | if (total_hw_segments > q->max_hw_segments) | ||
356 | return 0; | 334 | return 0; |
357 | 335 | ||
358 | /* Merge is OK... */ | 336 | /* Merge is OK... */ |
359 | req->nr_phys_segments = total_phys_segments; | 337 | req->nr_phys_segments = total_phys_segments; |
360 | req->nr_hw_segments = total_hw_segments; | ||
361 | return 1; | 338 | return 1; |
362 | } | 339 | } |
363 | 340 | ||
diff --git a/block/elevator.c b/block/elevator.c index 4f5127054e3f..269615e6dbf5 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -790,7 +790,6 @@ struct request *elv_next_request(struct request_queue *q) | |||
790 | * device can handle | 790 | * device can handle |
791 | */ | 791 | */ |
792 | rq->nr_phys_segments++; | 792 | rq->nr_phys_segments++; |
793 | rq->nr_hw_segments++; | ||
794 | } | 793 | } |
795 | 794 | ||
796 | if (!q->prep_rq_fn) | 795 | if (!q->prep_rq_fn) |
@@ -813,7 +812,6 @@ struct request *elv_next_request(struct request_queue *q) | |||
813 | * so that we don't add it again | 812 | * so that we don't add it again |
814 | */ | 813 | */ |
815 | --rq->nr_phys_segments; | 814 | --rq->nr_phys_segments; |
816 | --rq->nr_hw_segments; | ||
817 | } | 815 | } |
818 | 816 | ||
819 | rq = NULL; | 817 | rq = NULL; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 03a5ab705c20..28a3869dcfd2 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1302,9 +1302,6 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1302 | sbio->bi_size = r1_bio->sectors << 9; | 1302 | sbio->bi_size = r1_bio->sectors << 9; |
1303 | sbio->bi_idx = 0; | 1303 | sbio->bi_idx = 0; |
1304 | sbio->bi_phys_segments = 0; | 1304 | sbio->bi_phys_segments = 0; |
1305 | sbio->bi_hw_segments = 0; | ||
1306 | sbio->bi_hw_front_size = 0; | ||
1307 | sbio->bi_hw_back_size = 0; | ||
1308 | sbio->bi_flags &= ~(BIO_POOL_MASK - 1); | 1305 | sbio->bi_flags &= ~(BIO_POOL_MASK - 1); |
1309 | sbio->bi_flags |= 1 << BIO_UPTODATE; | 1306 | sbio->bi_flags |= 1 << BIO_UPTODATE; |
1310 | sbio->bi_next = NULL; | 1307 | sbio->bi_next = NULL; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e34cd0e62473..0f40688503e7 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1345,9 +1345,6 @@ static void sync_request_write(mddev_t *mddev, r10bio_t *r10_bio) | |||
1345 | tbio->bi_size = r10_bio->sectors << 9; | 1345 | tbio->bi_size = r10_bio->sectors << 9; |
1346 | tbio->bi_idx = 0; | 1346 | tbio->bi_idx = 0; |
1347 | tbio->bi_phys_segments = 0; | 1347 | tbio->bi_phys_segments = 0; |
1348 | tbio->bi_hw_segments = 0; | ||
1349 | tbio->bi_hw_front_size = 0; | ||
1350 | tbio->bi_hw_back_size = 0; | ||
1351 | tbio->bi_flags &= ~(BIO_POOL_MASK - 1); | 1348 | tbio->bi_flags &= ~(BIO_POOL_MASK - 1); |
1352 | tbio->bi_flags |= 1 << BIO_UPTODATE; | 1349 | tbio->bi_flags |= 1 << BIO_UPTODATE; |
1353 | tbio->bi_next = NULL; | 1350 | tbio->bi_next = NULL; |
@@ -208,14 +208,6 @@ inline int bio_phys_segments(struct request_queue *q, struct bio *bio) | |||
208 | return bio->bi_phys_segments; | 208 | return bio->bi_phys_segments; |
209 | } | 209 | } |
210 | 210 | ||
211 | inline int bio_hw_segments(struct request_queue *q, struct bio *bio) | ||
212 | { | ||
213 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | ||
214 | blk_recount_segments(q, bio); | ||
215 | |||
216 | return bio->bi_hw_segments; | ||
217 | } | ||
218 | |||
219 | /** | 211 | /** |
220 | * __bio_clone - clone a bio | 212 | * __bio_clone - clone a bio |
221 | * @bio: destination bio | 213 | * @bio: destination bio |
@@ -350,7 +342,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
350 | */ | 342 | */ |
351 | 343 | ||
352 | while (bio->bi_phys_segments >= q->max_phys_segments | 344 | while (bio->bi_phys_segments >= q->max_phys_segments |
353 | || bio->bi_hw_segments >= q->max_hw_segments) { | 345 | || bio->bi_phys_segments >= q->max_hw_segments) { |
354 | 346 | ||
355 | if (retried_segments) | 347 | if (retried_segments) |
356 | return 0; | 348 | return 0; |
@@ -399,7 +391,6 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
399 | 391 | ||
400 | bio->bi_vcnt++; | 392 | bio->bi_vcnt++; |
401 | bio->bi_phys_segments++; | 393 | bio->bi_phys_segments++; |
402 | bio->bi_hw_segments++; | ||
403 | done: | 394 | done: |
404 | bio->bi_size += len; | 395 | bio->bi_size += len; |
405 | return len; | 396 | return len; |
@@ -1381,7 +1372,6 @@ EXPORT_SYMBOL(bio_init); | |||
1381 | EXPORT_SYMBOL(__bio_clone); | 1372 | EXPORT_SYMBOL(__bio_clone); |
1382 | EXPORT_SYMBOL(bio_clone); | 1373 | EXPORT_SYMBOL(bio_clone); |
1383 | EXPORT_SYMBOL(bio_phys_segments); | 1374 | EXPORT_SYMBOL(bio_phys_segments); |
1384 | EXPORT_SYMBOL(bio_hw_segments); | ||
1385 | EXPORT_SYMBOL(bio_add_page); | 1375 | EXPORT_SYMBOL(bio_add_page); |
1386 | EXPORT_SYMBOL(bio_add_pc_page); | 1376 | EXPORT_SYMBOL(bio_add_pc_page); |
1387 | EXPORT_SYMBOL(bio_get_nr_vecs); | 1377 | EXPORT_SYMBOL(bio_get_nr_vecs); |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 894d16ce0020..dfc3556d311c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -77,21 +77,8 @@ struct bio { | |||
77 | */ | 77 | */ |
78 | unsigned short bi_phys_segments; | 78 | unsigned short bi_phys_segments; |
79 | 79 | ||
80 | /* Number of segments after physical and DMA remapping | ||
81 | * hardware coalescing is performed. | ||
82 | */ | ||
83 | unsigned short bi_hw_segments; | ||
84 | |||
85 | unsigned int bi_size; /* residual I/O count */ | 80 | unsigned int bi_size; /* residual I/O count */ |
86 | 81 | ||
87 | /* | ||
88 | * To keep track of the max hw size, we account for the | ||
89 | * sizes of the first and last virtually mergeable segments | ||
90 | * in this bio | ||
91 | */ | ||
92 | unsigned int bi_hw_front_size; | ||
93 | unsigned int bi_hw_back_size; | ||
94 | |||
95 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | 82 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ |
96 | 83 | ||
97 | struct bio_vec *bi_io_vec; /* the actual vec list */ | 84 | struct bio_vec *bi_io_vec; /* the actual vec list */ |
@@ -113,7 +100,7 @@ struct bio { | |||
113 | #define BIO_UPTODATE 0 /* ok after I/O completion */ | 100 | #define BIO_UPTODATE 0 /* ok after I/O completion */ |
114 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ | 101 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ |
115 | #define BIO_EOF 2 /* out-out-bounds error */ | 102 | #define BIO_EOF 2 /* out-out-bounds error */ |
116 | #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ | 103 | #define BIO_SEG_VALID 3 /* bi_phys_segments valid */ |
117 | #define BIO_CLONED 4 /* doesn't own data */ | 104 | #define BIO_CLONED 4 /* doesn't own data */ |
118 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ | 105 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ |
119 | #define BIO_USER_MAPPED 6 /* contains user pages */ | 106 | #define BIO_USER_MAPPED 6 /* contains user pages */ |
@@ -324,7 +311,6 @@ extern void bio_free(struct bio *, struct bio_set *); | |||
324 | extern void bio_endio(struct bio *, int); | 311 | extern void bio_endio(struct bio *, int); |
325 | struct request_queue; | 312 | struct request_queue; |
326 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 313 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
327 | extern int bio_hw_segments(struct request_queue *, struct bio *); | ||
328 | 314 | ||
329 | extern void __bio_clone(struct bio *, struct bio *); | 315 | extern void __bio_clone(struct bio *, struct bio *); |
330 | extern struct bio *bio_clone(struct bio *, gfp_t); | 316 | extern struct bio *bio_clone(struct bio *, gfp_t); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 490ce458b031..1adb03827bd3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -189,13 +189,6 @@ struct request { | |||
189 | */ | 189 | */ |
190 | unsigned short nr_phys_segments; | 190 | unsigned short nr_phys_segments; |
191 | 191 | ||
192 | /* Number of scatter-gather addr+len pairs after | ||
193 | * physical and DMA remapping hardware coalescing is performed. | ||
194 | * This is the number of scatter-gather entries the driver | ||
195 | * will actually have to deal with after DMA mapping is done. | ||
196 | */ | ||
197 | unsigned short nr_hw_segments; | ||
198 | |||
199 | unsigned short ioprio; | 192 | unsigned short ioprio; |
200 | 193 | ||
201 | void *special; | 194 | void *special; |