vdisk_blockio: Set REQ_WRITE flag before invoking bio_add_page()

The bio request type must be set before bio_add_page() is invoked.
See e.g. raid5_mergeable_bvec() for an example of a function that
checks (bi_rw & REQ_WRITE) from inside the bio_add_page() call.
This patch improves performance when using SCST on top of RAID5.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-04-24 09:03:04 +02:00
parent bd16fd94de
commit 1798aeb121
+7 -1
View File
@@ -5415,6 +5415,12 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua)
* and retries.
*/
vdisk_bio_set_failfast(bio);
if (write)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
bio->bi_rw |= (1 << BIO_RW);
#else
bio->bi_rw |= REQ_WRITE;
#endif
#if 0 /* It could be win, but could be not, so a performance study is needed */
bio->bi_rw |= REQ_SYNC;
@@ -5465,7 +5471,7 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua)
bio = hbio;
hbio = hbio->bi_next;
bio->bi_next = NULL;
submit_bio((write != 0), bio);
submit_bio(bio->bi_rw, bio);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)