raid: Report memory domains
Use spdk_bdev_readv/writev_block_ext even when there is no ext opts passed by bdev layer Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Change-Id: I0b9f17150cdba1a1023478bae745ab4438ea99bb Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10070 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
99719ef049
commit
be440c01c9
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -679,6 +680,41 @@ raid_bdev_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
static int
|
||||
raid_bdev_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, int array_size)
|
||||
{
|
||||
struct raid_bdev *raid_bdev = ctx;
|
||||
struct spdk_bdev *base_bdev;
|
||||
uint32_t i;
|
||||
int domains_count = 0, rc;
|
||||
|
||||
/* First loop to get the number of memory domains */
|
||||
for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
|
||||
base_bdev = raid_bdev->base_bdev_info[i].bdev;
|
||||
rc = spdk_bdev_get_memory_domains(base_bdev, NULL, 0);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
domains_count += rc;
|
||||
}
|
||||
|
||||
if (!domains || array_size < domains_count) {
|
||||
return domains_count;
|
||||
}
|
||||
|
||||
for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
|
||||
base_bdev = raid_bdev->base_bdev_info[i].bdev;
|
||||
rc = spdk_bdev_get_memory_domains(base_bdev, domains, array_size);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
domains += rc;
|
||||
array_size -= rc;
|
||||
}
|
||||
|
||||
return domains_count;
|
||||
}
|
||||
|
||||
/* g_raid_bdev_fn_table is the function table for raid bdev */
|
||||
static const struct spdk_bdev_fn_table g_raid_bdev_fn_table = {
|
||||
.destruct = raid_bdev_destruct,
|
||||
@ -687,6 +723,7 @@ static const struct spdk_bdev_fn_table g_raid_bdev_fn_table = {
|
||||
.get_io_channel = raid_bdev_get_io_channel,
|
||||
.dump_info_json = raid_bdev_dump_info_json,
|
||||
.write_config_json = raid_bdev_write_config_json,
|
||||
.get_memory_domains = raid_bdev_get_memory_domains,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -139,6 +139,9 @@ DEFINE_STUB(spdk_json_write_null, int, (struct spdk_json_write_ctx *w), 0);
|
||||
DEFINE_STUB(spdk_strerror, const char *, (int errnum), NULL);
|
||||
DEFINE_STUB(spdk_bdev_queue_io_wait, int, (struct spdk_bdev *bdev, struct spdk_io_channel *ch,
|
||||
struct spdk_bdev_io_wait_entry *entry), 0);
|
||||
DEFINE_STUB(spdk_bdev_get_memory_domains, int, (struct spdk_bdev *bdev,
|
||||
struct spdk_memory_domain **domains, int array_size), 0);
|
||||
DEFINE_STUB(spdk_bdev_get_name, const char *, (const struct spdk_bdev *bdev), "test_bdev");
|
||||
|
||||
struct spdk_io_channel *
|
||||
spdk_bdev_get_io_channel(struct spdk_bdev_desc *desc)
|
||||
|
Loading…
Reference in New Issue
Block a user