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
commit 81108f74b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;