linux/block
FUJITA Tomonori 8677142710 block: fix nr_phys_segments miscalculation bug
This fixes the bug reported by Nikanth Karthikesan <knikanth@suse.de>:

http://lkml.org/lkml/2008/10/2/203

The root cause of the bug is that blk_phys_contig_segment
miscalculates q->max_segment_size.

blk_phys_contig_segment checks:

req->biotail->bi_size + next_req->bio->bi_size > q->max_segment_size

But blk_recalc_rq_segments might expect that req->biotail and the
previous bio in the req are supposed be merged into one
segment. blk_recalc_rq_segments might also expect that next_req->bio
and the next bio in the next_req are supposed be merged into one
segment. In such case, we merge two requests that can't be merged
here. Later, blk_rq_map_sg gives more segments than it should.

We need to keep track of segment size in blk_recalc_rq_segments and
use it to see if two requests can be merged. This patch implements it
in the similar way that we used to do for hw merging (virtual
merging).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-10-17 08:46:56 +02:00
..
as-iosched.c block: as/cfq ssd idle check update 2008-10-09 08:56:19 +02:00
blk-barrier.c block: adjust blkdev_issue_discard for swap 2008-10-09 08:56:17 +02:00
blk-core.c block: remove end_{queued|dequeued}_request() 2008-10-09 08:56:21 +02:00
blk-exec.c Add some block/ source files to the kernel-api docbook. Fix kernel-doc notation in them as needed. Fix changed function parameter names. Fix typos/spellos. In comments, change REQ_SPECIAL to REQ_TYPE_SPECIAL and REQ_BLOCK_PC to REQ_TYPE_BLOCK_PC. 2008-10-09 08:56:03 +02:00
blk-integrity.c block: Switch blk_integrity_compare from bdev to gendisk 2008-10-09 08:56:21 +02:00
blk-ioc.c cfq-iosched: fix RCU race in the cfq io_context destructor handling 2008-05-07 09:28:57 +02:00
blk-map.c block: make blk_rq_map_user take a NULL user-space buffer 2008-10-09 08:56:11 +02:00
blk-merge.c block: fix nr_phys_segments miscalculation bug 2008-10-17 08:46:56 +02:00
blk-settings.c block: add lld busy state exporting interface 2008-10-09 08:56:20 +02:00
blk-softirq.c block: add fault injection mechanism for faking request timeouts 2008-10-09 08:56:17 +02:00
blk-sysfs.c block: add support for IO CPU affinity 2008-10-09 08:56:09 +02:00
blk-tag.c block: reserve some tags just for sync IO 2008-10-09 08:56:19 +02:00
blk-timeout.c block: use rq complete marking in blk_abort_request() 2008-10-09 08:56:17 +02:00
blk.h block: add fault injection mechanism for faking request timeouts 2008-10-09 08:56:17 +02:00
blktrace.c blktrace: use BLKTRACE_BDEV_SIZE as the name size for setup structure 2008-10-09 08:56:20 +02:00
bsg.c device create: block: convert device_create_drvdata to device_create 2008-10-16 09:24:41 -07:00
cfq-iosched.c block: as/cfq ssd idle check update 2008-10-09 08:56:19 +02:00
cmd-filter.c block: move holder_dir from disk to part0 2008-10-09 08:56:08 +02:00
compat_ioctl.c Add BLKDISCARD ioctl to allow userspace to discard sectors 2008-10-09 08:56:02 +02:00
deadline-iosched.c deadline-iosched: non-functional fixes 2008-10-09 08:56:03 +02:00
elevator.c block: change elevator to use __blk_end_request() 2008-10-09 08:56:21 +02:00
genhd.c block: add fault injection mechanism for faking request timeouts 2008-10-09 08:56:17 +02:00
ioctl.c block: make partition array dynamic 2008-10-09 08:56:08 +02:00
Kconfig block: Block layer data integrity support 2008-07-03 13:21:13 +02:00
Kconfig.iosched update I/O sched Kconfig help texts - CFQ is now default, not AS. 2007-02-17 20:08:22 +01:00
Makefile block: unify request timeout handling 2008-10-09 08:56:13 +02:00
noop-iosched.c block: let elv_register() return void 2007-12-18 08:29:28 +01:00
scsi_ioctl.c block: introduce struct rq_map_data to use reserved pages 2008-10-09 08:56:10 +02:00