Commit 22fe262e authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

bdev: Relocate _bdev_memory_domain_io_get_buf_cb() close to _bdev_io_submit_ext()



It is easier to read if _bdev_memory_domain_get_io_cb() is close to
_bdev_io_submit_ext() because both handle accel sequence and submit I/O.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I9cbd52ed239a99b2d6a9b8d2db012410fc34b79f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25127


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
parent 3c6c4e01
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -1893,31 +1893,6 @@ spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, u
	bdev_io_get_buf(bdev_io, len);
}

static void
_bdev_memory_domain_get_io_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
			      bool success)
{
	if (!success) {
		SPDK_ERRLOG("Failed to get data buffer, completing IO\n");
		bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
		bdev_io_complete_unsubmitted(bdev_io);
		return;
	}

	if (bdev_io_needs_sequence_exec(bdev_io->internal.desc, bdev_io)) {
		if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
			bdev_io_exec_sequence(bdev_io, bdev_io_submit_sequence_cb);
			return;
		}
		/* For reads we'll execute the sequence after the data is read, so, for now, only
		 * clear out accel_sequence pointer and submit the IO */
		assert(bdev_io->type == SPDK_BDEV_IO_TYPE_READ);
		bdev_io->u.bdev.accel_sequence = NULL;
	}

	bdev_io_submit(bdev_io);
}

static void
_bdev_memory_domain_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb,
			       uint64_t len)
@@ -3717,6 +3692,31 @@ bdev_io_init_dif_ctx(struct spdk_bdev_io *bdev_io)
				 0xFFFF, 0, 0, 0, &dif_opts);
}

static void
_bdev_memory_domain_get_io_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
			      bool success)
{
	if (!success) {
		SPDK_ERRLOG("Failed to get data buffer, completing IO\n");
		bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
		bdev_io_complete_unsubmitted(bdev_io);
		return;
	}

	if (bdev_io_needs_sequence_exec(bdev_io->internal.desc, bdev_io)) {
		if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
			bdev_io_exec_sequence(bdev_io, bdev_io_submit_sequence_cb);
			return;
		}
		/* For reads we'll execute the sequence after the data is read, so, for now, only
		 * clear out accel_sequence pointer and submit the IO */
		assert(bdev_io->type == SPDK_BDEV_IO_TYPE_READ);
		bdev_io->u.bdev.accel_sequence = NULL;
	}

	bdev_io_submit(bdev_io);
}

static inline void
_bdev_io_ext_use_bounce_buffer(struct spdk_bdev_io *bdev_io)
{