]> git.baikalelectronics.ru Git - kernel.git/commit
block: move the padding adjustment to blk_rq_map_sg
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 11 Apr 2008 10:56:52 +0000 (12:56 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 21 Apr 2008 07:50:08 +0000 (09:50 +0200)
commit9a393a38c6a0ef0c4ba3d87d36c527d95f3c7b00
tree99d5dcfdfe29578bb23900e63f226022f5e87281
parent56b32d6cb638f3035cde98e42cc0bbb23ffc0973
block: move the padding adjustment to blk_rq_map_sg

blk_rq_map_user adjusts bi_size of the last bio. It breaks the rule
that req->data_len (the true data length) is equal to sum(bio). It
broke the scsi command completion code.

commit c38e1c30a1a2a96e277692ac3356603b459cdd2f was introduced to fix
the above issue. However, the partial completion code doesn't work
with it. The commit is also a layer violation (scsi mid-layer should
not know about the block layer's padding).

This patch moves the padding adjustment to blk_rq_map_sg (suggested by
James). The padding works like the drain buffer. This patch breaks the
rule that req->data_len is equal to sum(sg), however, the drain buffer
already broke it. So this patch just restores the rule that
req->data_len is equal to sub(bio) without breaking anything new.

Now when a low level driver needs padding, blk_rq_map_user and
blk_rq_map_user_iov guarantee there's enough room for padding.
blk_rq_map_sg can safely extend the last entry of a scatter list.

blk_rq_map_sg must extend the last entry of a scatter list only for a
request that got through bio_copy_user_iov. This patches introduces
new REQ_COPY_USER flag.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk-map.c
block/blk-merge.c
drivers/scsi/scsi.c
include/linux/blkdev.h