Merge pull request #927 from jfckm/use-plugging-in-bottom-adapter

Use blk_plug mechanism in bottom block adapter
This commit is contained in:
Robert Baldyga
2021-09-02 11:23:37 +02:00
committed by GitHub

View File

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