From f5962f914573f660090c8491408b0e17ae5150ee Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Wed, 19 Apr 2023 16:18:41 +0200 Subject: [PATCH] bdev: add extra function when pushing bounce data This is done in preparation for retrying IOs on ENOMEM when pushing bounce data. Also, rename md_buffer to md_buf to keep the naming consistent with other code which uses this abbreviation. Signed-off-by: Konrad Sztyber Change-Id: I014f178a45a2a751ecca40d119f45bf323f37d0c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17762 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker --- lib/bdev/bdev.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 08211981b..ce4971138 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -1550,7 +1550,7 @@ _bdev_io_complete_push_bounce_done(void *ctx, int rc) } static void -_bdev_io_push_bounce_md_buffer_done(void *ctx, int rc) +_bdev_io_push_bounce_md_buf_done(void *ctx, int rc) { struct spdk_bdev_io *bdev_io = ctx; struct spdk_bdev_channel *ch = bdev_io->internal.ch; @@ -1561,7 +1561,7 @@ _bdev_io_push_bounce_md_buffer_done(void *ctx, int rc) } static inline void -_bdev_io_push_bounce_md_buffer(struct spdk_bdev_io *bdev_io) +bdev_io_push_bounce_md_buf(struct spdk_bdev_io *bdev_io) { struct spdk_bdev_channel *ch = bdev_io->internal.ch; int rc = 0; @@ -1581,7 +1581,7 @@ _bdev_io_push_bounce_md_buffer(struct spdk_bdev_io *bdev_io) &bdev_io->internal.orig_md_iov, (uint32_t)bdev_io->internal.orig_iovcnt, &bdev_io->internal.bounce_md_iov, 1, - _bdev_io_push_bounce_md_buffer_done, + _bdev_io_push_bounce_md_buf_done, bdev_io); if (rc == 0) { /* Continue IO completion in async callback */ @@ -1624,18 +1624,17 @@ _bdev_io_push_bounce_data_buffer_done(void *ctx, int rc) bdev_io->internal.orig_iovcnt = 0; bdev_io->internal.orig_iovs = NULL; - _bdev_io_push_bounce_md_buffer(bdev_io); + bdev_io_push_bounce_md_buf(bdev_io); } static inline void -_bdev_io_push_bounce_data_buffer(struct spdk_bdev_io *bdev_io, bdev_copy_bounce_buffer_cpl cpl_cb) +bdev_io_push_bounce_data(struct spdk_bdev_io *bdev_io) { struct spdk_bdev_channel *ch = bdev_io->internal.ch; int rc = 0; assert(bdev_io->internal.status == SPDK_BDEV_IO_STATUS_SUCCESS); TAILQ_INSERT_TAIL(&ch->io_memory_domain, bdev_io, internal.link); - bdev_io->internal.data_transfer_cpl = cpl_cb; bdev_io_increment_outstanding(ch, ch->shared_resource); /* if this is read path, copy data from bounce buffer to original buffer */ @@ -1666,6 +1665,13 @@ _bdev_io_push_bounce_data_buffer(struct spdk_bdev_io *bdev_io, bdev_copy_bounce_ _bdev_io_push_bounce_data_buffer_done(bdev_io, rc); } +static inline void +_bdev_io_push_bounce_data_buffer(struct spdk_bdev_io *bdev_io, bdev_copy_bounce_buffer_cpl cpl_cb) +{ + bdev_io->internal.data_transfer_cpl = cpl_cb; + bdev_io_push_bounce_data(bdev_io); +} + static void bdev_io_get_iobuf_cb(struct spdk_iobuf_entry *iobuf, void *buf) {