bdev/malloc: report memory domain support
Because the copying is handled by accel, which will do push/pull when necessary, we can report support for each registered memory domain. Also, since verifying PI information would require doing a push/pull, we don't report support for memory domains if bdev has DIF enabled. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Id80f82aaac68e9dec2a6cae81d96a460105161d6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17201 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
06fd87e4e9
commit
9276019077
@ -140,7 +140,7 @@ DEPDIRS-bdev_compress := $(BDEV_DEPS_THREAD) reduce accel
|
|||||||
DEPDIRS-bdev_crypto := $(BDEV_DEPS_THREAD) accel
|
DEPDIRS-bdev_crypto := $(BDEV_DEPS_THREAD) accel
|
||||||
DEPDIRS-bdev_delay := $(BDEV_DEPS_THREAD)
|
DEPDIRS-bdev_delay := $(BDEV_DEPS_THREAD)
|
||||||
DEPDIRS-bdev_iscsi := $(BDEV_DEPS_THREAD)
|
DEPDIRS-bdev_iscsi := $(BDEV_DEPS_THREAD)
|
||||||
DEPDIRS-bdev_malloc := $(BDEV_DEPS_THREAD) accel
|
DEPDIRS-bdev_malloc := $(BDEV_DEPS_THREAD) accel dma
|
||||||
DEPDIRS-bdev_null := $(BDEV_DEPS_THREAD)
|
DEPDIRS-bdev_null := $(BDEV_DEPS_THREAD)
|
||||||
DEPDIRS-bdev_nvme = $(BDEV_DEPS_THREAD) accel nvme trace
|
DEPDIRS-bdev_nvme = $(BDEV_DEPS_THREAD) accel nvme trace
|
||||||
DEPDIRS-bdev_ocf := $(BDEV_DEPS_THREAD)
|
DEPDIRS-bdev_ocf := $(BDEV_DEPS_THREAD)
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "spdk/endian.h"
|
#include "spdk/endian.h"
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/accel.h"
|
#include "spdk/accel.h"
|
||||||
|
#include "spdk/dma.h"
|
||||||
#include "spdk/likely.h"
|
#include "spdk/likely.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ malloc_verify_pi(struct spdk_bdev_io *bdev_io)
|
|||||||
struct spdk_dif_error err_blk;
|
struct spdk_dif_error err_blk;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
assert(bdev_io->u.bdev.memory_domain == NULL);
|
||||||
rc = spdk_dif_ctx_init(&dif_ctx,
|
rc = spdk_dif_ctx_init(&dif_ctx,
|
||||||
bdev->blocklen,
|
bdev->blocklen,
|
||||||
bdev->md_len,
|
bdev->md_len,
|
||||||
@ -379,6 +381,7 @@ _bdev_malloc_submit_request(struct malloc_channel *mch, struct spdk_bdev_io *bde
|
|||||||
case SPDK_BDEV_IO_TYPE_READ:
|
case SPDK_BDEV_IO_TYPE_READ:
|
||||||
if (bdev_io->u.bdev.iovs[0].iov_base == NULL) {
|
if (bdev_io->u.bdev.iovs[0].iov_base == NULL) {
|
||||||
assert(bdev_io->u.bdev.iovcnt == 1);
|
assert(bdev_io->u.bdev.iovcnt == 1);
|
||||||
|
assert(bdev_io->u.bdev.memory_domain == NULL);
|
||||||
bdev_io->u.bdev.iovs[0].iov_base =
|
bdev_io->u.bdev.iovs[0].iov_base =
|
||||||
disk->malloc_buf + bdev_io->u.bdev.offset_blocks * block_size;
|
disk->malloc_buf + bdev_io->u.bdev.offset_blocks * block_size;
|
||||||
bdev_io->u.bdev.iovs[0].iov_len = bdev_io->u.bdev.num_blocks * block_size;
|
bdev_io->u.bdev.iovs[0].iov_len = bdev_io->u.bdev.num_blocks * block_size;
|
||||||
@ -508,12 +511,36 @@ bdev_malloc_write_json_config(struct spdk_bdev *bdev, struct spdk_json_write_ctx
|
|||||||
spdk_json_write_object_end(w);
|
spdk_json_write_object_end(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bdev_malloc_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, int array_size)
|
||||||
|
{
|
||||||
|
struct malloc_disk *malloc_disk = ctx;
|
||||||
|
struct spdk_memory_domain *domain;
|
||||||
|
int num_domains = 0;
|
||||||
|
|
||||||
|
if (malloc_disk->disk.dif_type != SPDK_DIF_DISABLE) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Report support for every memory domain */
|
||||||
|
for (domain = spdk_memory_domain_get_first(NULL); domain != NULL;
|
||||||
|
domain = spdk_memory_domain_get_next(domain, NULL)) {
|
||||||
|
if (domains != NULL && num_domains < array_size) {
|
||||||
|
domains[num_domains] = domain;
|
||||||
|
}
|
||||||
|
num_domains++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num_domains;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct spdk_bdev_fn_table malloc_fn_table = {
|
static const struct spdk_bdev_fn_table malloc_fn_table = {
|
||||||
.destruct = bdev_malloc_destruct,
|
.destruct = bdev_malloc_destruct,
|
||||||
.submit_request = bdev_malloc_submit_request,
|
.submit_request = bdev_malloc_submit_request,
|
||||||
.io_type_supported = bdev_malloc_io_type_supported,
|
.io_type_supported = bdev_malloc_io_type_supported,
|
||||||
.get_io_channel = bdev_malloc_get_io_channel,
|
.get_io_channel = bdev_malloc_get_io_channel,
|
||||||
.write_config_json = bdev_malloc_write_json_config,
|
.write_config_json = bdev_malloc_write_json_config,
|
||||||
|
.get_memory_domains = bdev_malloc_get_memory_domains,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user