]> bbs.cooldavid.org Git - net-next-2.6.git/commit - drivers/ide/ide-tape.c
ide-tape: use standard data transfer mechanism
authorTejun Heo <tj@kernel.org>
Sat, 18 Apr 2009 23:46:02 +0000 (08:46 +0900)
committerTejun Heo <tj@kernel.org>
Sat, 18 Apr 2009 23:46:02 +0000 (08:46 +0900)
commit21d9c5d227593d15630ae83a336d1519653e9b8a
tree00cae13e13a418768354b92bf5e48c2b85625a6d
parent35ab8d3251833e4052aa64b09b08195e949518c7
ide-tape: use standard data transfer mechanism

Impact: use standard way to transfer data

ide-tape uses rq in an interesting way.  For r/w requests, rq->special
is used to carry a private buffer management structure idetape_bh and
rq->nr_sectors and current_nr_sectors are initialized to the number of
idetape blocks which isn't necessary 512 bytes.  Also,
rq->current_nr_sectors is used to report back the residual count in
units of idetape blocks.

This peculiarity taxes both block layer and ide.  ide-atapi has
different paths and hooks to accomodate it and what a rq means becomes
quite confusing and making changes at the block layer becomes quite
difficult and error-prone.

This patch makes ide-tape use bio instead.  With the previous patch,
ide-tape currently is using single contiguos buffer so replacing it
isn't difficult.  Data buffer is mapped into bio using
blk_rq_map_kern() in idetape_queue_rw_tail().  idetape_io_buffers()
and idetape_update_buffers() are dropped and pc->bh is set to null to
tell ide-atapi to use standard data transfer mechanism and idetape_bh
byte counts are updated by the issuer on completion using the residual
count.

This change also nicely removes the FIXME in ide_pc_intr() where
ide-tape rqs need to be completed using ide_rq_bytes() instead of
blk_rq_bytes() (although this didn't really matter as the request
didn't have bio).

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
drivers/ide/ide-atapi.c
drivers/ide/ide-tape.c