diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 12:01:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 12:01:25 -0500 |
commit | d99cf9d679a520d67f81d805b7cb91c68e1847f0 (patch) | |
tree | 415aefe6d168df27c006fcc53b1ea5242eabaaea /fs | |
parent | 7ed40918a386afc2e14a6d3da563ea6d13686c25 (diff) | |
parent | e650c305ec3178818b317dad37a6d9c7fa8ba28d (diff) |
Merge branch 'post-2.6.15' of git://brick.kernel.dk/data/git/linux-2.6-block
Manual fixup for merge with Jens' "Suspend support for libata", commit
ID 9b847548663ef1039dd49f0eb4463d001e596bc3.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -325,10 +325,31 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page | |||
325 | if (unlikely(bio_flagged(bio, BIO_CLONED))) | 325 | if (unlikely(bio_flagged(bio, BIO_CLONED))) |
326 | return 0; | 326 | return 0; |
327 | 327 | ||
328 | if (bio->bi_vcnt >= bio->bi_max_vecs) | 328 | if (((bio->bi_size + len) >> 9) > max_sectors) |
329 | return 0; | 329 | return 0; |
330 | 330 | ||
331 | if (((bio->bi_size + len) >> 9) > max_sectors) | 331 | /* |
332 | * For filesystems with a blocksize smaller than the pagesize | ||
333 | * we will often be called with the same page as last time and | ||
334 | * a consecutive offset. Optimize this special case. | ||
335 | */ | ||
336 | if (bio->bi_vcnt > 0) { | ||
337 | struct bio_vec *prev = &bio->bi_io_vec[bio->bi_vcnt - 1]; | ||
338 | |||
339 | if (page == prev->bv_page && | ||
340 | offset == prev->bv_offset + prev->bv_len) { | ||
341 | prev->bv_len += len; | ||
342 | if (q->merge_bvec_fn && | ||
343 | q->merge_bvec_fn(q, bio, prev) < len) { | ||
344 | prev->bv_len -= len; | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | goto done; | ||
349 | } | ||
350 | } | ||
351 | |||
352 | if (bio->bi_vcnt >= bio->bi_max_vecs) | ||
332 | return 0; | 353 | return 0; |
333 | 354 | ||
334 | /* | 355 | /* |
@@ -382,6 +403,7 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page | |||
382 | bio->bi_vcnt++; | 403 | bio->bi_vcnt++; |
383 | bio->bi_phys_segments++; | 404 | bio->bi_phys_segments++; |
384 | bio->bi_hw_segments++; | 405 | bio->bi_hw_segments++; |
406 | done: | ||
385 | bio->bi_size += len; | 407 | bio->bi_size += len; |
386 | return len; | 408 | return len; |
387 | } | 409 | } |