block: fix SG_IO vector request data length handling
authorTejun Heo <tj@kernel.org>
Wed, 15 Apr 2009 13:10:24 +0000 (22:10 +0900)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 22 Apr 2009 06:35:09 +0000 (08:35 +0200)
commit25636e282fe95508cae96bb27f86407aef935817
tree3ab5b1ab589c02756211c8faa098f756488ff0de
parent23c560a99d78bddf5c251bfa97bce19e4da4b3f3
block: fix SG_IO vector request data length handling

Impact: fix SG_IO behavior such that it matches the documentation

SG_IO howto says that if ->dxfer_len and sum of iovec disagress, the
shorter one wins.  However, the current implementation returns -EINVAL
for such cases.  Trim iovc if it's longer than ->dxfer_len.

This patch uses iov_*() helpers which take struct iovec * by casting
struct sg_iovec * to it.  sg_iovec is always identical to iovec and
this will be further cleaned up with later patches.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/scsi_ioctl.c