From e94515231d082ef093c66accda94601f13a0d6f7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 28 Feb 2007 12:55:35 +0000 Subject: [PATCH] Mostly from Vu Pham: - Use submit_bio() instead of generic_make_request - Fixes case, when exported device blocksize >512 Seems, BLOCKIO works now, although the following not done yet: 1. BLOCKIO version vdisk_exec_verify(). It is basically the same as for the plain read, but it should read in own local data buffer and compare data with the command's ones, if requested. 2. There is a need for test on the underlying device with blocksize >512. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@99 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index b2d9eaef9..1ffe9ea40 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2075,6 +2075,11 @@ static int blockio_endio(struct bio *bio, unsigned int bytes_done, int error) if (unlikely(error != 0)) { PRINT_ERROR_PR("cmd %p returned error %d", blockio_work->cmd, error); + /* + * The race with other such bio's doesn't matter, since all + * scst_set_cmd_error() calls do the same local to this cmd + * operations. + */ if (bio->bi_rw & WRITE) scst_set_cmd_error(blockio_work->cmd, SCST_LOAD_SENSE(scst_sense_write_error)); @@ -2136,21 +2141,22 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, if (need_new_bio) { bio = bio_alloc(GFP_KERNEL, max_nr_vecs); if (!bio) { - PRINT_ERROR_PR("Failed to create bio" - "for data segment= %d" - " cmd %p", j, cmd); + PRINT_ERROR_PR("Failed to create bio " + "for data segment= %d " + "cmd %p", j, cmd); goto out_no_bio; } atomic_inc(&blockio_work->bios_inflight); need_new_bio = 0; bio->bi_end_io = blockio_endio; - bio->bi_sector = lba_start; + bio->bi_sector = lba_start << + (virt_dev->block_shift - 9); bio->bi_bdev = bdev; bio->bi_private = blockio_work; - bio->bi_rw |= write; +#if 0 /* It could be win, but could be not, so a performance study is needed */ bio->bi_rw |= 1 << BIO_RW_SYNC; - +#endif if (!hbio) hbio = tbio = bio; else @@ -2180,7 +2186,7 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, hbio = hbio->bi_next; bio->bi_next = NULL; - generic_make_request(bio); + submit_bio(write, bio); } if (q && q->unplug_fn)