linux/drivers/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
..
aoe aoe: WIN_* -> ATA_CMD_* 2009-04-01 21:42:24 +02:00
paride block: replace end_request() with [__]blk_end_request_cur() 2009-04-28 07:37:36 +02:00
amiflop.c amiflop,ataflop,xd,mg_disk: clean up unnecessary stuff from block drivers 2009-04-28 08:14:50 +02:00
ataflop.c amiflop,ataflop,xd,mg_disk: clean up unnecessary stuff from block drivers 2009-04-28 08:14:50 +02:00
brd.c brd: fix cacheflushing 2009-04-15 12:10:13 +02:00
cciss.c block: add rq->resid_len 2009-05-11 09:50:53 +02:00
cciss.h cciss: kernel scan thread for MSA2012 2009-04-07 08:12:38 +02:00
cciss_cmd.h cciss: kernel scan thread for MSA2012 2009-04-07 08:12:38 +02:00
cciss_scsi.c cciss: Fix cciss SCSI rescan code to better notice device changes 2008-10-09 08:56:18 +02:00
cciss_scsi.h cciss: Fix cciss SCSI rescan code to better notice device changes 2008-10-09 08:56:18 +02:00
cpqarray.c block: implement and use [__]blk_end_request_all() 2009-04-28 07:37:35 +02:00
cpqarray.h
cryptoloop.c drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
DAC960.c dma-mapping: replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32) 2009-04-07 08:31:11 -07:00
DAC960.h Fix DAC960 driver on machines which don't support 64-bit DMA 2007-09-11 17:21:19 -07:00
floppy.c floppy: provide a PNP device table in the module. 2009-04-02 19:04:49 -07:00
hd.c hd: clean up request completion paths 2009-04-28 08:14:51 +02:00
ida_cmd.h
ida_ioctl.h
Kconfig mg_disk: fix dependency on libata 2009-04-28 08:14:52 +02:00
loop.c loop: use BIO list management functions 2009-04-28 07:37:28 +02:00
Makefile mflash: initial support 2009-04-07 08:12:38 +02:00
mg_disk.c mg_disk: use defines from <linux/ata.h> 2009-04-28 08:14:52 +02:00
nbd.c nbd: don't clear rq->sector and nr_sectors unnecessarily 2009-05-11 09:50:53 +02:00
pktcdvd.c pktcdvd: remove broken dev_t export of class devices 2008-12-10 10:03:32 -08:00
ps3disk.c ps3disk: simplify request completion 2009-04-28 08:14:50 +02:00
ps3vram.c proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
smart1,2.h
sunvdc.c sunvdc: kill vdc_end_request() 2009-04-28 08:14:50 +02:00
swim.c swim: clean up request completion paths 2009-04-28 08:14:51 +02:00
swim3.c swim3: clean up request completion paths 2009-04-28 08:14:51 +02:00
swim_asm.S m68k: mac - Add SWIM floppy support 2009-03-26 21:15:27 +01:00
sx8.c block: implement and use [__]blk_end_request_all() 2009-04-28 07:37:35 +02:00
ub.c block: add rq->resid_len 2009-05-11 09:50:53 +02:00
umem.c umem: fix request_queue lock warning 2009-04-24 08:54:21 +02:00
umem.h drivers/block/umem: trim trailing whitespace 2007-10-10 09:25:59 +02:00
viodasd.c [PATCH] switch viodasd 2008-10-21 07:48:07 -04:00
virtio_blk.c block: implement and use [__]blk_end_request_all() 2009-04-28 07:37:35 +02:00
xd.c amiflop,ataflop,xd,mg_disk: clean up unnecessary stuff from block drivers 2009-04-28 08:14:50 +02:00
xd.h [PATCH] switch xd 2008-10-21 07:48:11 -04:00
xen-blkfront.c block: replace end_request() with [__]blk_end_request_cur() 2009-04-28 07:37:36 +02:00
xsysace.c block: replace end_request() with [__]blk_end_request_cur() 2009-04-28 07:37:36 +02:00
z2ram.c block: replace end_request() with [__]blk_end_request_cur() 2009-04-28 07:37:36 +02:00