Use blk_plug mechanism in bottom block adapter

This is a suboptimal solution to CAS on top of MD RAID1 device. If using
only submit_bio API RAID1 would process all IOs in single thread.
Plugging bypasses this thread and processess IOs in blk_finish_plug
caller context improving performance drastically.

Testing showed no negative impact to other usecases and it's a thing
that Linux does in AIO, so it's vetted and proven to work.

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial 2021-07-30 11:12:50 +02:00
parent 1064cecbb9
commit 6c6bc95b29

View File

@ -3,6 +3,8 @@
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#include <linux/blkdev.h>
#include "cas_cache.h"
#define CAS_DEBUG_IO 0
@ -371,6 +373,7 @@ static void block_dev_submit_io(struct ocf_io *io)
uint64_t addr = io->addr;
uint32_t bytes = io->bytes;
int dir = io->dir;
struct blk_plug plug;
if (CAS_IS_SET_FLUSH(io->flags)) {
CAS_DEBUG_MSG("Flush request");
@ -394,6 +397,8 @@ static void block_dev_submit_io(struct ocf_io *io)
return;
}
blk_start_plug(&plug);
while (cas_io_iter_is_next(iter) && bytes) {
/* Still IO vectors to be sent */
@ -461,6 +466,8 @@ static void block_dev_submit_io(struct ocf_io *io)
}
}
blk_finish_plug(&plug);
if (bytes && bdio->error == 0) {
/* Not all bytes sent, mark error */
bdio->error = -ENOBUFS;