linux/block
Tejun Heo c3a4d78c58 block: add rq->resid_len
rq->data_len served two purposes - the length of data buffer on issue
and the residual count on completion.  This duality creates some
headaches.

First of all, block layer and low level drivers can't really determine
what rq->data_len contains while a request is executing.  It could be
the total request length or it coulde be anything else one of the
lower layers is using to keep track of residual count.  This
complicates things because blk_rq_bytes() and thus
[__]blk_end_request_all() relies on rq->data_len for PC commands.
Drivers which want to report residual count should first cache the
total request length, update rq->data_len and then complete the
request with the cached data length.

Secondly, it makes requests default to reporting full residual count,
ie. reporting that no data transfer occurred.  The residual count is
an exception not the norm; however, the driver should clear
rq->data_len to zero to signify the normal cases while leaving it
alone means no data transfer occurred at all.  This reverse default
behavior complicates code unnecessarily and renders block PC on some
drivers (ide-tape/floppy) unuseable.

This patch adds rq->resid_len which is used only for residual count.

While at it, remove now unnecessasry blk_rq_bytes() caching in
ide_pc_intr() as rq->data_len is not changed anymore.

Boaz	: spotted missing conversion in osd
Sergei	: spotted too early conversion to blk_rq_bytes() in ide-tape

[ Impact: cleanup residual count handling, report 0 resid by default ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2009-05-11 09:50:53 +02:00
..
Kconfig block: enable by default support for large devices and files on 32-bit archs 2009-04-28 07:37:33 +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 tracing/blktrace: move the tracing file to kernel/trace 2009-02-09 10:51:02 +01:00
as-iosched.c block: kill blk_start_queueing() 2009-04-28 07:37:33 +02:00
blk-barrier.c block: implement and use [__]blk_end_request_all() 2009-04-28 07:37:35 +02:00
blk-core.c block: catch trying to use more bits than request->cmd_flags has 2009-04-28 07:37:37 +02:00
blk-exec.c block: don't set REQ_NOMERGE unnecessarily 2009-04-28 07:37:33 +02:00
blk-integrity.c block: Allow empty integrity profile 2009-01-30 12:34:36 +01: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: kill rq->data 2009-04-28 07:37:36 +02:00
blk-merge.c block: simplify I/O stat accounting 2009-04-24 08:54:21 +02:00
blk-settings.c block: fix queue bounce limit setting 2009-04-22 08:35:09 +02:00
blk-softirq.c generic-ipi: remove CSD_FLAG_WAIT 2009-02-25 14:13:44 +01:00
blk-sysfs.c block: simplify I/O stat accounting 2009-04-24 08:54:21 +02:00
blk-tag.c block/blk-tag.c: cleanup kernel-doc 2008-12-29 08:28:43 +01:00
blk-timeout.c block: clean up misc stuff after block layer timeout conversion 2009-04-28 07:37:34 +02:00
blk.h block: include discard requests in IO accounting 2009-04-28 07:37:37 +02:00
bsg.c block: add rq->resid_len 2009-05-11 09:50:53 +02:00
cfq-iosched.c block: kill blk_start_queueing() 2009-04-28 07:37:33 +02:00
cmd-filter.c [SCSI] Make scsi.h independent of the rest of the scsi includes 2009-03-12 12:58:13 -05:00
compat_ioctl.c block: don't take lock on changing ra_pages 2008-12-29 08:28:43 +01:00
deadline-iosched.c block: get rid of elevator_t typedef 2008-12-29 08:29:50 +01:00
elevator.c block: implement and use [__]blk_end_request_all() 2009-04-28 07:37:35 +02:00
genhd.c block: include empty disks in /proc/diskstats 2009-04-22 08:35:10 +02:00
ioctl.c block: Remove code handling bio_alloc failure with __GFP_WAIT 2009-04-15 12:10:12 +02:00
noop-iosched.c block: get rid of elevator_t typedef 2008-12-29 08:29:50 +01:00
scsi_ioctl.c block: add rq->resid_len 2009-05-11 09:50:53 +02:00