blob: prepare sets for esnap channels

For the various forms for read_bs_dev() and readv_bs_dev() to perform
reads from esnap devices, the spdk_bs_request_set used for the IO needs
to keep track of the back_bs_dev IO channel as well as the blobstore's
IO channel.

This commit has no change in functionality: it is preparation for a
change in a later commit.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: I8edd9c4bf29bc074194331b42c5ef9d27590ce88
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14973
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Mike Gerdts 2022-09-23 06:48:29 -05:00 committed by Konrad Sztyber
parent 34d31cdc20
commit 31c2852bb8
2 changed files with 21 additions and 10 deletions

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (C) 2017 Intel Corporation.
* All rights reserved.
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include "spdk/stdinc.h"
@ -90,6 +90,7 @@ bs_sequence_start(struct spdk_io_channel *_channel,
set->cpl = *cpl;
set->bserrno = 0;
set->channel = channel;
set->back_channel = _channel;
set->cb_args.cb_fn = bs_sequence_completion;
set->cb_args.cb_arg = set;
@ -104,8 +105,8 @@ bs_sequence_read_bs_dev(spdk_bs_sequence_t *seq, struct spdk_bs_dev *bs_dev,
void *payload, uint64_t lba, uint32_t lba_count,
spdk_bs_sequence_cpl cb_fn, void *cb_arg)
{
struct spdk_bs_request_set *set = (struct spdk_bs_request_set *)seq;
struct spdk_bs_channel *channel = set->channel;
struct spdk_bs_request_set *set = (struct spdk_bs_request_set *)seq;
struct spdk_io_channel *back_channel = set->back_channel;
SPDK_DEBUGLOG(blob_rw, "Reading %" PRIu32 " blocks from LBA %" PRIu64 "\n", lba_count,
lba);
@ -113,7 +114,7 @@ bs_sequence_read_bs_dev(spdk_bs_sequence_t *seq, struct spdk_bs_dev *bs_dev,
set->u.sequence.cb_fn = cb_fn;
set->u.sequence.cb_arg = cb_arg;
bs_dev->read(bs_dev, spdk_io_channel_from_ctx(channel), payload, lba, lba_count, &set->cb_args);
bs_dev->read(bs_dev, back_channel, payload, lba, lba_count, &set->cb_args);
}
void
@ -157,7 +158,7 @@ bs_sequence_readv_bs_dev(spdk_bs_sequence_t *seq, struct spdk_bs_dev *bs_dev,
spdk_bs_sequence_cpl cb_fn, void *cb_arg)
{
struct spdk_bs_request_set *set = (struct spdk_bs_request_set *)seq;
struct spdk_bs_channel *channel = set->channel;
struct spdk_io_channel *back_channel = set->back_channel;
SPDK_DEBUGLOG(blob_rw, "Reading %" PRIu32 " blocks from LBA %" PRIu64 "\n", lba_count,
lba);
@ -167,11 +168,10 @@ bs_sequence_readv_bs_dev(spdk_bs_sequence_t *seq, struct spdk_bs_dev *bs_dev,
if (set->ext_io_opts) {
assert(bs_dev->readv_ext);
bs_dev->readv_ext(bs_dev, spdk_io_channel_from_ctx(channel), iov, iovcnt, lba, lba_count,
bs_dev->readv_ext(bs_dev, back_channel, iov, iovcnt, lba, lba_count,
&set->cb_args, set->ext_io_opts);
} else {
bs_dev->readv(bs_dev, spdk_io_channel_from_ctx(channel), iov, iovcnt, lba, lba_count,
&set->cb_args);
bs_dev->readv(bs_dev, back_channel, iov, iovcnt, lba, lba_count, &set->cb_args);
}
}
@ -310,6 +310,7 @@ bs_batch_open(struct spdk_io_channel *_channel,
set->cpl = *cpl;
set->bserrno = 0;
set->channel = channel;
set->back_channel = _channel;
set->u.batch.cb_fn = NULL;
set->u.batch.cb_arg = NULL;
@ -328,13 +329,13 @@ bs_batch_read_bs_dev(spdk_bs_batch_t *batch, struct spdk_bs_dev *bs_dev,
void *payload, uint64_t lba, uint32_t lba_count)
{
struct spdk_bs_request_set *set = (struct spdk_bs_request_set *)batch;
struct spdk_bs_channel *channel = set->channel;
struct spdk_io_channel *back_channel = set->back_channel;
SPDK_DEBUGLOG(blob_rw, "Reading %" PRIu32 " blocks from LBA %" PRIu64 "\n", lba_count,
lba);
set->u.batch.outstanding_ops++;
bs_dev->read(bs_dev, spdk_io_channel_from_ctx(channel), payload, lba, lba_count, &set->cb_args);
bs_dev->read(bs_dev, back_channel, payload, lba, lba_count, &set->cb_args);
}
void
@ -445,6 +446,7 @@ bs_user_op_alloc(struct spdk_io_channel *_channel, struct spdk_bs_cpl *cpl,
set->cpl = *cpl;
set->channel = channel;
set->back_channel = NULL;
set->ext_io_opts = NULL;
args = &set->u.user_op;

View File

@ -85,7 +85,16 @@ struct spdk_bs_request_set {
int bserrno;
/*
* The blobstore's channel, obtained by blobstore consumers via
* spdk_bs_alloc_io_channel(). Used for IO to the blobstore.
*/
struct spdk_bs_channel *channel;
/*
* The channel used by the blobstore to perform IO on back_bs_dev.
* For now, back_channel == spdk_io_channel_get_ctx(set->channel).
*/
struct spdk_io_channel *back_channel;
struct spdk_bs_dev_cb_args cb_args;