check_format: For C files only, fix return type breaks
In SPDK, declarations have the return type on the same line. Definitions have the return type on a separate line. Astyle has an option for enforcing this. Unfortunately, it seems to have two bugs: 1) It doesn't work correctly at all on C++ files. 2) It often fails on functions that return enums, or long type names Deal with 1) by adjusting the check_format.sh script to only tell astyle to fix return type line breaks for C files and not C++. Deal with 2) by adding a few typedefs to work around the problem. Change-Id: Idf28281466cab8411ce252d5f02ab384166790c6 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13437 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
parent
8620c9a0d1
commit
8dd1cd2104
@ -19,7 +19,8 @@ static int g_shm_id = 0;
|
|||||||
|
|
||||||
struct spdk_jsonrpc_client *g_rpc_client;
|
struct spdk_jsonrpc_client *g_rpc_client;
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage:\n");
|
fprintf(stderr, "usage:\n");
|
||||||
fprintf(stderr, " %s <option>\n", exe_name);
|
fprintf(stderr, " %s <option>\n", exe_name);
|
||||||
@ -107,7 +108,8 @@ end:
|
|||||||
spdk_jsonrpc_client_free_request(request);
|
spdk_jsonrpc_client_free_request(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
void *history_ptr;
|
void *history_ptr;
|
||||||
struct spdk_trace_histories *histories;
|
struct spdk_trace_histories *histories;
|
||||||
|
@ -677,7 +677,8 @@ dd_open_bdev(struct dd_target *target, const char *bdev_name, uint64_t skip_bloc
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dd_finish(void)
|
static void
|
||||||
|
dd_finish(void)
|
||||||
{
|
{
|
||||||
/* Interrupt operation */
|
/* Interrupt operation */
|
||||||
g_interrupt = true;
|
g_interrupt = true;
|
||||||
|
@ -3239,7 +3239,8 @@ wait_init(pthread_t *data_thread)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int op, rc;
|
int op, rc;
|
||||||
char *socket = SPDK_DEFAULT_RPC_ADDR;
|
char *socket = SPDK_DEFAULT_RPC_ADDR;
|
||||||
|
@ -318,7 +318,8 @@ print_json(void *cb_ctx, const void *data, size_t size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage:\n");
|
fprintf(stderr, "usage:\n");
|
||||||
fprintf(stderr, " %s <option> <lcore#>\n", g_exe_name);
|
fprintf(stderr, " %s <option> <lcore#>\n", g_exe_name);
|
||||||
@ -335,7 +336,8 @@ static void usage(void)
|
|||||||
fprintf(stderr, " '-j' to use JSON to format the output\n");
|
fprintf(stderr, " '-j' to use JSON to format the output\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct spdk_trace_parser_opts opts;
|
struct spdk_trace_parser_opts opts;
|
||||||
struct spdk_trace_parser_entry entry;
|
struct spdk_trace_parser_entry entry;
|
||||||
|
@ -538,7 +538,8 @@ setup_exit_signal_handler(void)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("\n%s is used to record all SPDK generated trace entries\n", g_exe_name);
|
printf("\n%s is used to record all SPDK generated trace entries\n", g_exe_name);
|
||||||
printf("from SPDK trace shared-memory to specified file.\n\n");
|
printf("from SPDK trace shared-memory to specified file.\n\n");
|
||||||
@ -554,7 +555,8 @@ static void usage(void)
|
|||||||
printf(" '-h' to print usage information\n");
|
printf(" '-h' to print usage information\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *app_name = NULL;
|
const char *app_name = NULL;
|
||||||
const char *file_name = NULL;
|
const char *file_name = NULL;
|
||||||
|
@ -1115,8 +1115,9 @@ spdk_fio_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, u
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FIO_IOOPS_VERSION >= 30
|
#if FIO_IOOPS_VERSION >= 30
|
||||||
static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
|
static int
|
||||||
unsigned int *max_open_zones)
|
spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
|
||||||
|
unsigned int *max_open_zones)
|
||||||
{
|
{
|
||||||
struct spdk_bdev *bdev;
|
struct spdk_bdev *bdev;
|
||||||
|
|
||||||
@ -1294,7 +1295,8 @@ struct ioengine_ops ioengine = {
|
|||||||
.options = options,
|
.options = options,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void fio_init spdk_fio_register(void)
|
static void fio_init
|
||||||
|
spdk_fio_register(void)
|
||||||
{
|
{
|
||||||
register_ioengine(&ioengine);
|
register_ioengine(&ioengine);
|
||||||
}
|
}
|
||||||
@ -1312,7 +1314,8 @@ spdk_fio_finish_env(void)
|
|||||||
spdk_env_fini();
|
spdk_env_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fio_exit spdk_fio_unregister(void)
|
static void fio_exit
|
||||||
|
spdk_fio_unregister(void)
|
||||||
{
|
{
|
||||||
if (g_spdk_env_initialized) {
|
if (g_spdk_env_initialized) {
|
||||||
spdk_fio_finish_env();
|
spdk_fio_finish_env();
|
||||||
|
@ -39,7 +39,8 @@ hello_bdev_usage(void)
|
|||||||
/*
|
/*
|
||||||
* This function is called to parse the parameters that are specific to this application
|
* This function is called to parse the parameters that are specific to this application
|
||||||
*/
|
*/
|
||||||
static int hello_bdev_parse_arg(int ch, char *arg)
|
static int
|
||||||
|
hello_bdev_parse_arg(int ch, char *arg)
|
||||||
{
|
{
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -95,7 +95,8 @@ ioat_exit(void)
|
|||||||
free(dev);
|
free(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_task *ioat_task)
|
static void
|
||||||
|
prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_task *ioat_task)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
uintptr_t src_offset;
|
uintptr_t src_offset;
|
||||||
|
@ -1020,7 +1020,8 @@ associate_workers_with_ns(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct worker_thread *worker, *main_worker;
|
struct worker_thread *worker, *main_worker;
|
||||||
|
@ -290,7 +290,8 @@ parse_args(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -102,7 +102,8 @@ get_discovery_log_page(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(char *program_name)
|
static void
|
||||||
|
usage(char *program_name)
|
||||||
{
|
{
|
||||||
printf("%s options", program_name);
|
printf("%s options", program_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -247,7 +248,8 @@ setup_sig_handlers(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -449,7 +449,8 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
fio_file_set_size_known(f);
|
fio_file_set_size_known(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_prchk_flags(const char *prchk_str)
|
static void
|
||||||
|
parse_prchk_flags(const char *prchk_str)
|
||||||
{
|
{
|
||||||
if (!prchk_str) {
|
if (!prchk_str) {
|
||||||
return;
|
return;
|
||||||
@ -466,7 +467,8 @@ static void parse_prchk_flags(const char *prchk_str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_pract_flag(int pract)
|
static void
|
||||||
|
parse_pract_flag(int pract)
|
||||||
{
|
{
|
||||||
if (pract == 1) {
|
if (pract == 1) {
|
||||||
g_spdk_pract_flag = SPDK_NVME_IO_FLAGS_PRACT;
|
g_spdk_pract_flag = SPDK_NVME_IO_FLAGS_PRACT;
|
||||||
@ -501,7 +503,8 @@ fio_redirected_to_dev_null(void)
|
|||||||
* 'key=value [key=value] ... ns=value'
|
* 'key=value [key=value] ... ns=value'
|
||||||
* For example, For local PCIe NVMe device - 'trtype=PCIe traddr=0000.04.00.0 ns=1'
|
* For example, For local PCIe NVMe device - 'trtype=PCIe traddr=0000.04.00.0 ns=1'
|
||||||
* For remote exported by NVMe-oF target, 'trtype=RDMA adrfam=IPv4 traddr=192.168.100.8 trsvcid=4420 ns=1' */
|
* For remote exported by NVMe-oF target, 'trtype=RDMA adrfam=IPv4 traddr=192.168.100.8 trsvcid=4420 ns=1' */
|
||||||
static int spdk_fio_setup(struct thread_data *td)
|
static int
|
||||||
|
spdk_fio_setup(struct thread_data *td)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread;
|
struct spdk_fio_thread *fio_thread;
|
||||||
struct spdk_fio_options *fio_options = td->eo;
|
struct spdk_fio_options *fio_options = td->eo;
|
||||||
@ -676,7 +679,8 @@ static int spdk_fio_setup(struct thread_data *td)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_open(struct thread_data *td, struct fio_file *f)
|
static int
|
||||||
|
spdk_fio_open(struct thread_data *td, struct fio_file *f)
|
||||||
{
|
{
|
||||||
struct spdk_fio_qpair *fio_qpair = f->engine_data;
|
struct spdk_fio_qpair *fio_qpair = f->engine_data;
|
||||||
struct spdk_fio_ctrlr *fio_ctrlr = fio_qpair->fio_ctrlr;
|
struct spdk_fio_ctrlr *fio_ctrlr = fio_qpair->fio_ctrlr;
|
||||||
@ -706,7 +710,8 @@ static int spdk_fio_open(struct thread_data *td, struct fio_file *f)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_close(struct thread_data *td, struct fio_file *f)
|
static int
|
||||||
|
spdk_fio_close(struct thread_data *td, struct fio_file *f)
|
||||||
{
|
{
|
||||||
struct spdk_fio_qpair *fio_qpair = f->engine_data;
|
struct spdk_fio_qpair *fio_qpair = f->engine_data;
|
||||||
|
|
||||||
@ -716,18 +721,21 @@ static int spdk_fio_close(struct thread_data *td, struct fio_file *f)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_iomem_alloc(struct thread_data *td, size_t total_mem)
|
static int
|
||||||
|
spdk_fio_iomem_alloc(struct thread_data *td, size_t total_mem)
|
||||||
{
|
{
|
||||||
td->orig_buffer = spdk_dma_zmalloc(total_mem, NVME_IO_ALIGN, NULL);
|
td->orig_buffer = spdk_dma_zmalloc(total_mem, NVME_IO_ALIGN, NULL);
|
||||||
return td->orig_buffer == NULL;
|
return td->orig_buffer == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spdk_fio_iomem_free(struct thread_data *td)
|
static void
|
||||||
|
spdk_fio_iomem_free(struct thread_data *td)
|
||||||
{
|
{
|
||||||
spdk_dma_free(td->orig_buffer);
|
spdk_dma_free(td->orig_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_io_u_init(struct thread_data *td, struct io_u *io_u)
|
static int
|
||||||
|
spdk_fio_io_u_init(struct thread_data *td, struct io_u *io_u)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||||
struct spdk_fio_request *fio_req;
|
struct spdk_fio_request *fio_req;
|
||||||
@ -754,7 +762,8 @@ static int spdk_fio_io_u_init(struct thread_data *td, struct io_u *io_u)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spdk_fio_io_u_free(struct thread_data *td, struct io_u *io_u)
|
static void
|
||||||
|
spdk_fio_io_u_free(struct thread_data *td, struct io_u *io_u)
|
||||||
{
|
{
|
||||||
struct spdk_fio_request *fio_req = io_u->engine_data;
|
struct spdk_fio_request *fio_req = io_u->engine_data;
|
||||||
|
|
||||||
@ -923,7 +932,8 @@ fio_separate_md_verify_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spdk_fio_completion_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
|
static void
|
||||||
|
spdk_fio_completion_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
|
||||||
{
|
{
|
||||||
struct spdk_fio_request *fio_req = ctx;
|
struct spdk_fio_request *fio_req = ctx;
|
||||||
struct spdk_fio_thread *fio_thread = fio_req->fio_thread;
|
struct spdk_fio_thread *fio_thread = fio_req->fio_thread;
|
||||||
@ -1102,7 +1112,8 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
|
|||||||
return FIO_Q_QUEUED;
|
return FIO_Q_QUEUED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct io_u *spdk_fio_event(struct thread_data *td, int event)
|
static struct io_u *
|
||||||
|
spdk_fio_event(struct thread_data *td, int event)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||||
|
|
||||||
@ -1111,8 +1122,9 @@ static struct io_u *spdk_fio_event(struct thread_data *td, int event)
|
|||||||
return fio_thread->iocq[event];
|
return fio_thread->iocq[event];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_getevents(struct thread_data *td, unsigned int min,
|
static int
|
||||||
unsigned int max, const struct timespec *t)
|
spdk_fio_getevents(struct thread_data *td, unsigned int min,
|
||||||
|
unsigned int max, const struct timespec *t)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||||
struct spdk_fio_qpair *fio_qpair = NULL;
|
struct spdk_fio_qpair *fio_qpair = NULL;
|
||||||
@ -1174,7 +1186,8 @@ static int spdk_fio_getevents(struct thread_data *td, unsigned int min,
|
|||||||
return fio_thread->iocq_count;
|
return fio_thread->iocq_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spdk_fio_invalidate(struct thread_data *td, struct fio_file *f)
|
static int
|
||||||
|
spdk_fio_invalidate(struct thread_data *td, struct fio_file *f)
|
||||||
{
|
{
|
||||||
/* TODO: This should probably send a flush to the device, but for now just return successful. */
|
/* TODO: This should probably send a flush to the device, but for now just return successful. */
|
||||||
return 0;
|
return 0;
|
||||||
@ -1387,8 +1400,9 @@ spdk_fio_reset_wp(struct thread_data *td, struct fio_file *f, uint64_t offset, u
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FIO_IOOPS_VERSION >= 30
|
#if FIO_IOOPS_VERSION >= 30
|
||||||
static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
|
static int
|
||||||
unsigned int *max_open_zones)
|
spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *f,
|
||||||
|
unsigned int *max_open_zones)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||||
struct spdk_fio_qpair *fio_qpair = NULL;
|
struct spdk_fio_qpair *fio_qpair = NULL;
|
||||||
@ -1405,7 +1419,8 @@ static int spdk_fio_get_max_open_zones(struct thread_data *td, struct fio_file *
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void spdk_fio_cleanup(struct thread_data *td)
|
static void
|
||||||
|
spdk_fio_cleanup(struct thread_data *td)
|
||||||
{
|
{
|
||||||
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
struct spdk_fio_thread *fio_thread = td->io_ops_data;
|
||||||
struct spdk_fio_qpair *fio_qpair, *fio_qpair_tmp;
|
struct spdk_fio_qpair *fio_qpair, *fio_qpair_tmp;
|
||||||
@ -1713,12 +1728,14 @@ struct ioengine_ops ioengine = {
|
|||||||
.option_struct_size = sizeof(struct spdk_fio_options),
|
.option_struct_size = sizeof(struct spdk_fio_options),
|
||||||
};
|
};
|
||||||
|
|
||||||
static void fio_init fio_spdk_register(void)
|
static void fio_init
|
||||||
|
fio_spdk_register(void)
|
||||||
{
|
{
|
||||||
register_ioengine(&ioengine);
|
register_ioengine(&ioengine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fio_exit fio_spdk_unregister(void)
|
static void fio_exit
|
||||||
|
fio_spdk_unregister(void)
|
||||||
{
|
{
|
||||||
if (g_spdk_env_initialized) {
|
if (g_spdk_env_initialized) {
|
||||||
spdk_env_fini();
|
spdk_env_fini();
|
||||||
|
@ -439,7 +439,8 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -49,12 +49,10 @@ static const char *g_iova_mode = NULL;
|
|||||||
static uint64_t g_timeout_in_us = SPDK_SEC_TO_USEC;
|
static uint64_t g_timeout_in_us = SPDK_SEC_TO_USEC;
|
||||||
static struct spdk_nvme_detach_ctx *g_detach_ctx;
|
static struct spdk_nvme_detach_ctx *g_detach_ctx;
|
||||||
|
|
||||||
static void
|
static void task_complete(struct perf_task *task);
|
||||||
task_complete(struct perf_task *task);
|
|
||||||
|
|
||||||
static void
|
static void timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
|
||||||
timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
|
struct spdk_nvme_qpair *qpair, uint16_t cid);
|
||||||
struct spdk_nvme_qpair *qpair, uint16_t cid);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
register_dev(struct spdk_nvme_ctrlr *ctrlr)
|
register_dev(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
@ -390,7 +388,8 @@ io_loop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(char *program_name)
|
static void
|
||||||
|
usage(char *program_name)
|
||||||
{
|
{
|
||||||
printf("%s options", program_name);
|
printf("%s options", program_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -499,7 +498,8 @@ register_controllers(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -2325,7 +2325,8 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
spdk_nvme_detach_async(ctrlr, &g_detach_ctx);
|
spdk_nvme_detach_async(ctrlr, &g_detach_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -103,7 +103,8 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void
|
||||||
|
usage(void)
|
||||||
{
|
{
|
||||||
printf("NVMe Management Options");
|
printf("NVMe Management Options");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -1583,7 +1584,8 @@ parse_args(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -288,8 +288,7 @@ static TAILQ_HEAD(, trid_entry) g_trid_list = TAILQ_HEAD_INITIALIZER(g_trid_list
|
|||||||
|
|
||||||
static int g_file_optind; /* Index of first filename in argv */
|
static int g_file_optind; /* Index of first filename in argv */
|
||||||
|
|
||||||
static inline void
|
static inline void task_complete(struct perf_task *task);
|
||||||
task_complete(struct perf_task *task);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
perf_set_sock_zcopy(const char *impl_name, bool enable)
|
perf_set_sock_zcopy(const char *impl_name, bool enable)
|
||||||
@ -1700,7 +1699,8 @@ work_fn(void *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(char *program_name)
|
static void
|
||||||
|
usage(char *program_name)
|
||||||
{
|
{
|
||||||
printf("%s options", program_name);
|
printf("%s options", program_name);
|
||||||
#if defined(SPDK_CONFIG_URING) || defined(HAVE_LIBAIO)
|
#if defined(SPDK_CONFIG_URING) || defined(HAVE_LIBAIO)
|
||||||
@ -2820,7 +2820,8 @@ setup_sig_handlers(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct worker_thread *worker, *main_worker;
|
struct worker_thread *worker, *main_worker;
|
||||||
|
@ -328,7 +328,8 @@ cleanup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -99,8 +99,7 @@ struct trid_entry {
|
|||||||
|
|
||||||
static TAILQ_HEAD(, trid_entry) g_trid_list = TAILQ_HEAD_INITIALIZER(g_trid_list);
|
static TAILQ_HEAD(, trid_entry) g_trid_list = TAILQ_HEAD_INITIALIZER(g_trid_list);
|
||||||
|
|
||||||
static inline void
|
static inline void task_complete(struct perf_task *task);
|
||||||
task_complete(struct perf_task *task);
|
|
||||||
static void submit_io(struct ns_worker_ctx *ns_ctx, int queue_depth);
|
static void submit_io(struct ns_worker_ctx *ns_ctx, int queue_depth);
|
||||||
|
|
||||||
static void io_complete(void *ctx, const struct spdk_nvme_cpl *cpl);
|
static void io_complete(void *ctx, const struct spdk_nvme_cpl *cpl);
|
||||||
@ -552,7 +551,8 @@ work_fn(void *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(char *program_name)
|
static void
|
||||||
|
usage(char *program_name)
|
||||||
{
|
{
|
||||||
printf("%s options", program_name);
|
printf("%s options", program_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -1042,7 +1042,8 @@ nvme_poll_ctrlrs(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct worker_thread *worker, *main_worker;
|
struct worker_thread *worker, *main_worker;
|
||||||
|
@ -836,7 +836,8 @@ nvmf_setup_signal_handlers(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
|
@ -69,7 +69,8 @@ hello_sock_usage(void)
|
|||||||
/*
|
/*
|
||||||
* This function is called to parse the parameters that are specific to this application
|
* This function is called to parse the parameters that are specific to this application
|
||||||
*/
|
*/
|
||||||
static int hello_sock_parse_arg(int ch, char *arg)
|
static int
|
||||||
|
hello_sock_parse_arg(int ch, char *arg)
|
||||||
{
|
{
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'H':
|
case 'H':
|
||||||
|
@ -55,7 +55,8 @@ print_device(void *ctx, struct spdk_pci_device *pci_device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct spdk_env_opts opts;
|
struct spdk_env_opts opts;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -165,8 +165,9 @@ struct vring {
|
|||||||
#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
|
#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
|
||||||
#define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num])
|
#define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num])
|
||||||
|
|
||||||
static inline void vring_init(struct vring *vr, unsigned int num, void *p,
|
static inline void
|
||||||
unsigned long align)
|
vring_init(struct vring *vr, unsigned int num, void *p,
|
||||||
|
unsigned long align)
|
||||||
{
|
{
|
||||||
vr->num = num;
|
vr->num = num;
|
||||||
vr->desc = p;
|
vr->desc = p;
|
||||||
@ -176,7 +177,8 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
|
|||||||
+ align - 1) & ~(align - 1));
|
+ align - 1) & ~(align - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned vring_size(unsigned int num, unsigned long align)
|
static inline unsigned
|
||||||
|
vring_size(unsigned int num, unsigned long align)
|
||||||
{
|
{
|
||||||
return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num)
|
return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num)
|
||||||
+ align - 1) & ~(align - 1))
|
+ align - 1) & ~(align - 1))
|
||||||
@ -187,7 +189,8 @@ static inline unsigned vring_size(unsigned int num, unsigned long align)
|
|||||||
/* Assuming a given event_idx value from the other side, if
|
/* Assuming a given event_idx value from the other side, if
|
||||||
* we have just incremented index from old to new_idx,
|
* we have just incremented index from old to new_idx,
|
||||||
* should we trigger an event? */
|
* should we trigger an event? */
|
||||||
static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
|
static inline int
|
||||||
|
vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
|
||||||
{
|
{
|
||||||
/* Note: Xen has similar logic for notification hold-off
|
/* Note: Xen has similar logic for notification hold-off
|
||||||
* in include/xen/interface/io/ring.h with req_event and req_prod
|
* in include/xen/interface/io/ring.h with req_event and req_prod
|
||||||
|
@ -463,8 +463,7 @@ spdk_nvmf_ctrlr_get_subsystem(struct spdk_nvmf_ctrlr *ctrlr);
|
|||||||
*
|
*
|
||||||
* \return The NVMe-oF controller ID
|
* \return The NVMe-oF controller ID
|
||||||
*/
|
*/
|
||||||
uint16_t
|
uint16_t spdk_nvmf_ctrlr_get_id(struct spdk_nvmf_ctrlr *ctrlr);
|
||||||
spdk_nvmf_ctrlr_get_id(struct spdk_nvmf_ctrlr *ctrlr);
|
|
||||||
|
|
||||||
static inline enum spdk_nvme_data_transfer
|
static inline enum spdk_nvme_data_transfer
|
||||||
spdk_nvmf_req_get_xfer(struct spdk_nvmf_request *req) {
|
spdk_nvmf_req_get_xfer(struct spdk_nvmf_request *req) {
|
||||||
|
@ -250,8 +250,9 @@ int spdk_rdma_get_translation(struct spdk_rdma_mem_map *map, void *address,
|
|||||||
* \param translation Memory translation
|
* \param translation Memory translation
|
||||||
* \return Local Memory Key
|
* \return Local Memory Key
|
||||||
*/
|
*/
|
||||||
static inline uint32_t spdk_rdma_memory_translation_get_lkey(struct spdk_rdma_memory_translation
|
static inline uint32_t
|
||||||
*translation)
|
spdk_rdma_memory_translation_get_lkey(struct spdk_rdma_memory_translation
|
||||||
|
*translation)
|
||||||
{
|
{
|
||||||
return translation->translation_type == SPDK_RDMA_TRANSLATION_MR ?
|
return translation->translation_type == SPDK_RDMA_TRANSLATION_MR ?
|
||||||
translation->mr_or_key.mr->lkey : (uint32_t)translation->mr_or_key.key;
|
translation->mr_or_key.mr->lkey : (uint32_t)translation->mr_or_key.key;
|
||||||
@ -264,8 +265,9 @@ static inline uint32_t spdk_rdma_memory_translation_get_lkey(struct spdk_rdma_me
|
|||||||
* \param translation Memory translation
|
* \param translation Memory translation
|
||||||
* \return Remote Memory Key
|
* \return Remote Memory Key
|
||||||
*/
|
*/
|
||||||
static inline uint32_t spdk_rdma_memory_translation_get_rkey(struct spdk_rdma_memory_translation
|
static inline uint32_t
|
||||||
*translation)
|
spdk_rdma_memory_translation_get_rkey(struct spdk_rdma_memory_translation
|
||||||
|
*translation)
|
||||||
{
|
{
|
||||||
return translation->translation_type == SPDK_RDMA_TRANSLATION_MR ?
|
return translation->translation_type == SPDK_RDMA_TRANSLATION_MR ?
|
||||||
translation->mr_or_key.mr->rkey : (uint32_t)translation->mr_or_key.key;
|
translation->mr_or_key.mr->rkey : (uint32_t)translation->mr_or_key.key;
|
||||||
|
@ -464,7 +464,6 @@ int virtio_pci_dev_init(struct virtio_dev *vdev, const char *name,
|
|||||||
* \return the name of the virtio device on success, NULL means it
|
* \return the name of the virtio device on success, NULL means it
|
||||||
* is not a suitable uevent.
|
* is not a suitable uevent.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *virtio_pci_dev_event_process(int fd, uint16_t device_id);
|
||||||
virtio_pci_dev_event_process(int fd, uint16_t device_id);
|
|
||||||
|
|
||||||
#endif /* SPDK_VIRTIO_H */
|
#endif /* SPDK_VIRTIO_H */
|
||||||
|
@ -441,7 +441,8 @@ spdk_accel_submit_decompress(struct spdk_io_channel *ch, void *dst, void *src, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function when when accel modules register with the framework. */
|
/* Helper function when when accel modules register with the framework. */
|
||||||
void spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module)
|
void
|
||||||
|
spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module)
|
||||||
{
|
{
|
||||||
TAILQ_INSERT_TAIL(&spdk_accel_module_list, accel_module, tailq);
|
TAILQ_INSERT_TAIL(&spdk_accel_module_list, accel_module, tailq);
|
||||||
if (accel_module->get_ctx_size && accel_module->get_ctx_size() > g_max_accel_module_size) {
|
if (accel_module->get_ctx_size && accel_module->get_ctx_size() > g_max_accel_module_size) {
|
||||||
@ -924,7 +925,8 @@ sw_accel_destroy_cb(void *io_device, void *ctx_buf)
|
|||||||
spdk_poller_unregister(&sw_ch->completion_poller);
|
spdk_poller_unregister(&sw_ch->completion_poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_io_channel *sw_accel_get_io_channel(void)
|
static struct spdk_io_channel *
|
||||||
|
sw_accel_get_io_channel(void)
|
||||||
{
|
{
|
||||||
return spdk_get_io_channel(&sw_accel_engine);
|
return spdk_get_io_channel(&sw_accel_engine);
|
||||||
}
|
}
|
||||||
|
@ -331,27 +331,23 @@ static void bdev_write_zero_buffer_next(void *_bdev_io);
|
|||||||
static void bdev_enable_qos_msg(struct spdk_io_channel_iter *i);
|
static void bdev_enable_qos_msg(struct spdk_io_channel_iter *i);
|
||||||
static void bdev_enable_qos_done(struct spdk_io_channel_iter *i, int status);
|
static void bdev_enable_qos_done(struct spdk_io_channel_iter *i, int status);
|
||||||
|
|
||||||
static int
|
static int bdev_readv_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||||
bdev_readv_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
struct iovec *iov, int iovcnt, void *md_buf, uint64_t offset_blocks,
|
||||||
struct iovec *iov, int iovcnt, void *md_buf, uint64_t offset_blocks,
|
uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg,
|
||||||
uint64_t num_blocks, spdk_bdev_io_completion_cb cb, void *cb_arg,
|
struct spdk_bdev_ext_io_opts *opts, bool copy_opts);
|
||||||
struct spdk_bdev_ext_io_opts *opts, bool copy_opts);
|
static int bdev_writev_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||||
static int
|
struct iovec *iov, int iovcnt, void *md_buf,
|
||||||
bdev_writev_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
struct iovec *iov, int iovcnt, void *md_buf,
|
spdk_bdev_io_completion_cb cb, void *cb_arg,
|
||||||
uint64_t offset_blocks, uint64_t num_blocks,
|
struct spdk_bdev_ext_io_opts *opts, bool copy_opts);
|
||||||
spdk_bdev_io_completion_cb cb, void *cb_arg,
|
|
||||||
struct spdk_bdev_ext_io_opts *opts, bool copy_opts);
|
|
||||||
|
|
||||||
static int
|
static int bdev_lock_lba_range(struct spdk_bdev_desc *desc, struct spdk_io_channel *_ch,
|
||||||
bdev_lock_lba_range(struct spdk_bdev_desc *desc, struct spdk_io_channel *_ch,
|
uint64_t offset, uint64_t length,
|
||||||
uint64_t offset, uint64_t length,
|
lock_range_cb cb_fn, void *cb_arg);
|
||||||
lock_range_cb cb_fn, void *cb_arg);
|
|
||||||
|
|
||||||
static int
|
static int bdev_unlock_lba_range(struct spdk_bdev_desc *desc, struct spdk_io_channel *_ch,
|
||||||
bdev_unlock_lba_range(struct spdk_bdev_desc *desc, struct spdk_io_channel *_ch,
|
uint64_t offset, uint64_t length,
|
||||||
uint64_t offset, uint64_t length,
|
lock_range_cb cb_fn, void *cb_arg);
|
||||||
lock_range_cb cb_fn, void *cb_arg);
|
|
||||||
|
|
||||||
static inline void bdev_io_complete(void *ctx);
|
static inline void bdev_io_complete(void *ctx);
|
||||||
|
|
||||||
@ -481,8 +477,7 @@ struct spdk_bdev_wait_for_examine_ctx {
|
|||||||
void *cb_arg;
|
void *cb_arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool bdev_module_all_actions_completed(void);
|
||||||
bdev_module_all_actions_completed(void);
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bdev_wait_for_examine_cb(void *arg)
|
bdev_wait_for_examine_cb(void *arg)
|
||||||
@ -2322,14 +2317,11 @@ _to_next_boundary(uint64_t offset, uint32_t boundary)
|
|||||||
return (boundary - (offset % boundary));
|
return (boundary - (offset % boundary));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
|
||||||
bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
|
|
||||||
|
|
||||||
static void
|
static void _bdev_rw_split(void *_bdev_io);
|
||||||
_bdev_rw_split(void *_bdev_io);
|
|
||||||
|
|
||||||
static void
|
static void bdev_unmap_split(struct spdk_bdev_io *bdev_io);
|
||||||
bdev_unmap_split(struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bdev_unmap_split(void *_bdev_io)
|
_bdev_unmap_split(void *_bdev_io)
|
||||||
@ -2337,8 +2329,7 @@ _bdev_unmap_split(void *_bdev_io)
|
|||||||
return bdev_unmap_split((struct spdk_bdev_io *)_bdev_io);
|
return bdev_unmap_split((struct spdk_bdev_io *)_bdev_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bdev_write_zeroes_split(struct spdk_bdev_io *bdev_io);
|
||||||
bdev_write_zeroes_split(struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bdev_write_zeroes_split(void *_bdev_io)
|
_bdev_write_zeroes_split(void *_bdev_io)
|
||||||
@ -2676,8 +2667,8 @@ bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bdev_rw_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
||||||
bdev_rw_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success);
|
bool success);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bdev_io_split(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
bdev_io_split(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
@ -2759,8 +2750,7 @@ _bdev_io_submit(void *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool bdev_lba_range_overlapped(struct lba_range *range1, struct lba_range *range2);
|
||||||
bdev_lba_range_overlapped(struct lba_range *range1, struct lba_range *range2);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
bdev_lba_range_overlapped(struct lba_range *range1, struct lba_range *range2)
|
bdev_lba_range_overlapped(struct lba_range *range1, struct lba_range *range2)
|
||||||
@ -3868,7 +3858,11 @@ _bdev_get_block_size_with_md(const struct spdk_bdev *bdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum spdk_dif_type spdk_bdev_get_dif_type(const struct spdk_bdev *bdev)
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
|
typedef enum spdk_dif_type spdk_dif_type_t;
|
||||||
|
|
||||||
|
spdk_dif_type_t
|
||||||
|
spdk_bdev_get_dif_type(const struct spdk_bdev *bdev)
|
||||||
{
|
{
|
||||||
if (bdev->md_len != 0) {
|
if (bdev->md_len != 0) {
|
||||||
return bdev->dif_type;
|
return bdev->dif_type;
|
||||||
@ -4220,10 +4214,11 @@ bdev_readv_blocks_with_md(struct spdk_bdev_desc *desc, struct spdk_io_channel *c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
int
|
||||||
struct iovec *iov, int iovcnt,
|
spdk_bdev_readv_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||||
uint64_t offset_blocks, uint64_t num_blocks,
|
struct iovec *iov, int iovcnt,
|
||||||
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
uint64_t offset_blocks, uint64_t num_blocks,
|
||||||
|
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||||
{
|
{
|
||||||
return bdev_readv_blocks_with_md(desc, ch, iov, iovcnt, NULL, offset_blocks,
|
return bdev_readv_blocks_with_md(desc, ch, iov, iovcnt, NULL, offset_blocks,
|
||||||
num_blocks, cb, cb_arg, NULL, false);
|
num_blocks, cb, cb_arg, NULL, false);
|
||||||
@ -7311,8 +7306,7 @@ bdev_lock_error_cleanup_cb(struct spdk_io_channel_iter *i, int status)
|
|||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bdev_unlock_lba_range_get_channel(struct spdk_io_channel_iter *i);
|
||||||
bdev_unlock_lba_range_get_channel(struct spdk_io_channel_iter *i);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bdev_lock_lba_range_cb(struct spdk_io_channel_iter *i, int status)
|
bdev_lock_lba_range_cb(struct spdk_io_channel_iter *i, int status)
|
||||||
|
@ -2218,9 +2218,8 @@ blob_persist_dirty_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
|||||||
blob_persist_start(ctx);
|
blob_persist_start(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bs_write_super(spdk_bs_sequence_t *seq, struct spdk_blob_store *bs,
|
||||||
bs_write_super(spdk_bs_sequence_t *seq, struct spdk_blob_store *bs,
|
struct spdk_bs_super_block *super, spdk_bs_sequence_cpl cb_fn, void *cb_arg);
|
||||||
struct spdk_bs_super_block *super, spdk_bs_sequence_cpl cb_fn, void *cb_arg);
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4070,7 +4069,8 @@ bs_load_replay_md_parse_page(struct spdk_bs_load_ctx *ctx, struct spdk_blob_md_p
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bs_load_cur_extent_page_valid(struct spdk_blob_md_page *page)
|
static bool
|
||||||
|
bs_load_cur_extent_page_valid(struct spdk_blob_md_page *page)
|
||||||
{
|
{
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
struct spdk_blob_md_descriptor *desc = (struct spdk_blob_md_descriptor *)page->descriptors;
|
struct spdk_blob_md_descriptor *desc = (struct spdk_blob_md_descriptor *)page->descriptors;
|
||||||
@ -4108,7 +4108,8 @@ static bool bs_load_cur_extent_page_valid(struct spdk_blob_md_page *page)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bs_load_cur_md_page_valid(struct spdk_bs_load_ctx *ctx)
|
static bool
|
||||||
|
bs_load_cur_md_page_valid(struct spdk_bs_load_ctx *ctx)
|
||||||
{
|
{
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
struct spdk_blob_md_page *page = ctx->page;
|
struct spdk_blob_md_page *page = ctx->page;
|
||||||
@ -4128,8 +4129,7 @@ static bool bs_load_cur_md_page_valid(struct spdk_bs_load_ctx *ctx)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bs_load_replay_cur_md_page(struct spdk_bs_load_ctx *ctx);
|
||||||
bs_load_replay_cur_md_page(struct spdk_bs_load_ctx *ctx);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bs_load_write_used_clusters_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
bs_load_write_used_clusters_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
||||||
@ -5540,28 +5540,32 @@ bs_unregister_md_thread(struct spdk_blob_store *bs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_blob_id spdk_blob_get_id(struct spdk_blob *blob)
|
spdk_blob_id
|
||||||
|
spdk_blob_get_id(struct spdk_blob *blob)
|
||||||
{
|
{
|
||||||
assert(blob != NULL);
|
assert(blob != NULL);
|
||||||
|
|
||||||
return blob->id;
|
return blob->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t spdk_blob_get_num_pages(struct spdk_blob *blob)
|
uint64_t
|
||||||
|
spdk_blob_get_num_pages(struct spdk_blob *blob)
|
||||||
{
|
{
|
||||||
assert(blob != NULL);
|
assert(blob != NULL);
|
||||||
|
|
||||||
return bs_cluster_to_page(blob->bs, blob->active.num_clusters);
|
return bs_cluster_to_page(blob->bs, blob->active.num_clusters);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t spdk_blob_get_num_io_units(struct spdk_blob *blob)
|
uint64_t
|
||||||
|
spdk_blob_get_num_io_units(struct spdk_blob *blob)
|
||||||
{
|
{
|
||||||
assert(blob != NULL);
|
assert(blob != NULL);
|
||||||
|
|
||||||
return spdk_blob_get_num_pages(blob) * bs_io_unit_per_page(blob->bs);
|
return spdk_blob_get_num_pages(blob) * bs_io_unit_per_page(blob->bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t spdk_blob_get_num_clusters(struct spdk_blob *blob)
|
uint64_t
|
||||||
|
spdk_blob_get_num_clusters(struct spdk_blob *blob)
|
||||||
{
|
{
|
||||||
assert(blob != NULL);
|
assert(blob != NULL);
|
||||||
|
|
||||||
@ -5742,14 +5746,16 @@ bs_create_blob(struct spdk_blob_store *bs,
|
|||||||
blob_persist(seq, blob, bs_create_blob_cpl, blob);
|
blob_persist(seq, blob, bs_create_blob_cpl, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_create_blob(struct spdk_blob_store *bs,
|
void
|
||||||
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
spdk_bs_create_blob(struct spdk_blob_store *bs,
|
||||||
|
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
bs_create_blob(bs, NULL, NULL, cb_fn, cb_arg);
|
bs_create_blob(bs, NULL, NULL, cb_fn, cb_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_create_blob_ext(struct spdk_blob_store *bs, const struct spdk_blob_opts *opts,
|
void
|
||||||
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
spdk_bs_create_blob_ext(struct spdk_blob_store *bs, const struct spdk_blob_opts *opts,
|
||||||
|
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
bs_create_blob(bs, opts, NULL, cb_fn, cb_arg);
|
bs_create_blob(bs, opts, NULL, cb_fn, cb_arg);
|
||||||
}
|
}
|
||||||
@ -6132,9 +6138,10 @@ bs_snapshot_origblob_open_cpl(void *cb_arg, struct spdk_blob *_blob, int bserrno
|
|||||||
bs_snapshot_newblob_create_cpl, ctx);
|
bs_snapshot_newblob_create_cpl, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_create_snapshot(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
void
|
||||||
const struct spdk_blob_xattr_opts *snapshot_xattrs,
|
spdk_bs_create_snapshot(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||||
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
const struct spdk_blob_xattr_opts *snapshot_xattrs,
|
||||||
|
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_clone_snapshot_ctx *ctx = calloc(1, sizeof(*ctx));
|
struct spdk_clone_snapshot_ctx *ctx = calloc(1, sizeof(*ctx));
|
||||||
|
|
||||||
@ -6241,9 +6248,10 @@ bs_clone_origblob_open_cpl(void *cb_arg, struct spdk_blob *_blob, int bserrno)
|
|||||||
bs_clone_newblob_create_cpl, ctx);
|
bs_clone_newblob_create_cpl, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_create_clone(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
void
|
||||||
const struct spdk_blob_xattr_opts *clone_xattrs,
|
spdk_bs_create_clone(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||||
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
const struct spdk_blob_xattr_opts *clone_xattrs,
|
||||||
|
spdk_blob_op_with_id_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_clone_snapshot_ctx *ctx = calloc(1, sizeof(*ctx));
|
struct spdk_clone_snapshot_ctx *ctx = calloc(1, sizeof(*ctx));
|
||||||
|
|
||||||
@ -7249,14 +7257,16 @@ bs_open_blob(struct spdk_blob_store *bs,
|
|||||||
blob_load(seq, blob, bs_open_blob_cpl, blob);
|
blob_load(seq, blob, bs_open_blob_cpl, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_open_blob(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
void
|
||||||
spdk_blob_op_with_handle_complete cb_fn, void *cb_arg)
|
spdk_bs_open_blob(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||||
|
spdk_blob_op_with_handle_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
bs_open_blob(bs, blobid, NULL, cb_fn, cb_arg);
|
bs_open_blob(bs, blobid, NULL, cb_fn, cb_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_open_blob_ext(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
void
|
||||||
struct spdk_blob_open_opts *opts, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg)
|
spdk_bs_open_blob_ext(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
||||||
|
struct spdk_blob_open_opts *opts, spdk_blob_op_with_handle_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
bs_open_blob(bs, blobid, opts, cb_fn, cb_arg);
|
bs_open_blob(bs, blobid, opts, cb_fn, cb_arg);
|
||||||
}
|
}
|
||||||
@ -7264,7 +7274,8 @@ void spdk_bs_open_blob_ext(struct spdk_blob_store *bs, spdk_blob_id blobid,
|
|||||||
/* END spdk_bs_open_blob */
|
/* END spdk_bs_open_blob */
|
||||||
|
|
||||||
/* START spdk_blob_set_read_only */
|
/* START spdk_blob_set_read_only */
|
||||||
int spdk_blob_set_read_only(struct spdk_blob *blob)
|
int
|
||||||
|
spdk_blob_set_read_only(struct spdk_blob *blob)
|
||||||
{
|
{
|
||||||
blob_verify_md_op(blob);
|
blob_verify_md_op(blob);
|
||||||
|
|
||||||
@ -7503,7 +7514,8 @@ blob_close_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
|
|||||||
bs_sequence_finish(seq, bserrno);
|
bs_sequence_finish(seq, bserrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_close(struct spdk_blob *blob, spdk_blob_op_complete cb_fn, void *cb_arg)
|
void
|
||||||
|
spdk_blob_close(struct spdk_blob *blob, spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_bs_cpl cpl;
|
struct spdk_bs_cpl cpl;
|
||||||
spdk_bs_sequence_t *seq;
|
spdk_bs_sequence_t *seq;
|
||||||
@ -7538,51 +7550,58 @@ struct spdk_io_channel *spdk_bs_alloc_io_channel(struct spdk_blob_store *bs)
|
|||||||
return spdk_get_io_channel(bs);
|
return spdk_get_io_channel(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_bs_free_io_channel(struct spdk_io_channel *channel)
|
void
|
||||||
|
spdk_bs_free_io_channel(struct spdk_io_channel *channel)
|
||||||
{
|
{
|
||||||
spdk_put_io_channel(channel);
|
spdk_put_io_channel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_unmap(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg)
|
spdk_blob_io_unmap(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
|
uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_op(blob, channel, NULL, offset, length, cb_fn, cb_arg,
|
blob_request_submit_op(blob, channel, NULL, offset, length, cb_fn, cb_arg,
|
||||||
SPDK_BLOB_UNMAP);
|
SPDK_BLOB_UNMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_write_zeroes(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg)
|
spdk_blob_io_write_zeroes(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
|
uint64_t offset, uint64_t length, spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_op(blob, channel, NULL, offset, length, cb_fn, cb_arg,
|
blob_request_submit_op(blob, channel, NULL, offset, length, cb_fn, cb_arg,
|
||||||
SPDK_BLOB_WRITE_ZEROES);
|
SPDK_BLOB_WRITE_ZEROES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_write(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
void *payload, uint64_t offset, uint64_t length,
|
spdk_blob_io_write(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
spdk_blob_op_complete cb_fn, void *cb_arg)
|
void *payload, uint64_t offset, uint64_t length,
|
||||||
|
spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_op(blob, channel, payload, offset, length, cb_fn, cb_arg,
|
blob_request_submit_op(blob, channel, payload, offset, length, cb_fn, cb_arg,
|
||||||
SPDK_BLOB_WRITE);
|
SPDK_BLOB_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_read(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
void *payload, uint64_t offset, uint64_t length,
|
spdk_blob_io_read(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
spdk_blob_op_complete cb_fn, void *cb_arg)
|
void *payload, uint64_t offset, uint64_t length,
|
||||||
|
spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_op(blob, channel, payload, offset, length, cb_fn, cb_arg,
|
blob_request_submit_op(blob, channel, payload, offset, length, cb_fn, cb_arg,
|
||||||
SPDK_BLOB_READ);
|
SPDK_BLOB_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_writev(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length,
|
spdk_blob_io_writev(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
spdk_blob_op_complete cb_fn, void *cb_arg)
|
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length,
|
||||||
|
spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_rw_iov(blob, channel, iov, iovcnt, offset, length, cb_fn, cb_arg, false, NULL);
|
blob_request_submit_rw_iov(blob, channel, iov, iovcnt, offset, length, cb_fn, cb_arg, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_blob_io_readv(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
void
|
||||||
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length,
|
spdk_blob_io_readv(struct spdk_blob *blob, struct spdk_io_channel *channel,
|
||||||
spdk_blob_op_complete cb_fn, void *cb_arg)
|
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length,
|
||||||
|
spdk_blob_op_complete cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
blob_request_submit_rw_iov(blob, channel, iov, iovcnt, offset, length, cb_fn, cb_arg, true, NULL);
|
blob_request_submit_rw_iov(blob, channel, iov, iovcnt, offset, length, cb_fn, cb_arg, true, NULL);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,11 @@ spdk_memory_domain_get_context(struct spdk_memory_domain *domain)
|
|||||||
return domain->ctx;
|
return domain->ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum spdk_dma_device_type spdk_memory_domain_get_dma_device_type(struct spdk_memory_domain *domain)
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
|
typedef enum spdk_dma_device_type spdk_dma_device_type_t;
|
||||||
|
|
||||||
|
spdk_dma_device_type_t
|
||||||
|
spdk_memory_domain_get_dma_device_type(struct spdk_memory_domain *domain)
|
||||||
{
|
{
|
||||||
assert(domain);
|
assert(domain);
|
||||||
|
|
||||||
|
@ -295,22 +295,26 @@ spdk_process_is_primary(void)
|
|||||||
return (rte_eal_process_type() == RTE_PROC_PRIMARY);
|
return (rte_eal_process_type() == RTE_PROC_PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t spdk_get_ticks(void)
|
uint64_t
|
||||||
|
spdk_get_ticks(void)
|
||||||
{
|
{
|
||||||
return rte_get_timer_cycles();
|
return rte_get_timer_cycles();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t spdk_get_ticks_hz(void)
|
uint64_t
|
||||||
|
spdk_get_ticks_hz(void)
|
||||||
{
|
{
|
||||||
return rte_get_timer_hz();
|
return rte_get_timer_hz();
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_delay_us(unsigned int us)
|
void
|
||||||
|
spdk_delay_us(unsigned int us)
|
||||||
{
|
{
|
||||||
rte_delay_us(us);
|
rte_delay_us(us);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_pause(void)
|
void
|
||||||
|
spdk_pause(void)
|
||||||
{
|
{
|
||||||
rte_pause();
|
rte_pause();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ err:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void env_mpool_destroy(struct env_mpool *mpool)
|
void
|
||||||
|
env_mpool_destroy(struct env_mpool *mpool)
|
||||||
{
|
{
|
||||||
if (mpool) {
|
if (mpool) {
|
||||||
int i;
|
int i;
|
||||||
@ -83,8 +84,9 @@ void env_mpool_destroy(struct env_mpool *mpool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static env_allocator *env_mpool_get_allocator(struct env_mpool *mpool,
|
static env_allocator *
|
||||||
uint32_t count)
|
env_mpool_get_allocator(struct env_mpool *mpool,
|
||||||
|
uint32_t count)
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
|
||||||
@ -105,7 +107,8 @@ static env_allocator *env_mpool_get_allocator(struct env_mpool *mpool,
|
|||||||
return mpool->allocator[idx];
|
return mpool->allocator[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
void *env_mpool_new(struct env_mpool *mpool, uint32_t count)
|
void *
|
||||||
|
env_mpool_new(struct env_mpool *mpool, uint32_t count)
|
||||||
{
|
{
|
||||||
void *items = NULL;
|
void *items = NULL;
|
||||||
env_allocator *allocator;
|
env_allocator *allocator;
|
||||||
@ -122,8 +125,9 @@ void *env_mpool_new(struct env_mpool *mpool, uint32_t count)
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool env_mpool_del(struct env_mpool *mpool,
|
bool
|
||||||
void *items, uint32_t count)
|
env_mpool_del(struct env_mpool *mpool,
|
||||||
|
void *items, uint32_t count)
|
||||||
{
|
{
|
||||||
env_allocator *allocator;
|
env_allocator *allocator;
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ env_crc32(uint32_t crc, uint8_t const *message, size_t len)
|
|||||||
/* EXECUTION CONTEXTS */
|
/* EXECUTION CONTEXTS */
|
||||||
pthread_mutex_t *exec_context_mutex;
|
pthread_mutex_t *exec_context_mutex;
|
||||||
|
|
||||||
static void __attribute__((constructor)) init_execution_context(void)
|
static void
|
||||||
|
__attribute__((constructor)) init_execution_context(void)
|
||||||
{
|
{
|
||||||
unsigned count = env_get_execution_context_count();
|
unsigned count = env_get_execution_context_count();
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -127,7 +128,8 @@ static void __attribute__((constructor)) init_execution_context(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((destructor)) deinit_execution_context(void)
|
static void
|
||||||
|
__attribute__((destructor)) deinit_execution_context(void)
|
||||||
{
|
{
|
||||||
unsigned count = env_get_execution_context_count();
|
unsigned count = env_get_execution_context_count();
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -146,7 +148,8 @@ static void __attribute__((destructor)) deinit_execution_context(void)
|
|||||||
* we simulate this behavior by acquiring per execution context mutex. As a
|
* we simulate this behavior by acquiring per execution context mutex. As a
|
||||||
* result the caller might actually get preempted, but no other thread will
|
* result the caller might actually get preempted, but no other thread will
|
||||||
* execute in this context by the time the caller puts current execution ctx. */
|
* execute in this context by the time the caller puts current execution ctx. */
|
||||||
unsigned env_get_execution_context(void)
|
unsigned
|
||||||
|
env_get_execution_context(void)
|
||||||
{
|
{
|
||||||
unsigned cpu;
|
unsigned cpu;
|
||||||
|
|
||||||
@ -158,12 +161,14 @@ unsigned env_get_execution_context(void)
|
|||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void env_put_execution_context(unsigned ctx)
|
void
|
||||||
|
env_put_execution_context(unsigned ctx)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&exec_context_mutex[ctx]);
|
pthread_mutex_unlock(&exec_context_mutex[ctx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned env_get_execution_context_count(void)
|
unsigned
|
||||||
|
env_get_execution_context_count(void)
|
||||||
{
|
{
|
||||||
int num = sysconf(_SC_NPROCESSORS_ONLN);
|
int num = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
|
||||||
|
@ -91,30 +91,35 @@ typedef uint64_t sector_t;
|
|||||||
|
|
||||||
#define container_of(ptr, type, member) SPDK_CONTAINEROF(ptr, type, member)
|
#define container_of(ptr, type, member) SPDK_CONTAINEROF(ptr, type, member)
|
||||||
|
|
||||||
static inline void *env_malloc(size_t size, int flags)
|
static inline void *
|
||||||
|
env_malloc(size_t size, int flags)
|
||||||
{
|
{
|
||||||
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
SPDK_MALLOC_DMA);
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_zalloc(size_t size, int flags)
|
static inline void *
|
||||||
|
env_zalloc(size_t size, int flags)
|
||||||
{
|
{
|
||||||
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
SPDK_MALLOC_DMA);
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_free(const void *ptr)
|
static inline void
|
||||||
|
env_free(const void *ptr)
|
||||||
{
|
{
|
||||||
return spdk_free((void *)ptr);
|
return spdk_free((void *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_vmalloc(size_t size)
|
static inline void *
|
||||||
|
env_vmalloc(size_t size)
|
||||||
{
|
{
|
||||||
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
return spdk_malloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
SPDK_MALLOC_DMA);
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_vzalloc(size_t size)
|
static inline void *
|
||||||
|
env_vzalloc(size_t size)
|
||||||
{
|
{
|
||||||
/* TODO: raw_ram init can request huge amount of memory to store
|
/* TODO: raw_ram init can request huge amount of memory to store
|
||||||
* hashtable in it. need to ensure that allocation succeeds */
|
* hashtable in it. need to ensure that allocation succeeds */
|
||||||
@ -122,28 +127,33 @@ static inline void *env_vzalloc(size_t size)
|
|||||||
SPDK_MALLOC_DMA);
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_vzalloc_flags(size_t size, int flags)
|
static inline void *
|
||||||
|
env_vzalloc_flags(size_t size, int flags)
|
||||||
{
|
{
|
||||||
return env_vzalloc(size);
|
return env_vzalloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *env_secure_alloc(size_t size)
|
static inline void *
|
||||||
|
env_secure_alloc(size_t size)
|
||||||
{
|
{
|
||||||
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
return spdk_zmalloc(size, 0, NULL, SPDK_ENV_LCORE_ID_ANY,
|
||||||
SPDK_MALLOC_DMA);
|
SPDK_MALLOC_DMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_secure_free(const void *ptr, size_t size)
|
static inline void
|
||||||
|
env_secure_free(const void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
return spdk_free((void *)ptr);
|
return spdk_free((void *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_vfree(const void *ptr)
|
static inline void
|
||||||
|
env_vfree(const void *ptr)
|
||||||
{
|
{
|
||||||
return spdk_free((void *)ptr);
|
return spdk_free((void *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_get_free_memory(void)
|
static inline uint64_t
|
||||||
|
env_get_free_memory(void)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -177,33 +187,39 @@ typedef struct {
|
|||||||
pthread_mutex_t m;
|
pthread_mutex_t m;
|
||||||
} env_mutex;
|
} env_mutex;
|
||||||
|
|
||||||
static inline int env_mutex_init(env_mutex *mutex)
|
static inline int
|
||||||
|
env_mutex_init(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
return !!pthread_mutex_init(&mutex->m, NULL);
|
return !!pthread_mutex_init(&mutex->m, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_mutex_lock(env_mutex *mutex)
|
static inline void
|
||||||
|
env_mutex_lock(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_mutex_lock(&mutex->m));
|
ENV_BUG_ON(pthread_mutex_lock(&mutex->m));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_mutex_lock_interruptible(env_mutex *mutex)
|
static inline int
|
||||||
|
env_mutex_lock_interruptible(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
env_mutex_lock(mutex);
|
env_mutex_lock(mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_mutex_trylock(env_mutex *mutex)
|
static inline int
|
||||||
|
env_mutex_trylock(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
return pthread_mutex_trylock(&mutex->m) ? -OCF_ERR_NO_LOCK : 0;
|
return pthread_mutex_trylock(&mutex->m) ? -OCF_ERR_NO_LOCK : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_mutex_unlock(env_mutex *mutex)
|
static inline void
|
||||||
|
env_mutex_unlock(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_mutex_unlock(&mutex->m));
|
ENV_BUG_ON(pthread_mutex_unlock(&mutex->m));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_mutex_is_locked(env_mutex *mutex)
|
static inline int
|
||||||
|
env_mutex_is_locked(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
if (env_mutex_trylock(mutex) == 0) {
|
if (env_mutex_trylock(mutex) == 0) {
|
||||||
env_mutex_unlock(mutex);
|
env_mutex_unlock(mutex);
|
||||||
@ -213,7 +229,8 @@ static inline int env_mutex_is_locked(env_mutex *mutex)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_mutex_destroy(env_mutex *mutex)
|
static inline int
|
||||||
|
env_mutex_destroy(env_mutex *mutex)
|
||||||
{
|
{
|
||||||
if (pthread_mutex_destroy(&mutex->m)) {
|
if (pthread_mutex_destroy(&mutex->m)) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -226,7 +243,8 @@ static inline int env_mutex_destroy(env_mutex *mutex)
|
|||||||
|
|
||||||
typedef env_mutex env_rmutex;
|
typedef env_mutex env_rmutex;
|
||||||
|
|
||||||
static inline int env_rmutex_init(env_rmutex *rmutex)
|
static inline int
|
||||||
|
env_rmutex_init(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
|
|
||||||
@ -237,32 +255,38 @@ static inline int env_rmutex_init(env_rmutex *rmutex)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rmutex_lock(env_rmutex *rmutex)
|
static inline void
|
||||||
|
env_rmutex_lock(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
env_mutex_lock(rmutex);
|
env_mutex_lock(rmutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rmutex_lock_interruptible(env_rmutex *rmutex)
|
static inline int
|
||||||
|
env_rmutex_lock_interruptible(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
return env_mutex_lock_interruptible(rmutex);
|
return env_mutex_lock_interruptible(rmutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rmutex_trylock(env_rmutex *rmutex)
|
static inline int
|
||||||
|
env_rmutex_trylock(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
return env_mutex_trylock(rmutex);
|
return env_mutex_trylock(rmutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rmutex_unlock(env_rmutex *rmutex)
|
static inline void
|
||||||
|
env_rmutex_unlock(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
env_mutex_unlock(rmutex);
|
env_mutex_unlock(rmutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rmutex_is_locked(env_rmutex *rmutex)
|
static inline int
|
||||||
|
env_rmutex_is_locked(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
return env_mutex_is_locked(rmutex);
|
return env_mutex_is_locked(rmutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rmutex_destroy(env_rmutex *rmutex)
|
static inline int
|
||||||
|
env_rmutex_destroy(env_rmutex *rmutex)
|
||||||
{
|
{
|
||||||
return env_mutex_destroy(rmutex);
|
return env_mutex_destroy(rmutex);
|
||||||
}
|
}
|
||||||
@ -272,42 +296,50 @@ typedef struct {
|
|||||||
pthread_rwlock_t lock;
|
pthread_rwlock_t lock;
|
||||||
} env_rwsem;
|
} env_rwsem;
|
||||||
|
|
||||||
static inline int env_rwsem_init(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_init(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return !!pthread_rwlock_init(&s->lock, NULL);
|
return !!pthread_rwlock_init(&s->lock, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwsem_up_read(env_rwsem *s)
|
static inline void
|
||||||
|
env_rwsem_up_read(env_rwsem *s)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_unlock(&s->lock));
|
ENV_BUG_ON(pthread_rwlock_unlock(&s->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwsem_down_read(env_rwsem *s)
|
static inline void
|
||||||
|
env_rwsem_down_read(env_rwsem *s)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_rdlock(&s->lock));
|
ENV_BUG_ON(pthread_rwlock_rdlock(&s->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rwsem_down_read_trylock(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_down_read_trylock(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return pthread_rwlock_tryrdlock(&s->lock) ? -OCF_ERR_NO_LOCK : 0;
|
return pthread_rwlock_tryrdlock(&s->lock) ? -OCF_ERR_NO_LOCK : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwsem_up_write(env_rwsem *s)
|
static inline void
|
||||||
|
env_rwsem_up_write(env_rwsem *s)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_unlock(&s->lock));
|
ENV_BUG_ON(pthread_rwlock_unlock(&s->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwsem_down_write(env_rwsem *s)
|
static inline void
|
||||||
|
env_rwsem_down_write(env_rwsem *s)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_wrlock(&s->lock));
|
ENV_BUG_ON(pthread_rwlock_wrlock(&s->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rwsem_down_write_trylock(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_down_write_trylock(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return pthread_rwlock_trywrlock(&s->lock) ? -OCF_ERR_NO_LOCK : 0;
|
return pthread_rwlock_trywrlock(&s->lock) ? -OCF_ERR_NO_LOCK : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rwsem_is_locked(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_is_locked(env_rwsem *s)
|
||||||
{
|
{
|
||||||
if (env_rwsem_down_read_trylock(s) == 0) {
|
if (env_rwsem_down_read_trylock(s) == 0) {
|
||||||
env_rwsem_up_read(s);
|
env_rwsem_up_read(s);
|
||||||
@ -317,16 +349,19 @@ static inline int env_rwsem_is_locked(env_rwsem *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rwsem_down_read_interruptible(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_down_read_interruptible(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return pthread_rwlock_rdlock(&s->lock);
|
return pthread_rwlock_rdlock(&s->lock);
|
||||||
}
|
}
|
||||||
static inline int env_rwsem_down_write_interruptible(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_down_write_interruptible(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return pthread_rwlock_wrlock(&s->lock);
|
return pthread_rwlock_wrlock(&s->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_rwsem_destroy(env_rwsem *s)
|
static inline int
|
||||||
|
env_rwsem_destroy(env_rwsem *s)
|
||||||
{
|
{
|
||||||
return pthread_rwlock_destroy(&s->lock);
|
return pthread_rwlock_destroy(&s->lock);
|
||||||
}
|
}
|
||||||
@ -352,77 +387,92 @@ typedef long env_atomic64;
|
|||||||
|
|
||||||
#define atomic_cmpxchg __sync_val_compare_and_swap
|
#define atomic_cmpxchg __sync_val_compare_and_swap
|
||||||
|
|
||||||
static inline int env_atomic_read(const env_atomic *a)
|
static inline int
|
||||||
|
env_atomic_read(const env_atomic *a)
|
||||||
{
|
{
|
||||||
return atomic_read(a);
|
return atomic_read(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic_set(env_atomic *a, int i)
|
static inline void
|
||||||
|
env_atomic_set(env_atomic *a, int i)
|
||||||
{
|
{
|
||||||
atomic_set(a, i);
|
atomic_set(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic_add(int i, env_atomic *a)
|
static inline void
|
||||||
|
env_atomic_add(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
atomic_add(a, i);
|
atomic_add(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic_sub(int i, env_atomic *a)
|
static inline void
|
||||||
|
env_atomic_sub(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
atomic_sub(a, i);
|
atomic_sub(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool env_atomic_sub_and_test(int i, env_atomic *a)
|
static inline bool
|
||||||
|
env_atomic_sub_and_test(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_sub_and_fetch(a, i) == 0;
|
return __sync_sub_and_fetch(a, i) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic_inc(env_atomic *a)
|
static inline void
|
||||||
|
env_atomic_inc(env_atomic *a)
|
||||||
{
|
{
|
||||||
atomic_inc(a);
|
atomic_inc(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic_dec(env_atomic *a)
|
static inline void
|
||||||
|
env_atomic_dec(env_atomic *a)
|
||||||
{
|
{
|
||||||
atomic_dec(a);
|
atomic_dec(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool env_atomic_dec_and_test(env_atomic *a)
|
static inline bool
|
||||||
|
env_atomic_dec_and_test(env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_sub_and_fetch(a, 1) == 0;
|
return __sync_sub_and_fetch(a, 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool env_atomic_inc_and_test(env_atomic *a)
|
static inline bool
|
||||||
|
env_atomic_inc_and_test(env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_add_and_fetch(a, 1) == 0;
|
return __sync_add_and_fetch(a, 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_add_return(int i, env_atomic *a)
|
static inline int
|
||||||
|
env_atomic_add_return(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_add_and_fetch(a, i);
|
return __sync_add_and_fetch(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_sub_return(int i, env_atomic *a)
|
static inline int
|
||||||
|
env_atomic_sub_return(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_sub_and_fetch(a, i);
|
return __sync_sub_and_fetch(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_inc_return(env_atomic *a)
|
static inline int
|
||||||
|
env_atomic_inc_return(env_atomic *a)
|
||||||
{
|
{
|
||||||
return env_atomic_add_return(1, a);
|
return env_atomic_add_return(1, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_dec_return(env_atomic *a)
|
static inline int
|
||||||
|
env_atomic_dec_return(env_atomic *a)
|
||||||
{
|
{
|
||||||
return env_atomic_sub_return(1, a);
|
return env_atomic_sub_return(1, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_cmpxchg(env_atomic *a, int old, int new_value)
|
static inline int
|
||||||
|
env_atomic_cmpxchg(env_atomic *a, int old, int new_value)
|
||||||
{
|
{
|
||||||
return atomic_cmpxchg(a, old, new_value);
|
return atomic_cmpxchg(a, old, new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic_add_unless(env_atomic *a, int i, int u)
|
static inline int
|
||||||
|
env_atomic_add_unless(env_atomic *a, int i, int u)
|
||||||
{
|
{
|
||||||
int c, old;
|
int c, old;
|
||||||
c = env_atomic_read(a);
|
c = env_atomic_read(a);
|
||||||
@ -439,57 +489,68 @@ static inline int env_atomic_add_unless(env_atomic *a, int i, int u)
|
|||||||
return c != (u);
|
return c != (u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long env_atomic64_read(const env_atomic64 *a)
|
static inline long
|
||||||
|
env_atomic64_read(const env_atomic64 *a)
|
||||||
{
|
{
|
||||||
return atomic_read(a);
|
return atomic_read(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic64_set(env_atomic64 *a, long i)
|
static inline void
|
||||||
|
env_atomic64_set(env_atomic64 *a, long i)
|
||||||
{
|
{
|
||||||
atomic_set(a, i);
|
atomic_set(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic64_add(long i, env_atomic64 *a)
|
static inline void
|
||||||
|
env_atomic64_add(long i, env_atomic64 *a)
|
||||||
{
|
{
|
||||||
atomic_add(a, i);
|
atomic_add(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic64_sub(long i, env_atomic64 *a)
|
static inline void
|
||||||
|
env_atomic64_sub(long i, env_atomic64 *a)
|
||||||
{
|
{
|
||||||
atomic_sub(a, i);
|
atomic_sub(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic64_inc(env_atomic64 *a)
|
static inline void
|
||||||
|
env_atomic64_inc(env_atomic64 *a)
|
||||||
{
|
{
|
||||||
atomic_inc(a);
|
atomic_inc(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_atomic64_dec(env_atomic64 *a)
|
static inline void
|
||||||
|
env_atomic64_dec(env_atomic64 *a)
|
||||||
{
|
{
|
||||||
atomic_dec(a);
|
atomic_dec(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic64_add_return(int i, env_atomic *a)
|
static inline int
|
||||||
|
env_atomic64_add_return(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_add_and_fetch(a, i);
|
return __sync_add_and_fetch(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic64_sub_return(int i, env_atomic *a)
|
static inline int
|
||||||
|
env_atomic64_sub_return(int i, env_atomic *a)
|
||||||
{
|
{
|
||||||
return __sync_sub_and_fetch(a, i);
|
return __sync_sub_and_fetch(a, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic64_inc_return(env_atomic *a)
|
static inline int
|
||||||
|
env_atomic64_inc_return(env_atomic *a)
|
||||||
{
|
{
|
||||||
return env_atomic64_add_return(1, a);
|
return env_atomic64_add_return(1, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_atomic64_dec_return(env_atomic *a)
|
static inline int
|
||||||
|
env_atomic64_dec_return(env_atomic *a)
|
||||||
{
|
{
|
||||||
return env_atomic_sub_return(1, a);
|
return env_atomic_sub_return(1, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline long env_atomic64_cmpxchg(env_atomic64 *a, long old, long new)
|
static inline long
|
||||||
|
env_atomic64_cmpxchg(env_atomic64 *a, long old, long new)
|
||||||
{
|
{
|
||||||
return atomic_cmpxchg(a, old, new);
|
return atomic_cmpxchg(a, old, new);
|
||||||
}
|
}
|
||||||
@ -499,22 +560,26 @@ typedef struct completion {
|
|||||||
sem_t sem;
|
sem_t sem;
|
||||||
} env_completion;
|
} env_completion;
|
||||||
|
|
||||||
static inline void env_completion_init(env_completion *completion)
|
static inline void
|
||||||
|
env_completion_init(env_completion *completion)
|
||||||
{
|
{
|
||||||
sem_init(&completion->sem, 0, 0);
|
sem_init(&completion->sem, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_completion_wait(env_completion *completion)
|
static inline void
|
||||||
|
env_completion_wait(env_completion *completion)
|
||||||
{
|
{
|
||||||
sem_wait(&completion->sem);
|
sem_wait(&completion->sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_completion_complete(env_completion *completion)
|
static inline void
|
||||||
|
env_completion_complete(env_completion *completion)
|
||||||
{
|
{
|
||||||
sem_post(&completion->sem);
|
sem_post(&completion->sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_completion_destroy(env_completion *completion)
|
static inline void
|
||||||
|
env_completion_destroy(env_completion *completion)
|
||||||
{
|
{
|
||||||
sem_destroy(&completion->sem);
|
sem_destroy(&completion->sem);
|
||||||
}
|
}
|
||||||
@ -525,22 +590,26 @@ typedef struct {
|
|||||||
pthread_spinlock_t lock;
|
pthread_spinlock_t lock;
|
||||||
} env_spinlock;
|
} env_spinlock;
|
||||||
|
|
||||||
static inline int env_spinlock_init(env_spinlock *l)
|
static inline int
|
||||||
|
env_spinlock_init(env_spinlock *l)
|
||||||
{
|
{
|
||||||
return pthread_spin_init(&l->lock, 0);
|
return pthread_spin_init(&l->lock, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_spinlock_trylock(env_spinlock *l)
|
static inline int
|
||||||
|
env_spinlock_trylock(env_spinlock *l)
|
||||||
{
|
{
|
||||||
return pthread_spin_trylock(&l->lock) ? -OCF_ERR_NO_LOCK : 0;
|
return pthread_spin_trylock(&l->lock) ? -OCF_ERR_NO_LOCK : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_spinlock_lock(env_spinlock *l)
|
static inline void
|
||||||
|
env_spinlock_lock(env_spinlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_spin_lock(&l->lock));
|
ENV_BUG_ON(pthread_spin_lock(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_spinlock_unlock(env_spinlock *l)
|
static inline void
|
||||||
|
env_spinlock_unlock(env_spinlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_spin_unlock(&l->lock));
|
ENV_BUG_ON(pthread_spin_unlock(&l->lock));
|
||||||
}
|
}
|
||||||
@ -553,7 +622,8 @@ static inline void env_spinlock_unlock(env_spinlock *l)
|
|||||||
(void)flags; \
|
(void)flags; \
|
||||||
env_spinlock_unlock(l)
|
env_spinlock_unlock(l)
|
||||||
|
|
||||||
static inline void env_spinlock_destroy(env_spinlock *l)
|
static inline void
|
||||||
|
env_spinlock_destroy(env_spinlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_spin_destroy(&l->lock));
|
ENV_BUG_ON(pthread_spin_destroy(&l->lock));
|
||||||
}
|
}
|
||||||
@ -564,37 +634,44 @@ typedef struct {
|
|||||||
pthread_rwlock_t lock;
|
pthread_rwlock_t lock;
|
||||||
} env_rwlock;
|
} env_rwlock;
|
||||||
|
|
||||||
static inline void env_rwlock_init(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_init(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_init(&l->lock, NULL));
|
ENV_BUG_ON(pthread_rwlock_init(&l->lock, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwlock_read_lock(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_read_lock(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_rdlock(&l->lock));
|
ENV_BUG_ON(pthread_rwlock_rdlock(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwlock_read_unlock(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_read_unlock(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_unlock(&l->lock));
|
ENV_BUG_ON(pthread_rwlock_unlock(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwlock_write_lock(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_write_lock(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_wrlock(&l->lock));
|
ENV_BUG_ON(pthread_rwlock_wrlock(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwlock_write_unlock(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_write_unlock(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_unlock(&l->lock));
|
ENV_BUG_ON(pthread_rwlock_unlock(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_rwlock_destroy(env_rwlock *l)
|
static inline void
|
||||||
|
env_rwlock_destroy(env_rwlock *l)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(pthread_rwlock_destroy(&l->lock));
|
ENV_BUG_ON(pthread_rwlock_destroy(&l->lock));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_bit_set(int nr, volatile void *addr)
|
static inline void
|
||||||
|
env_bit_set(int nr, volatile void *addr)
|
||||||
{
|
{
|
||||||
char *byte = (char *)addr + (nr >> 3);
|
char *byte = (char *)addr + (nr >> 3);
|
||||||
char mask = 1 << (nr & 7);
|
char mask = 1 << (nr & 7);
|
||||||
@ -602,7 +679,8 @@ static inline void env_bit_set(int nr, volatile void *addr)
|
|||||||
__sync_or_and_fetch(byte, mask);
|
__sync_or_and_fetch(byte, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_bit_clear(int nr, volatile void *addr)
|
static inline void
|
||||||
|
env_bit_clear(int nr, volatile void *addr)
|
||||||
{
|
{
|
||||||
char *byte = (char *)addr + (nr >> 3);
|
char *byte = (char *)addr + (nr >> 3);
|
||||||
char mask = 1 << (nr & 7);
|
char mask = 1 << (nr & 7);
|
||||||
@ -610,7 +688,8 @@ static inline void env_bit_clear(int nr, volatile void *addr)
|
|||||||
__sync_and_and_fetch(byte, ~mask);
|
__sync_and_and_fetch(byte, ~mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool env_bit_test(int nr, const volatile unsigned long *addr)
|
static inline bool
|
||||||
|
env_bit_test(int nr, const volatile unsigned long *addr)
|
||||||
{
|
{
|
||||||
const char *byte = (char *)addr + (nr >> 3);
|
const char *byte = (char *)addr + (nr >> 3);
|
||||||
char mask = 1 << (nr & 7);
|
char mask = 1 << (nr & 7);
|
||||||
@ -624,12 +703,14 @@ typedef struct {
|
|||||||
sem_t sem;
|
sem_t sem;
|
||||||
} env_waitqueue;
|
} env_waitqueue;
|
||||||
|
|
||||||
static inline void env_waitqueue_init(env_waitqueue *w)
|
static inline void
|
||||||
|
env_waitqueue_init(env_waitqueue *w)
|
||||||
{
|
{
|
||||||
sem_init(&w->sem, 0, 0);
|
sem_init(&w->sem, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_waitqueue_wake_up(env_waitqueue *w)
|
static inline void
|
||||||
|
env_waitqueue_wake_up(env_waitqueue *w)
|
||||||
{
|
{
|
||||||
sem_post(&w->sem);
|
sem_post(&w->sem);
|
||||||
}
|
}
|
||||||
@ -645,43 +726,51 @@ static inline void env_waitqueue_wake_up(env_waitqueue *w)
|
|||||||
/* *** SCHEDULING *** */
|
/* *** SCHEDULING *** */
|
||||||
|
|
||||||
/* CAS does not need this while in user-space */
|
/* CAS does not need this while in user-space */
|
||||||
static inline void env_schedule(void)
|
static inline void
|
||||||
|
env_schedule(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#define env_cond_resched env_schedule
|
#define env_cond_resched env_schedule
|
||||||
|
|
||||||
static inline int env_in_interrupt(void)
|
static inline int
|
||||||
|
env_in_interrupt(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_get_tick_count(void)
|
static inline uint64_t
|
||||||
|
env_get_tick_count(void)
|
||||||
{
|
{
|
||||||
return spdk_get_ticks();
|
return spdk_get_ticks();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_ticks_to_secs(uint64_t j)
|
static inline uint64_t
|
||||||
|
env_ticks_to_secs(uint64_t j)
|
||||||
{
|
{
|
||||||
return j / spdk_get_ticks_hz();
|
return j / spdk_get_ticks_hz();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_ticks_to_msecs(uint64_t j)
|
static inline uint64_t
|
||||||
|
env_ticks_to_msecs(uint64_t j)
|
||||||
{
|
{
|
||||||
return env_ticks_to_secs(j) * 1000;
|
return env_ticks_to_secs(j) * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_ticks_to_nsecs(uint64_t j)
|
static inline uint64_t
|
||||||
|
env_ticks_to_nsecs(uint64_t j)
|
||||||
{
|
{
|
||||||
return env_ticks_to_secs(j) * 1000 * 1000;
|
return env_ticks_to_secs(j) * 1000 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_ticks_to_usecs(uint64_t j)
|
static inline uint64_t
|
||||||
|
env_ticks_to_usecs(uint64_t j)
|
||||||
{
|
{
|
||||||
return env_ticks_to_secs(j) * 1000 * 1000 * 1000;
|
return env_ticks_to_secs(j) * 1000 * 1000 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t env_secs_to_ticks(uint64_t j)
|
static inline uint64_t
|
||||||
|
env_secs_to_ticks(uint64_t j)
|
||||||
{
|
{
|
||||||
return j * spdk_get_ticks_hz();
|
return j * spdk_get_ticks_hz();
|
||||||
}
|
}
|
||||||
@ -691,7 +780,8 @@ static inline uint64_t env_secs_to_ticks(uint64_t j)
|
|||||||
/* 512 KB is sufficient amount of memory for OCF operations */
|
/* 512 KB is sufficient amount of memory for OCF operations */
|
||||||
#define ENV_MAX_MEM (512 * 1024)
|
#define ENV_MAX_MEM (512 * 1024)
|
||||||
|
|
||||||
static inline int env_memset(void *dest, size_t len, uint8_t value)
|
static inline int
|
||||||
|
env_memset(void *dest, size_t len, uint8_t value)
|
||||||
{
|
{
|
||||||
if (dest == NULL || len == 0) {
|
if (dest == NULL || len == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -701,7 +791,8 @@ static inline int env_memset(void *dest, size_t len, uint8_t value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_memcpy(void *dest, size_t dmax, const void *src, size_t len)
|
static inline int
|
||||||
|
env_memcpy(void *dest, size_t dmax, const void *src, size_t len)
|
||||||
{
|
{
|
||||||
if (dest == NULL || src == NULL) {
|
if (dest == NULL || src == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -717,8 +808,9 @@ static inline int env_memcpy(void *dest, size_t dmax, const void *src, size_t le
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_memcmp(const void *aptr, size_t dmax, const void *bptr, size_t len,
|
static inline int
|
||||||
int *diff)
|
env_memcmp(const void *aptr, size_t dmax, const void *bptr, size_t len,
|
||||||
|
int *diff)
|
||||||
{
|
{
|
||||||
if (diff == NULL || aptr == NULL || bptr == NULL) {
|
if (diff == NULL || aptr == NULL || bptr == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -737,12 +829,14 @@ static inline int env_memcmp(const void *aptr, size_t dmax, const void *bptr, si
|
|||||||
/* 4096 is sufficient max length for any OCF operation on string */
|
/* 4096 is sufficient max length for any OCF operation on string */
|
||||||
#define ENV_MAX_STR (4 * 1024)
|
#define ENV_MAX_STR (4 * 1024)
|
||||||
|
|
||||||
static inline size_t env_strnlen(const char *src, size_t dmax)
|
static inline size_t
|
||||||
|
env_strnlen(const char *src, size_t dmax)
|
||||||
{
|
{
|
||||||
return strnlen(src, dmax);
|
return strnlen(src, dmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int env_strncpy(char *dest, size_t dmax, const char *src, size_t len)
|
static inline int
|
||||||
|
env_strncpy(char *dest, size_t dmax, const char *src, size_t len)
|
||||||
{
|
{
|
||||||
if (dest == NULL || src == NULL) {
|
if (dest == NULL || src == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -762,7 +856,8 @@ static inline int env_strncpy(char *dest, size_t dmax, const char *src, size_t l
|
|||||||
|
|
||||||
#define env_strncmp(s1, slen1, s2, slen2) strncmp(s1, s2, min(slen1, slen2))
|
#define env_strncmp(s1, slen1, s2, slen2) strncmp(s1, s2, min(slen1, slen2))
|
||||||
|
|
||||||
static inline char *env_strdup(const char *src, int flags)
|
static inline char *
|
||||||
|
env_strdup(const char *src, int flags)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *ret;
|
char *ret;
|
||||||
@ -783,19 +878,22 @@ static inline char *env_strdup(const char *src, int flags)
|
|||||||
|
|
||||||
/* *** SORTING *** */
|
/* *** SORTING *** */
|
||||||
|
|
||||||
static inline void env_sort(void *base, size_t num, size_t size,
|
static inline void
|
||||||
int (*cmp_fn)(const void *, const void *),
|
env_sort(void *base, size_t num, size_t size,
|
||||||
void (*swap_fn)(void *, void *, int size))
|
int (*cmp_fn)(const void *, const void *),
|
||||||
|
void (*swap_fn)(void *, void *, int size))
|
||||||
{
|
{
|
||||||
qsort(base, num, size, cmp_fn);
|
qsort(base, num, size, cmp_fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_msleep(uint64_t n)
|
static inline void
|
||||||
|
env_msleep(uint64_t n)
|
||||||
{
|
{
|
||||||
usleep(n * 1000);
|
usleep(n * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void env_touch_softlockup_wd(void)
|
static inline void
|
||||||
|
env_touch_softlockup_wd(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ struct list_head {
|
|||||||
* @param it list entry to be added
|
* @param it list entry to be added
|
||||||
* @param l1 list main node (head)
|
* @param l1 list main node (head)
|
||||||
*/
|
*/
|
||||||
static inline void list_add(struct list_head *it, struct list_head *l1)
|
static inline void
|
||||||
|
list_add(struct list_head *it, struct list_head *l1)
|
||||||
{
|
{
|
||||||
it->prev = l1;
|
it->prev = l1;
|
||||||
it->next = l1->next;
|
it->next = l1->next;
|
||||||
@ -41,7 +42,8 @@ static inline void list_add(struct list_head *it, struct list_head *l1)
|
|||||||
* @param it list entry to be added
|
* @param it list entry to be added
|
||||||
* @param l1 list main node (head)
|
* @param l1 list main node (head)
|
||||||
*/
|
*/
|
||||||
static inline void list_add_tail(struct list_head *it, struct list_head *l1)
|
static inline void
|
||||||
|
list_add_tail(struct list_head *it, struct list_head *l1)
|
||||||
{
|
{
|
||||||
it->prev = l1->prev;
|
it->prev = l1->prev;
|
||||||
it->next = l1;
|
it->next = l1;
|
||||||
@ -53,7 +55,8 @@ static inline void list_add_tail(struct list_head *it, struct list_head *l1)
|
|||||||
/**
|
/**
|
||||||
* check if a list is empty (return true)
|
* check if a list is empty (return true)
|
||||||
*/
|
*/
|
||||||
static inline int list_empty(struct list_head *it)
|
static inline int
|
||||||
|
list_empty(struct list_head *it)
|
||||||
{
|
{
|
||||||
return it->next == it;
|
return it->next == it;
|
||||||
}
|
}
|
||||||
@ -61,21 +64,24 @@ static inline int list_empty(struct list_head *it)
|
|||||||
/**
|
/**
|
||||||
* delete an entry from a list
|
* delete an entry from a list
|
||||||
*/
|
*/
|
||||||
static inline void list_del(struct list_head *it)
|
static inline void
|
||||||
|
list_del(struct list_head *it)
|
||||||
{
|
{
|
||||||
it->next->prev = it->prev;
|
it->next->prev = it->prev;
|
||||||
it->prev->next = it->next;
|
it->prev->next = it->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_move_tail(struct list_head *list,
|
static inline void
|
||||||
struct list_head *head)
|
list_move_tail(struct list_head *list,
|
||||||
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
list_del(list);
|
list_del(list);
|
||||||
list_add_tail(list, head);
|
list_add_tail(list, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_move(struct list_head *list,
|
static inline void
|
||||||
struct list_head *head)
|
list_move(struct list_head *list,
|
||||||
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
list_del(list);
|
list_del(list);
|
||||||
list_add(list, head);
|
list_add(list, head);
|
||||||
|
@ -419,7 +419,8 @@ ftl_io_alloc_child(struct ftl_io *parent)
|
|||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ftl_io_fail(struct ftl_io *io, int status)
|
void
|
||||||
|
ftl_io_fail(struct ftl_io *io, int status)
|
||||||
{
|
{
|
||||||
io->status = status;
|
io->status = status;
|
||||||
ftl_io_advance(io, io->num_blocks - io->pos);
|
ftl_io_advance(io, io->num_blocks - io->pos);
|
||||||
|
@ -108,12 +108,9 @@ struct ftl_restore {
|
|||||||
struct ftl_nv_cache_restore nv_cache;
|
struct ftl_nv_cache_restore nv_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int ftl_restore_tail_md(struct ftl_restore_band *rband);
|
||||||
ftl_restore_tail_md(struct ftl_restore_band *rband);
|
static void ftl_pad_zone_cb(struct ftl_io *io, void *arg, int status);
|
||||||
static void
|
static void ftl_restore_pad_band(struct ftl_restore_band *rband);
|
||||||
ftl_pad_zone_cb(struct ftl_io *io, void *arg, int status);
|
|
||||||
static void
|
|
||||||
ftl_restore_pad_band(struct ftl_restore_band *rband);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ftl_restore_free(struct ftl_restore *restore)
|
ftl_restore_free(struct ftl_restore *restore)
|
||||||
|
@ -229,7 +229,8 @@ ioat_prep_fill(struct spdk_ioat_chan *ioat, uint64_t dst,
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ioat_reset_hw(struct spdk_ioat_chan *ioat)
|
static int
|
||||||
|
ioat_reset_hw(struct spdk_ioat_chan *ioat)
|
||||||
{
|
{
|
||||||
int timeout;
|
int timeout;
|
||||||
uint64_t status;
|
uint64_t status;
|
||||||
|
@ -92,7 +92,8 @@ _iscsi_conns_cleanup(void)
|
|||||||
free(g_conns_array);
|
free(g_conns_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
int initialize_iscsi_conns(void)
|
int
|
||||||
|
initialize_iscsi_conns(void)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
@ -502,7 +502,8 @@ end:
|
|||||||
return iovcnt - sgl.iovcnt;
|
return iovcnt - sgl.iovcnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_free_sess(struct spdk_iscsi_sess *sess)
|
void
|
||||||
|
iscsi_free_sess(struct spdk_iscsi_sess *sess)
|
||||||
{
|
{
|
||||||
if (sess == NULL) {
|
if (sess == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -2449,7 +2450,8 @@ iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iscsi_conn_logout_pdu_complete(void *arg)
|
static void
|
||||||
|
iscsi_conn_logout_pdu_complete(void *arg)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_conn *conn = arg;
|
struct spdk_iscsi_conn *conn = arg;
|
||||||
|
|
||||||
@ -2809,9 +2811,10 @@ iscsi_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
|
void
|
||||||
struct spdk_scsi_lun *lun,
|
iscsi_clear_all_transfer_task(struct spdk_iscsi_conn *conn,
|
||||||
struct spdk_iscsi_pdu *pdu)
|
struct spdk_scsi_lun *lun,
|
||||||
|
struct spdk_iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_task *task, *task_tmp;
|
struct spdk_iscsi_task *task, *task_tmp;
|
||||||
struct spdk_iscsi_pdu *pdu_tmp;
|
struct spdk_iscsi_pdu *pdu_tmp;
|
||||||
@ -3072,8 +3075,9 @@ iscsi_transfer_in(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task)
|
|||||||
return sent_status;
|
return sent_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_task_response(struct spdk_iscsi_conn *conn,
|
void
|
||||||
struct spdk_iscsi_task *task)
|
iscsi_task_response(struct spdk_iscsi_conn *conn,
|
||||||
|
struct spdk_iscsi_task *task)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_pdu *rsp_pdu;
|
struct spdk_iscsi_pdu *rsp_pdu;
|
||||||
struct iscsi_bhs_scsi_resp *rsph;
|
struct iscsi_bhs_scsi_resp *rsph;
|
||||||
|
@ -185,7 +185,8 @@ iscsi_free_pools(void)
|
|||||||
spdk_mempool_free(iscsi->task_pool);
|
spdk_mempool_free(iscsi->task_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_put_pdu(struct spdk_iscsi_pdu *pdu)
|
void
|
||||||
|
iscsi_put_pdu(struct spdk_iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
if (!pdu) {
|
if (!pdu) {
|
||||||
return;
|
return;
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include "spdk/stdinc.h"
|
#include "spdk/stdinc.h"
|
||||||
#include "iscsi/md5.h"
|
#include "iscsi/md5.h"
|
||||||
|
|
||||||
int md5init(struct spdk_md5ctx *md5ctx)
|
int
|
||||||
|
md5init(struct spdk_md5ctx *md5ctx)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -29,7 +30,8 @@ int md5init(struct spdk_md5ctx *md5ctx)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int md5final(void *md5, struct spdk_md5ctx *md5ctx)
|
int
|
||||||
|
md5final(void *md5, struct spdk_md5ctx *md5ctx)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -42,7 +44,8 @@ int md5final(void *md5, struct spdk_md5ctx *md5ctx)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int md5update(struct spdk_md5ctx *md5ctx, const void *data, size_t len)
|
int
|
||||||
|
md5update(struct spdk_md5ctx *md5ctx, const void *data, size_t len)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -32,28 +32,20 @@ struct iscsi_param {
|
|||||||
int state_index;
|
int state_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void iscsi_param_free(struct iscsi_param *params);
|
||||||
iscsi_param_free(struct iscsi_param *params);
|
|
||||||
struct iscsi_param *
|
struct iscsi_param *
|
||||||
iscsi_param_find(struct iscsi_param *params, const char *key);
|
iscsi_param_find(struct iscsi_param *params, const char *key);
|
||||||
int
|
int iscsi_param_del(struct iscsi_param **params, const char *key);
|
||||||
iscsi_param_del(struct iscsi_param **params, const char *key);
|
int iscsi_param_add(struct iscsi_param **params, const char *key,
|
||||||
int
|
const char *val, const char *list, int type);
|
||||||
iscsi_param_add(struct iscsi_param **params, const char *key,
|
int iscsi_param_set(struct iscsi_param *params, const char *key,
|
||||||
const char *val, const char *list, int type);
|
const char *val);
|
||||||
int
|
int iscsi_param_set_int(struct iscsi_param *params, const char *key, uint32_t val);
|
||||||
iscsi_param_set(struct iscsi_param *params, const char *key,
|
int iscsi_parse_params(struct iscsi_param **params, const uint8_t *data,
|
||||||
const char *val);
|
int len, bool cbit_enabled, char **partial_parameter);
|
||||||
int
|
char *iscsi_param_get_val(struct iscsi_param *params, const char *key);
|
||||||
iscsi_param_set_int(struct iscsi_param *params, const char *key, uint32_t val);
|
int iscsi_param_eq_val(struct iscsi_param *params, const char *key,
|
||||||
int
|
const char *val);
|
||||||
iscsi_parse_params(struct iscsi_param **params, const uint8_t *data,
|
|
||||||
int len, bool cbit_enabled, char **partial_parameter);
|
|
||||||
char *
|
|
||||||
iscsi_param_get_val(struct iscsi_param *params, const char *key);
|
|
||||||
int
|
|
||||||
iscsi_param_eq_val(struct iscsi_param *params, const char *key,
|
|
||||||
const char *val);
|
|
||||||
|
|
||||||
int iscsi_negotiate_params(struct spdk_iscsi_conn *conn,
|
int iscsi_negotiate_params(struct spdk_iscsi_conn *conn,
|
||||||
struct iscsi_param **params_p, uint8_t *data,
|
struct iscsi_param **params_p, uint8_t *data,
|
||||||
|
@ -201,9 +201,8 @@ iscsi_init_grp_allow_iscsi_name(struct spdk_iscsi_init_grp *igp,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_iscsi_pg_map *
|
static struct spdk_iscsi_pg_map *iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target,
|
||||||
iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target,
|
struct spdk_iscsi_portal_grp *pg);
|
||||||
struct spdk_iscsi_portal_grp *pg);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
iscsi_tgt_node_access(struct spdk_iscsi_conn *conn,
|
iscsi_tgt_node_access(struct spdk_iscsi_conn *conn,
|
||||||
@ -1220,8 +1219,9 @@ iscsi_tgt_node_cleanup_luns(struct spdk_iscsi_conn *conn,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_tgt_node_delete_map(struct spdk_iscsi_portal_grp *portal_group,
|
void
|
||||||
struct spdk_iscsi_init_grp *initiator_group)
|
iscsi_tgt_node_delete_map(struct spdk_iscsi_portal_grp *portal_group,
|
||||||
|
struct spdk_iscsi_init_grp *initiator_group)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_tgt_node *target;
|
struct spdk_iscsi_tgt_node *target;
|
||||||
|
|
||||||
|
@ -661,70 +661,80 @@ spdk_json_write_val(struct spdk_json_write_ctx *w, const struct spdk_json_val *v
|
|||||||
return fail(w);
|
return fail(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_null(struct spdk_json_write_ctx *w, const char *name)
|
int
|
||||||
|
spdk_json_write_named_null(struct spdk_json_write_ctx *w, const char *name)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
return rc ? rc : spdk_json_write_null(w);
|
return rc ? rc : spdk_json_write_null(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_bool(struct spdk_json_write_ctx *w, const char *name, bool val)
|
int
|
||||||
|
spdk_json_write_named_bool(struct spdk_json_write_ctx *w, const char *name, bool val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_bool(w, val);
|
return rc ? rc : spdk_json_write_bool(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_uint8(struct spdk_json_write_ctx *w, const char *name, uint8_t val)
|
int
|
||||||
|
spdk_json_write_named_uint8(struct spdk_json_write_ctx *w, const char *name, uint8_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_uint8(w, val);
|
return rc ? rc : spdk_json_write_uint8(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_uint16(struct spdk_json_write_ctx *w, const char *name, uint16_t val)
|
int
|
||||||
|
spdk_json_write_named_uint16(struct spdk_json_write_ctx *w, const char *name, uint16_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_uint16(w, val);
|
return rc ? rc : spdk_json_write_uint16(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_int32(struct spdk_json_write_ctx *w, const char *name, int32_t val)
|
int
|
||||||
|
spdk_json_write_named_int32(struct spdk_json_write_ctx *w, const char *name, int32_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_int32(w, val);
|
return rc ? rc : spdk_json_write_int32(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_uint32(struct spdk_json_write_ctx *w, const char *name, uint32_t val)
|
int
|
||||||
|
spdk_json_write_named_uint32(struct spdk_json_write_ctx *w, const char *name, uint32_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_uint32(w, val);
|
return rc ? rc : spdk_json_write_uint32(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_int64(struct spdk_json_write_ctx *w, const char *name, int64_t val)
|
int
|
||||||
|
spdk_json_write_named_int64(struct spdk_json_write_ctx *w, const char *name, int64_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_int64(w, val);
|
return rc ? rc : spdk_json_write_int64(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_uint64(struct spdk_json_write_ctx *w, const char *name, uint64_t val)
|
int
|
||||||
|
spdk_json_write_named_uint64(struct spdk_json_write_ctx *w, const char *name, uint64_t val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_uint64(w, val);
|
return rc ? rc : spdk_json_write_uint64(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_string(struct spdk_json_write_ctx *w, const char *name, const char *val)
|
int
|
||||||
|
spdk_json_write_named_string(struct spdk_json_write_ctx *w, const char *name, const char *val)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_string(w, val);
|
return rc ? rc : spdk_json_write_string(w, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_string_fmt(struct spdk_json_write_ctx *w, const char *name,
|
int
|
||||||
const char *fmt, ...)
|
spdk_json_write_named_string_fmt(struct spdk_json_write_ctx *w, const char *name,
|
||||||
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int rc;
|
int rc;
|
||||||
@ -736,8 +746,9 @@ int spdk_json_write_named_string_fmt(struct spdk_json_write_ctx *w, const char *
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_string_fmt_v(struct spdk_json_write_ctx *w, const char *name,
|
int
|
||||||
const char *fmt, va_list args)
|
spdk_json_write_named_string_fmt_v(struct spdk_json_write_ctx *w, const char *name,
|
||||||
|
const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int rc;
|
int rc;
|
||||||
@ -767,14 +778,16 @@ spdk_json_write_named_bytearray(struct spdk_json_write_ctx *w, const char *name,
|
|||||||
return rc ? rc : spdk_json_write_bytearray(w, val, len);
|
return rc ? rc : spdk_json_write_bytearray(w, val, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_array_begin(struct spdk_json_write_ctx *w, const char *name)
|
int
|
||||||
|
spdk_json_write_named_array_begin(struct spdk_json_write_ctx *w, const char *name)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
return rc ? rc : spdk_json_write_array_begin(w);
|
return rc ? rc : spdk_json_write_array_begin(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_json_write_named_object_begin(struct spdk_json_write_ctx *w, const char *name)
|
int
|
||||||
|
spdk_json_write_named_object_begin(struct spdk_json_write_ctx *w, const char *name)
|
||||||
{
|
{
|
||||||
int rc = spdk_json_write_name(w, name);
|
int rc = spdk_json_write_name(w, name);
|
||||||
|
|
||||||
|
@ -355,8 +355,9 @@ spdk_jsonrpc_client_poll(struct spdk_jsonrpc_client *client, int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_jsonrpc_client_send_request(struct spdk_jsonrpc_client *client,
|
int
|
||||||
struct spdk_jsonrpc_client_request *req)
|
spdk_jsonrpc_client_send_request(struct spdk_jsonrpc_client *client,
|
||||||
|
struct spdk_jsonrpc_client_request *req)
|
||||||
{
|
{
|
||||||
if (client->request != NULL) {
|
if (client->request != NULL) {
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
@ -100,10 +100,8 @@ static void *g_fini_cb_arg;
|
|||||||
|
|
||||||
static void _nbd_fini(void *arg1);
|
static void _nbd_fini(void *arg1);
|
||||||
|
|
||||||
static int
|
static int nbd_submit_bdev_io(struct spdk_nbd_disk *nbd, struct nbd_io *io);
|
||||||
nbd_submit_bdev_io(struct spdk_nbd_disk *nbd, struct nbd_io *io);
|
static int nbd_io_recv_internal(struct spdk_nbd_disk *nbd);
|
||||||
static int
|
|
||||||
nbd_io_recv_internal(struct spdk_nbd_disk *nbd);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nbd_init(void)
|
spdk_nbd_init(void)
|
||||||
|
@ -674,7 +674,8 @@ nvme_ctrlr_set_intel_support_log_pages_done(void *arg, const struct spdk_nvme_cp
|
|||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvme_ctrlr_set_intel_support_log_pages(struct spdk_nvme_ctrlr *ctrlr)
|
static int
|
||||||
|
nvme_ctrlr_set_intel_support_log_pages(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct intel_log_pages_ctx *ctx;
|
struct intel_log_pages_ctx *ctx;
|
||||||
@ -4929,7 +4930,8 @@ spdk_nvme_ctrlr_unmap_pmr(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_nvme_ctrlr_read_boot_partition_start(struct spdk_nvme_ctrlr *ctrlr, void *payload,
|
int
|
||||||
|
spdk_nvme_ctrlr_read_boot_partition_start(struct spdk_nvme_ctrlr *ctrlr, void *payload,
|
||||||
uint32_t bprsz, uint32_t bprof, uint32_t bpid)
|
uint32_t bprsz, uint32_t bprof, uint32_t bpid)
|
||||||
{
|
{
|
||||||
union spdk_nvme_bprsel_register bprsel;
|
union spdk_nvme_bprsel_register bprsel;
|
||||||
@ -4986,7 +4988,8 @@ int spdk_nvme_ctrlr_read_boot_partition_start(struct spdk_nvme_ctrlr *ctrlr, voi
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_nvme_ctrlr_read_boot_partition_poll(struct spdk_nvme_ctrlr *ctrlr)
|
int
|
||||||
|
spdk_nvme_ctrlr_read_boot_partition_poll(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
union spdk_nvme_bpinfo_register bpinfo;
|
union spdk_nvme_bpinfo_register bpinfo;
|
||||||
@ -5092,9 +5095,10 @@ nvme_write_boot_partition_cb(void *arg, const struct spdk_nvme_cpl *cpl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_nvme_ctrlr_write_boot_partition(struct spdk_nvme_ctrlr *ctrlr,
|
int
|
||||||
void *payload, uint32_t size, uint32_t bpid,
|
spdk_nvme_ctrlr_write_boot_partition(struct spdk_nvme_ctrlr *ctrlr,
|
||||||
spdk_nvme_cmd_cb cb_fn, void *cb_arg)
|
void *payload, uint32_t size, uint32_t bpid,
|
||||||
|
spdk_nvme_cmd_cb cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
@ -379,10 +379,11 @@ spdk_nvme_ctrlr_cmd_get_feature_ns(struct spdk_nvme_ctrlr *ctrlr, uint8_t featur
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_nvme_ctrlr_cmd_set_feature_ns(struct spdk_nvme_ctrlr *ctrlr, uint8_t feature,
|
int
|
||||||
uint32_t cdw11, uint32_t cdw12, void *payload,
|
spdk_nvme_ctrlr_cmd_set_feature_ns(struct spdk_nvme_ctrlr *ctrlr, uint8_t feature,
|
||||||
uint32_t payload_size, spdk_nvme_cmd_cb cb_fn,
|
uint32_t cdw11, uint32_t cdw12, void *payload,
|
||||||
void *cb_arg, uint32_t ns_id)
|
uint32_t payload_size, spdk_nvme_cmd_cb cb_fn,
|
||||||
|
void *cb_arg, uint32_t ns_id)
|
||||||
{
|
{
|
||||||
struct nvme_request *req;
|
struct nvme_request *req;
|
||||||
struct spdk_nvme_cmd *cmd;
|
struct spdk_nvme_cmd *cmd;
|
||||||
|
@ -828,7 +828,8 @@ cuse_ns_ioctl(fuse_req_t req, int cmd, void *arg,
|
|||||||
* CUSE threads initialization.
|
* CUSE threads initialization.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void cuse_open(fuse_req_t req, struct fuse_file_info *fi)
|
static void
|
||||||
|
cuse_open(fuse_req_t req, struct fuse_file_info *fi)
|
||||||
{
|
{
|
||||||
fuse_reply_open(req, fi);
|
fuse_reply_open(req, fi);
|
||||||
}
|
}
|
||||||
@ -843,7 +844,8 @@ static const struct cuse_lowlevel_ops cuse_ns_clop = {
|
|||||||
.ioctl = cuse_ns_ioctl,
|
.ioctl = cuse_ns_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cuse_session_create(struct cuse_device *cuse_device)
|
static int
|
||||||
|
cuse_session_create(struct cuse_device *cuse_device)
|
||||||
{
|
{
|
||||||
char *cuse_argv[] = { "cuse", "-f" };
|
char *cuse_argv[] = { "cuse", "-f" };
|
||||||
int multithreaded;
|
int multithreaded;
|
||||||
|
@ -324,7 +324,12 @@ spdk_nvme_ns_get_data(struct spdk_nvme_ns *ns)
|
|||||||
return _nvme_ns_get_data(ns);
|
return _nvme_ns_get_data(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum spdk_nvme_dealloc_logical_block_read_value spdk_nvme_ns_get_dealloc_logical_block_read_value(
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
|
typedef enum spdk_nvme_dealloc_logical_block_read_value
|
||||||
|
spdk_nvme_dealloc_logical_block_read_value_t;
|
||||||
|
|
||||||
|
spdk_nvme_dealloc_logical_block_read_value_t
|
||||||
|
spdk_nvme_ns_get_dealloc_logical_block_read_value(
|
||||||
struct spdk_nvme_ns *ns)
|
struct spdk_nvme_ns *ns)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_ctrlr *ctrlr = ns->ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr = ns->ctrlr;
|
||||||
@ -492,8 +497,9 @@ spdk_nvme_ns_get_ana_state(const struct spdk_nvme_ns *ns) {
|
|||||||
return ns->ana_state;
|
return ns->ana_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
|
int
|
||||||
struct spdk_nvme_ctrlr *ctrlr)
|
nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
|
||||||
|
struct spdk_nvme_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -530,7 +536,8 @@ int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvme_ns_destruct(struct spdk_nvme_ns *ns)
|
void
|
||||||
|
nvme_ns_destruct(struct spdk_nvme_ns *ns)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_ns_data *nsdata;
|
struct spdk_nvme_ns_data *nsdata;
|
||||||
|
|
||||||
|
@ -1320,7 +1320,8 @@ opal_lock_unlock_range(struct spdk_opal_dev *dev, struct opal_session *sess,
|
|||||||
return opal_parse_and_check_status(sess);
|
return opal_parse_and_check_status(sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opal_generic_locking_range_enable_disable(struct spdk_opal_dev *dev,
|
static int
|
||||||
|
opal_generic_locking_range_enable_disable(struct spdk_opal_dev *dev,
|
||||||
struct opal_session *sess,
|
struct opal_session *sess,
|
||||||
uint8_t *uid, bool read_lock_enabled, bool write_lock_enabled)
|
uint8_t *uid, bool read_lock_enabled, bool write_lock_enabled)
|
||||||
{
|
{
|
||||||
|
@ -873,9 +873,10 @@ nvme_pcie_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
static struct spdk_nvme_ctrlr *
|
||||||
const struct spdk_nvme_ctrlr_opts *opts,
|
nvme_pcie_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
||||||
void *devhandle)
|
const struct spdk_nvme_ctrlr_opts *opts,
|
||||||
|
void *devhandle)
|
||||||
{
|
{
|
||||||
struct spdk_pci_device *pci_dev = devhandle;
|
struct spdk_pci_device *pci_dev = devhandle;
|
||||||
struct nvme_pcie_ctrlr *pctrlr;
|
struct nvme_pcie_ctrlr *pctrlr;
|
||||||
|
@ -21,8 +21,8 @@ __thread struct nvme_pcie_ctrlr *g_thread_mmio_ctrlr = NULL;
|
|||||||
|
|
||||||
static struct spdk_nvme_pcie_stat g_dummy_stat = {};
|
static struct spdk_nvme_pcie_stat g_dummy_stat = {};
|
||||||
|
|
||||||
static void
|
static void nvme_pcie_fail_request_bad_vtophys(struct spdk_nvme_qpair *qpair,
|
||||||
nvme_pcie_fail_request_bad_vtophys(struct spdk_nvme_qpair *qpair, struct nvme_tracker *tr);
|
struct nvme_tracker *tr);
|
||||||
|
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
nvme_pcie_vtophys(struct spdk_nvme_ctrlr *ctrlr, const void *buf, uint64_t *size)
|
nvme_pcie_vtophys(struct spdk_nvme_ctrlr *ctrlr, const void *buf, uint64_t *size)
|
||||||
|
@ -2194,9 +2194,13 @@ nvme_rdma_ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr)
|
|||||||
|
|
||||||
static int nvme_rdma_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr);
|
static int nvme_rdma_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr);
|
||||||
|
|
||||||
static struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
const struct spdk_nvme_ctrlr_opts *opts,
|
typedef struct spdk_nvme_ctrlr spdk_nvme_ctrlr_t;
|
||||||
void *devhandle)
|
|
||||||
|
static spdk_nvme_ctrlr_t *
|
||||||
|
nvme_rdma_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
||||||
|
const struct spdk_nvme_ctrlr_opts *opts,
|
||||||
|
void *devhandle)
|
||||||
{
|
{
|
||||||
struct nvme_rdma_ctrlr *rctrlr;
|
struct nvme_rdma_ctrlr *rctrlr;
|
||||||
struct ibv_context **contexts;
|
struct ibv_context **contexts;
|
||||||
|
@ -2093,9 +2093,13 @@ nvme_tcp_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
|
|||||||
opts->io_queue_requests, opts->async_mode);
|
opts->io_queue_requests, opts->async_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_nvme_ctrlr *nvme_tcp_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
const struct spdk_nvme_ctrlr_opts *opts,
|
typedef struct spdk_nvme_ctrlr spdk_nvme_ctrlr_t;
|
||||||
void *devhandle)
|
|
||||||
|
static spdk_nvme_ctrlr_t *
|
||||||
|
nvme_tcp_ctrlr_construct(const struct spdk_nvme_transport_id *trid,
|
||||||
|
const struct spdk_nvme_ctrlr_opts *opts,
|
||||||
|
void *devhandle)
|
||||||
{
|
{
|
||||||
struct nvme_tcp_ctrlr *tctrlr;
|
struct nvme_tcp_ctrlr *tctrlr;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -71,7 +71,8 @@ spdk_nvme_transport_available_by_name(const char *transport_name)
|
|||||||
return nvme_get_transport(transport_name) == NULL ? false : true;
|
return nvme_get_transport(transport_name) == NULL ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_nvme_transport_register(const struct spdk_nvme_transport_ops *ops)
|
void
|
||||||
|
spdk_nvme_transport_register(const struct spdk_nvme_transport_ops *ops)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_transport *new_transport;
|
struct spdk_nvme_transport *new_transport;
|
||||||
|
|
||||||
@ -769,7 +770,8 @@ nvme_transport_poll_group_free_stats(struct spdk_nvme_transport_poll_group *tgro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum spdk_nvme_transport_type nvme_transport_get_trtype(const struct spdk_nvme_transport *transport)
|
spdk_nvme_transport_type_t
|
||||||
|
nvme_transport_get_trtype(const struct spdk_nvme_transport *transport)
|
||||||
{
|
{
|
||||||
return transport->ops.type;
|
return transport->ops.type;
|
||||||
}
|
}
|
||||||
|
@ -4200,7 +4200,8 @@ spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool nvmf_check_subsystem_active(struct spdk_nvmf_request *req)
|
static bool
|
||||||
|
nvmf_check_subsystem_active(struct spdk_nvmf_request *req)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_qpair *qpair = req->qpair;
|
struct spdk_nvmf_qpair *qpair = req->qpair;
|
||||||
struct spdk_nvmf_subsystem_poll_group *sgroup = NULL;
|
struct spdk_nvmf_subsystem_poll_group *sgroup = NULL;
|
||||||
@ -4446,7 +4447,8 @@ struct spdk_nvmf_subsystem *spdk_nvmf_request_get_subsystem(struct spdk_nvmf_req
|
|||||||
return req->qpair->ctrlr->subsys;
|
return req->qpair->ctrlr->subsys;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_nvmf_request_get_data(struct spdk_nvmf_request *req, void **data, uint32_t *length)
|
void
|
||||||
|
spdk_nvmf_request_get_data(struct spdk_nvmf_request *req, void **data, uint32_t *length)
|
||||||
{
|
{
|
||||||
*data = req->data;
|
*data = req->data;
|
||||||
*length = req->length;
|
*length = req->length;
|
||||||
@ -4457,7 +4459,8 @@ struct spdk_nvmf_subsystem *spdk_nvmf_ctrlr_get_subsystem(struct spdk_nvmf_ctrlr
|
|||||||
return ctrlr->subsys;
|
return ctrlr->subsys;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t spdk_nvmf_ctrlr_get_id(struct spdk_nvmf_ctrlr *ctrlr)
|
uint16_t
|
||||||
|
spdk_nvmf_ctrlr_get_id(struct spdk_nvmf_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
return ctrlr->cntlid;
|
return ctrlr->cntlid;
|
||||||
}
|
}
|
||||||
|
@ -549,10 +549,9 @@ nvmf_bdev_ctrlr_unmap_cpl(struct spdk_bdev_io *bdev_io, bool success,
|
|||||||
spdk_bdev_free_io(bdev_io);
|
spdk_bdev_free_io(bdev_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_bdev_ctrlr_unmap(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
|
||||||
nvmf_bdev_ctrlr_unmap(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
|
struct spdk_io_channel *ch, struct spdk_nvmf_request *req,
|
||||||
struct spdk_io_channel *ch, struct spdk_nvmf_request *req,
|
struct nvmf_bdev_ctrlr_unmap *unmap_ctx);
|
||||||
struct nvmf_bdev_ctrlr_unmap *unmap_ctx);
|
|
||||||
static void
|
static void
|
||||||
nvmf_bdev_ctrlr_unmap_resubmit(void *arg)
|
nvmf_bdev_ctrlr_unmap_resubmit(void *arg)
|
||||||
{
|
{
|
||||||
|
@ -1932,8 +1932,7 @@ nvmf_fc_opts_init(struct spdk_nvmf_transport_opts *opts)
|
|||||||
opts->num_shared_buffers = SPDK_NVMF_FC_DEFAULT_NUM_SHARED_BUFFERS;
|
opts->num_shared_buffers = SPDK_NVMF_FC_DEFAULT_NUM_SHARED_BUFFERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_fc_accept(void *ctx);
|
||||||
nvmf_fc_accept(void *ctx);
|
|
||||||
|
|
||||||
static struct spdk_nvmf_transport *
|
static struct spdk_nvmf_transport *
|
||||||
nvmf_fc_create(struct spdk_nvmf_transport_opts *opts)
|
nvmf_fc_create(struct spdk_nvmf_transport_opts *opts)
|
||||||
|
@ -99,16 +99,15 @@ static char *validation_errors[] = {
|
|||||||
"Bad Subsystem Port",
|
"Bad Subsystem Port",
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void
|
static inline void nvmf_fc_add_assoc_to_tgt_port(struct spdk_nvmf_fc_nport *tgtport,
|
||||||
nvmf_fc_add_assoc_to_tgt_port(struct spdk_nvmf_fc_nport *tgtport,
|
struct spdk_nvmf_fc_association *assoc,
|
||||||
struct spdk_nvmf_fc_association *assoc,
|
struct spdk_nvmf_fc_remote_port_info *rport);
|
||||||
struct spdk_nvmf_fc_remote_port_info *rport);
|
|
||||||
|
|
||||||
static void
|
static void nvmf_fc_del_connection(struct spdk_nvmf_fc_association *assoc,
|
||||||
nvmf_fc_del_connection(struct spdk_nvmf_fc_association *assoc,
|
struct spdk_nvmf_fc_conn *fc_conn);
|
||||||
struct spdk_nvmf_fc_conn *fc_conn);
|
|
||||||
|
|
||||||
static inline FCNVME_BE32 cpu_to_be32(uint32_t in)
|
static inline FCNVME_BE32
|
||||||
|
cpu_to_be32(uint32_t in)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
|
|
||||||
@ -116,7 +115,8 @@ static inline FCNVME_BE32 cpu_to_be32(uint32_t in)
|
|||||||
return (FCNVME_BE32)t;
|
return (FCNVME_BE32)t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FCNVME_BE32 nvmf_fc_lsdesc_len(size_t sz)
|
static inline FCNVME_BE32
|
||||||
|
nvmf_fc_lsdesc_len(size_t sz)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
|
|
||||||
|
@ -736,10 +736,11 @@ _nvmf_tgt_add_transport(struct spdk_io_channel_iter *i)
|
|||||||
spdk_for_each_channel_continue(i, rc);
|
spdk_for_each_channel_continue(i, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_nvmf_tgt_add_transport(struct spdk_nvmf_tgt *tgt,
|
void
|
||||||
struct spdk_nvmf_transport *transport,
|
spdk_nvmf_tgt_add_transport(struct spdk_nvmf_tgt *tgt,
|
||||||
spdk_nvmf_tgt_add_transport_done_fn cb_fn,
|
struct spdk_nvmf_transport *transport,
|
||||||
void *cb_arg)
|
spdk_nvmf_tgt_add_transport_done_fn cb_fn,
|
||||||
|
void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_tgt_add_transport_ctx *ctx;
|
struct spdk_nvmf_tgt_add_transport_ctx *ctx;
|
||||||
|
|
||||||
|
@ -778,10 +778,9 @@ struct spdk_nvmf_fc_remove_hwqp_cb_args {
|
|||||||
*
|
*
|
||||||
* \return 0 on success, non-zero on failure.
|
* \return 0 on success, non-zero on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int nvmf_fc_main_enqueue_event(enum spdk_fc_event event_type,
|
||||||
nvmf_fc_main_enqueue_event(enum spdk_fc_event event_type,
|
void *args,
|
||||||
void *args,
|
spdk_nvmf_fc_callback cb_func);
|
||||||
spdk_nvmf_fc_callback cb_func);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dump info
|
* dump info
|
||||||
|
@ -482,7 +482,8 @@ free_rpc_delete_subsystem(struct rpc_delete_subsystem *r)
|
|||||||
free(r->tgt_name);
|
free(r->tgt_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rpc_nvmf_subsystem_destroy_complete_cb(void *cb_arg)
|
static void
|
||||||
|
rpc_nvmf_subsystem_destroy_complete_cb(void *cb_arg)
|
||||||
{
|
{
|
||||||
struct spdk_jsonrpc_request *request = cb_arg;
|
struct spdk_jsonrpc_request *request = cb_arg;
|
||||||
|
|
||||||
|
@ -511,17 +511,14 @@ nvmf_rdma_qpair_compare(struct spdk_nvmf_rdma_qpair *rqpair1, struct spdk_nvmf_r
|
|||||||
|
|
||||||
RB_GENERATE_STATIC(qpairs_tree, spdk_nvmf_rdma_qpair, node, nvmf_rdma_qpair_compare);
|
RB_GENERATE_STATIC(qpairs_tree, spdk_nvmf_rdma_qpair, node, nvmf_rdma_qpair_compare);
|
||||||
|
|
||||||
static bool
|
static bool nvmf_rdma_request_process(struct spdk_nvmf_rdma_transport *rtransport,
|
||||||
nvmf_rdma_request_process(struct spdk_nvmf_rdma_transport *rtransport,
|
struct spdk_nvmf_rdma_request *rdma_req);
|
||||||
struct spdk_nvmf_rdma_request *rdma_req);
|
|
||||||
|
|
||||||
static void
|
static void _poller_submit_sends(struct spdk_nvmf_rdma_transport *rtransport,
|
||||||
_poller_submit_sends(struct spdk_nvmf_rdma_transport *rtransport,
|
struct spdk_nvmf_rdma_poller *rpoller);
|
||||||
struct spdk_nvmf_rdma_poller *rpoller);
|
|
||||||
|
|
||||||
static void
|
static void _poller_submit_recvs(struct spdk_nvmf_rdma_transport *rtransport,
|
||||||
_poller_submit_recvs(struct spdk_nvmf_rdma_transport *rtransport,
|
struct spdk_nvmf_rdma_poller *rpoller);
|
||||||
struct spdk_nvmf_rdma_poller *rpoller);
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
nvmf_rdma_check_ibv_state(enum ibv_qp_state state)
|
nvmf_rdma_check_ibv_state(enum ibv_qp_state state)
|
||||||
@ -2385,8 +2382,7 @@ nvmf_rdma_is_rxe_device(struct spdk_nvmf_rdma_device *device)
|
|||||||
device->attr.vendor_id == SPDK_RDMA_RXE_VENDOR_ID_NEW;
|
device->attr.vendor_id == SPDK_RDMA_RXE_VENDOR_ID_NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_rdma_accept(void *ctx);
|
||||||
nvmf_rdma_accept(void *ctx);
|
|
||||||
|
|
||||||
static struct spdk_nvmf_transport *
|
static struct spdk_nvmf_transport *
|
||||||
nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
|
nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
|
||||||
@ -2742,10 +2738,9 @@ nvmf_rdma_destroy(struct spdk_nvmf_transport *transport,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_rdma_trid_from_cm_id(struct rdma_cm_id *id,
|
||||||
nvmf_rdma_trid_from_cm_id(struct rdma_cm_id *id,
|
struct spdk_nvme_transport_id *trid,
|
||||||
struct spdk_nvme_transport_id *trid,
|
bool peer);
|
||||||
bool peer);
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvmf_rdma_listen(struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid,
|
nvmf_rdma_listen(struct spdk_nvmf_transport *transport, const struct spdk_nvme_transport_id *trid,
|
||||||
@ -3430,8 +3425,7 @@ nvmf_rdma_discover(struct spdk_nvmf_transport *transport,
|
|||||||
entry->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
|
entry->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void nvmf_rdma_poll_group_destroy(struct spdk_nvmf_transport_poll_group *group);
|
||||||
nvmf_rdma_poll_group_destroy(struct spdk_nvmf_transport_poll_group *group);
|
|
||||||
|
|
||||||
static struct spdk_nvmf_transport_poll_group *
|
static struct spdk_nvmf_transport_poll_group *
|
||||||
nvmf_rdma_poll_group_create(struct spdk_nvmf_transport *transport,
|
nvmf_rdma_poll_group_create(struct spdk_nvmf_transport *transport,
|
||||||
|
@ -1284,8 +1284,7 @@ nvmf_subsystem_ns_changed(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t nvmf_ns_reservation_clear_all_registrants(struct spdk_nvmf_ns *ns);
|
||||||
nvmf_ns_reservation_clear_all_registrants(struct spdk_nvmf_ns *ns);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
spdk_nvmf_subsystem_remove_ns(struct spdk_nvmf_subsystem *subsystem, uint32_t nsid)
|
||||||
@ -1560,10 +1559,9 @@ static struct spdk_bdev_module ns_bdev_module = {
|
|||||||
.name = "NVMe-oF Target",
|
.name = "NVMe-oF Target",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int nvmf_ns_load_reservation(const char *file, struct spdk_nvmf_reservation_info *info);
|
||||||
nvmf_ns_load_reservation(const char *file, struct spdk_nvmf_reservation_info *info);
|
static int nvmf_ns_reservation_restore(struct spdk_nvmf_ns *ns,
|
||||||
static int
|
struct spdk_nvmf_reservation_info *info);
|
||||||
nvmf_ns_reservation_restore(struct spdk_nvmf_ns *ns, struct spdk_nvmf_reservation_info *info);
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
spdk_nvmf_subsystem_add_ns_ext(struct spdk_nvmf_subsystem *subsystem, const char *bdev_name,
|
spdk_nvmf_subsystem_add_ns_ext(struct spdk_nvmf_subsystem *subsystem, const char *bdev_name,
|
||||||
@ -1858,7 +1856,11 @@ spdk_nvmf_subsystem_get_nqn(const struct spdk_nvmf_subsystem *subsystem)
|
|||||||
return subsystem->subnqn;
|
return subsystem->subnqn;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum spdk_nvmf_subtype spdk_nvmf_subsystem_get_type(struct spdk_nvmf_subsystem *subsystem)
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
|
typedef enum spdk_nvmf_subtype spdk_nvmf_subtype_t;
|
||||||
|
|
||||||
|
spdk_nvmf_subtype_t
|
||||||
|
spdk_nvmf_subsystem_get_type(struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
return subsystem->subtype;
|
return subsystem->subtype;
|
||||||
}
|
}
|
||||||
@ -2124,8 +2126,7 @@ exit:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool nvmf_ns_reservation_all_registrants_type(struct spdk_nvmf_ns *ns);
|
||||||
nvmf_ns_reservation_all_registrants_type(struct spdk_nvmf_ns *ns);
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvmf_ns_reservation_restore(struct spdk_nvmf_ns *ns, struct spdk_nvmf_reservation_info *info)
|
nvmf_ns_reservation_restore(struct spdk_nvmf_ns *ns, struct spdk_nvmf_reservation_info *info)
|
||||||
|
@ -580,8 +580,7 @@ nvmf_tcp_destroy(struct spdk_nvmf_transport *transport,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_tcp_accept(void *ctx);
|
||||||
nvmf_tcp_accept(void *ctx);
|
|
||||||
|
|
||||||
static struct spdk_nvmf_transport *
|
static struct spdk_nvmf_transport *
|
||||||
nvmf_tcp_create(struct spdk_nvmf_transport_opts *opts)
|
nvmf_tcp_create(struct spdk_nvmf_transport_opts *opts)
|
||||||
|
@ -128,9 +128,10 @@ spdk_nvmf_get_transport_name(struct spdk_nvmf_transport *transport)
|
|||||||
return transport->ops->name;
|
return transport->ops->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvmf_transport_opts_copy(struct spdk_nvmf_transport_opts *opts,
|
static void
|
||||||
struct spdk_nvmf_transport_opts *opts_src,
|
nvmf_transport_opts_copy(struct spdk_nvmf_transport_opts *opts,
|
||||||
size_t opts_size)
|
struct spdk_nvmf_transport_opts *opts_src,
|
||||||
|
size_t opts_size)
|
||||||
{
|
{
|
||||||
assert(opts);
|
assert(opts);
|
||||||
assert(opts_src);
|
assert(opts_src);
|
||||||
|
@ -433,11 +433,9 @@ struct nvmf_vfio_user_transport {
|
|||||||
/*
|
/*
|
||||||
* function prototypes
|
* function prototypes
|
||||||
*/
|
*/
|
||||||
static int
|
static int nvmf_vfio_user_req_free(struct spdk_nvmf_request *req);
|
||||||
nvmf_vfio_user_req_free(struct spdk_nvmf_request *req);
|
|
||||||
|
|
||||||
static struct nvmf_vfio_user_req *
|
static struct nvmf_vfio_user_req *get_nvmf_vfio_user_req(struct nvmf_vfio_user_sq *sq);
|
||||||
get_nvmf_vfio_user_req(struct nvmf_vfio_user_sq *sq);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local process virtual address of a queue.
|
* Local process virtual address of a queue.
|
||||||
@ -1424,8 +1422,7 @@ set_sq_eventidx(struct nvmf_vfio_user_sq *sq)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int nvmf_vfio_user_sq_poll(struct nvmf_vfio_user_sq *sq);
|
||||||
nvmf_vfio_user_sq_poll(struct nvmf_vfio_user_sq *sq);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arrange for an SQ to interrupt us if written. Returns non-zero if we
|
* Arrange for an SQ to interrupt us if written. Returns non-zero if we
|
||||||
@ -1587,9 +1584,8 @@ vfio_user_map_cmd(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvmf_request *
|
|||||||
length, 4096, _map_one);
|
length, 4096, _map_one);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int handle_cmd_req(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvme_cmd *cmd,
|
||||||
handle_cmd_req(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvme_cmd *cmd,
|
struct nvmf_vfio_user_sq *sq);
|
||||||
struct nvmf_vfio_user_sq *sq);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Posts a CQE in the completion queue.
|
* Posts a CQE in the completion queue.
|
||||||
@ -2908,8 +2904,7 @@ struct ctrlr_quiesce_ctx {
|
|||||||
int status;
|
int status;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void ctrlr_quiesce(struct nvmf_vfio_user_ctrlr *vu_ctrlr);
|
||||||
ctrlr_quiesce(struct nvmf_vfio_user_ctrlr *vu_ctrlr);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_vfio_user_endpoint_resume_done_msg(void *ctx)
|
_vfio_user_endpoint_resume_done_msg(void *ctx)
|
||||||
|
@ -1709,7 +1709,8 @@ spdk_reduce_vol_get_params(struct spdk_reduce_vol *vol)
|
|||||||
return &vol->params;
|
return &vol->params;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spdk_reduce_vol_print_info(struct spdk_reduce_vol *vol)
|
void
|
||||||
|
spdk_reduce_vol_print_info(struct spdk_reduce_vol *vol)
|
||||||
{
|
{
|
||||||
uint64_t logical_map_size, num_chunks, ttl_chunk_sz;
|
uint64_t logical_map_size, num_chunks, ttl_chunk_sz;
|
||||||
uint32_t struct_size;
|
uint32_t struct_size;
|
||||||
|
@ -1013,7 +1013,8 @@ scsi2_release(struct spdk_scsi_task *task)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scsi2_reserve_check(struct spdk_scsi_task *task)
|
int
|
||||||
|
scsi2_reserve_check(struct spdk_scsi_task *task)
|
||||||
{
|
{
|
||||||
struct spdk_scsi_lun *lun = task->lun;
|
struct spdk_scsi_lun *lun = task->lun;
|
||||||
uint8_t *cdb = task->cdb;
|
uint8_t *cdb = task->cdb;
|
||||||
|
@ -866,7 +866,8 @@ spdk_net_impl_register(struct spdk_net_impl *impl, int priority)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int spdk_sock_set_default_impl(const char *impl_name)
|
int
|
||||||
|
spdk_sock_set_default_impl(const char *impl_name)
|
||||||
{
|
{
|
||||||
struct spdk_net_impl *impl;
|
struct spdk_net_impl *impl;
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ struct spdk_vhost_blk_session {
|
|||||||
/* forward declaration */
|
/* forward declaration */
|
||||||
static const struct spdk_vhost_dev_backend vhost_blk_device_backend;
|
static const struct spdk_vhost_dev_backend vhost_blk_device_backend;
|
||||||
|
|
||||||
static void
|
static void vhost_user_blk_request_finish(uint8_t status, struct spdk_vhost_blk_task *task,
|
||||||
vhost_user_blk_request_finish(uint8_t status, struct spdk_vhost_blk_task *task, void *cb_arg);
|
void *cb_arg);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vhost_user_process_blk_request(struct spdk_vhost_user_blk_task *user_task)
|
vhost_user_process_blk_request(struct spdk_vhost_user_blk_task *user_task)
|
||||||
|
@ -389,7 +389,8 @@ int vhost_vring_inflight_desc_to_iov(struct spdk_vhost_session *vsession, struct
|
|||||||
uint16_t vhost_vring_packed_desc_get_buffer_id(struct spdk_vhost_virtqueue *vq, uint16_t req_idx,
|
uint16_t vhost_vring_packed_desc_get_buffer_id(struct spdk_vhost_virtqueue *vq, uint16_t req_idx,
|
||||||
uint16_t *num_descs);
|
uint16_t *num_descs);
|
||||||
|
|
||||||
static inline bool __attribute__((always_inline))
|
static inline bool
|
||||||
|
__attribute__((always_inline))
|
||||||
vhost_dev_has_feature(struct spdk_vhost_session *vsession, unsigned feature_id)
|
vhost_dev_has_feature(struct spdk_vhost_session *vsession, unsigned feature_id)
|
||||||
{
|
{
|
||||||
return vsession->negotiated_features & (1ULL << feature_id);
|
return vsession->negotiated_features & (1ULL << feature_id);
|
||||||
@ -604,8 +605,8 @@ int virtio_blk_transport_create(const char *transport_name, const struct spdk_js
|
|||||||
int virtio_blk_transport_destroy(struct spdk_virtio_blk_transport *transport,
|
int virtio_blk_transport_destroy(struct spdk_virtio_blk_transport *transport,
|
||||||
spdk_vhost_fini_cb cb_fn);
|
spdk_vhost_fini_cb cb_fn);
|
||||||
|
|
||||||
const struct spdk_virtio_blk_transport_ops *
|
const struct spdk_virtio_blk_transport_ops *virtio_blk_get_transport_ops(
|
||||||
virtio_blk_get_transport_ops(const char *transport_name);
|
const char *transport_name);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -466,7 +466,8 @@ bdev_aio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _bdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static int
|
||||||
|
_bdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
switch (bdev_io->type) {
|
switch (bdev_io->type) {
|
||||||
/* Read and write operations must be performed on buffers aligned to
|
/* Read and write operations must be performed on buffers aligned to
|
||||||
@ -491,7 +492,8 @@ static int _bdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static void
|
||||||
|
bdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
if (_bdev_aio_submit_request(ch, bdev_io) < 0) {
|
if (_bdev_aio_submit_request(ch, bdev_io) < 0) {
|
||||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
@ -594,7 +596,8 @@ static const struct spdk_bdev_fn_table aio_fn_table = {
|
|||||||
.write_config_json = bdev_aio_write_json_config,
|
.write_config_json = bdev_aio_write_json_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void aio_free_disk(struct file_disk *fdisk)
|
static void
|
||||||
|
aio_free_disk(struct file_disk *fdisk)
|
||||||
{
|
{
|
||||||
if (fdisk == NULL) {
|
if (fdisk == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -392,7 +392,8 @@ release_vbdev_dev(struct vbdev_dev *device)
|
|||||||
|
|
||||||
/* Dummy function used by DPDK to free ext attached buffers to mbufs, we free them ourselves but
|
/* Dummy function used by DPDK to free ext attached buffers to mbufs, we free them ourselves but
|
||||||
* this callback has to be here. */
|
* this callback has to be here. */
|
||||||
static void shinfo_free_cb(void *arg1, void *arg2)
|
static void
|
||||||
|
shinfo_free_cb(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,7 @@ struct delay_io_channel {
|
|||||||
unsigned int rand_seed;
|
unsigned int rand_seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void vbdev_delay_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io);
|
||||||
vbdev_delay_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
|
|
||||||
/* Callback for unregistering the IO device. */
|
/* Callback for unregistering the IO device. */
|
||||||
|
@ -144,8 +144,7 @@ vbdev_gpt_destruct(void *ctx)
|
|||||||
return spdk_bdev_part_free(&gpt_disk->part);
|
return spdk_bdev_part_free(&gpt_disk->part);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void _vbdev_gpt_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io);
|
||||||
_vbdev_gpt_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vbdev_gpt_resubmit_request(void *arg)
|
vbdev_gpt_resubmit_request(void *arg)
|
||||||
|
@ -534,7 +534,8 @@ bdev_iscsi_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
|||||||
bdev_io->u.bdev.offset_blocks);
|
bdev_io->u.bdev.offset_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _bdev_iscsi_submit_request(void *_bdev_io)
|
static void
|
||||||
|
_bdev_iscsi_submit_request(void *_bdev_io)
|
||||||
{
|
{
|
||||||
struct spdk_bdev_io *bdev_io = _bdev_io;
|
struct spdk_bdev_io *bdev_io = _bdev_io;
|
||||||
struct bdev_iscsi_io *iscsi_io = (struct bdev_iscsi_io *)bdev_io->driver_ctx;
|
struct bdev_iscsi_io *iscsi_io = (struct bdev_iscsi_io *)bdev_io->driver_ctx;
|
||||||
@ -573,7 +574,8 @@ static void _bdev_iscsi_submit_request(void *_bdev_io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_iscsi_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io)
|
static void
|
||||||
|
bdev_iscsi_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
struct spdk_thread *submit_td = spdk_io_channel_get_thread(_ch);
|
struct spdk_thread *submit_td = spdk_io_channel_get_thread(_ch);
|
||||||
struct bdev_iscsi_io *iscsi_io = (struct bdev_iscsi_io *)bdev_io->driver_ctx;
|
struct bdev_iscsi_io *iscsi_io = (struct bdev_iscsi_io *)bdev_io->driver_ctx;
|
||||||
|
@ -209,7 +209,8 @@ bdev_malloc_unmap(struct malloc_disk *mdisk,
|
|||||||
byte_count, 0, malloc_done, task);
|
byte_count, 0, malloc_done, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _bdev_malloc_submit_request(struct malloc_channel *mch, struct spdk_bdev_io *bdev_io)
|
static int
|
||||||
|
_bdev_malloc_submit_request(struct malloc_channel *mch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
uint32_t block_size = bdev_io->bdev->blocklen;
|
uint32_t block_size = bdev_io->bdev->blocklen;
|
||||||
|
|
||||||
@ -294,7 +295,8 @@ static int _bdev_malloc_submit_request(struct malloc_channel *mch, struct spdk_b
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static void
|
||||||
|
bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
struct malloc_channel *mch = spdk_io_channel_get_ctx(ch);
|
struct malloc_channel *mch = spdk_io_channel_get_ctx(ch);
|
||||||
|
|
||||||
@ -505,7 +507,8 @@ malloc_destroy_channel_cb(void *io_device, void *ctx)
|
|||||||
spdk_poller_unregister(&ch->completion_poller);
|
spdk_poller_unregister(&ch->completion_poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bdev_malloc_initialize(void)
|
static int
|
||||||
|
bdev_malloc_initialize(void)
|
||||||
{
|
{
|
||||||
/* This needs to be reset for each reinitialization of submodules.
|
/* This needs to be reset for each reinitialization of submodules.
|
||||||
* Otherwise after enough devices or reinitializations the value gets too high.
|
* Otherwise after enough devices or reinitializations the value gets too high.
|
||||||
|
@ -1332,7 +1332,8 @@ static const struct spdk_json_object_decoder rpc_get_controller_health_info_deco
|
|||||||
{"name", offsetof(struct rpc_get_controller_health_info, name), spdk_json_decode_string, true},
|
{"name", offsetof(struct rpc_get_controller_health_info, name), spdk_json_decode_string, true},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void nvme_health_info_cleanup(struct spdk_nvme_health_info_context *context, bool response)
|
static void
|
||||||
|
nvme_health_info_cleanup(struct spdk_nvme_health_info_context *context, bool response)
|
||||||
{
|
{
|
||||||
if (response == true) {
|
if (response == true) {
|
||||||
spdk_jsonrpc_send_error_response(context->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
spdk_jsonrpc_send_error_response(context->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
||||||
|
@ -259,7 +259,8 @@ vbdev_ocf_ctx_data_secure_erase(ctx_data_t *ctx_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int vbdev_ocf_queue_create(ocf_cache_t cache, ocf_queue_t *queue, const struct ocf_queue_ops *ops)
|
int
|
||||||
|
vbdev_ocf_queue_create(ocf_cache_t cache, ocf_queue_t *queue, const struct ocf_queue_ops *ops)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct vbdev_ocf_cache_ctx *ctx = ocf_cache_get_priv(cache);
|
struct vbdev_ocf_cache_ctx *ctx = ocf_cache_get_priv(cache);
|
||||||
@ -270,7 +271,8 @@ int vbdev_ocf_queue_create(ocf_cache_t cache, ocf_queue_t *queue, const struct o
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vbdev_ocf_queue_put(ocf_queue_t queue)
|
void
|
||||||
|
vbdev_ocf_queue_put(ocf_queue_t queue)
|
||||||
{
|
{
|
||||||
ocf_cache_t cache = ocf_queue_get_cache(queue);
|
ocf_cache_t cache = ocf_queue_get_cache(queue);
|
||||||
struct vbdev_ocf_cache_ctx *ctx = ocf_cache_get_priv(cache);
|
struct vbdev_ocf_cache_ctx *ctx = ocf_cache_get_priv(cache);
|
||||||
@ -280,7 +282,8 @@ void vbdev_ocf_queue_put(ocf_queue_t queue)
|
|||||||
pthread_mutex_unlock(&ctx->lock);
|
pthread_mutex_unlock(&ctx->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vbdev_ocf_cache_ctx_put(struct vbdev_ocf_cache_ctx *ctx)
|
void
|
||||||
|
vbdev_ocf_cache_ctx_put(struct vbdev_ocf_cache_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (env_atomic_dec_return(&ctx->refcnt) == 0) {
|
if (env_atomic_dec_return(&ctx->refcnt) == 0) {
|
||||||
pthread_mutex_destroy(&ctx->lock);
|
pthread_mutex_destroy(&ctx->lock);
|
||||||
@ -288,7 +291,8 @@ void vbdev_ocf_cache_ctx_put(struct vbdev_ocf_cache_ctx *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vbdev_ocf_cache_ctx_get(struct vbdev_ocf_cache_ctx *ctx)
|
void
|
||||||
|
vbdev_ocf_cache_ctx_get(struct vbdev_ocf_cache_ctx *ctx)
|
||||||
{
|
{
|
||||||
env_atomic_inc(&ctx->refcnt);
|
env_atomic_inc(&ctx->refcnt);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ struct ocf_io_ctx {
|
|||||||
int vbdev_ocf_volume_init(void);
|
int vbdev_ocf_volume_init(void);
|
||||||
void vbdev_ocf_volume_cleanup(void);
|
void vbdev_ocf_volume_cleanup(void);
|
||||||
|
|
||||||
static inline struct ocf_io_ctx *ocf_get_io_ctx(struct ocf_io *io)
|
static inline struct ocf_io_ctx *
|
||||||
|
ocf_get_io_ctx(struct ocf_io *io)
|
||||||
{
|
{
|
||||||
return ocf_io_get_priv(io);
|
return ocf_io_get_priv(io);
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,7 @@ struct passthru_bdev_io {
|
|||||||
struct spdk_bdev_io_wait_entry bdev_io_wait;
|
struct spdk_bdev_io_wait_entry bdev_io_wait;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void vbdev_passthru_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io);
|
||||||
vbdev_passthru_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
|
|
||||||
/* Callback for unregistering the IO device. */
|
/* Callback for unregistering the IO device. */
|
||||||
|
@ -40,7 +40,8 @@ struct raid_offline_tailq g_raid_bdev_offline_list = TAILQ_HEAD_INITIALIZER(
|
|||||||
|
|
||||||
static TAILQ_HEAD(, raid_bdev_module) g_raid_modules = TAILQ_HEAD_INITIALIZER(g_raid_modules);
|
static TAILQ_HEAD(, raid_bdev_module) g_raid_modules = TAILQ_HEAD_INITIALIZER(g_raid_modules);
|
||||||
|
|
||||||
static struct raid_bdev_module *raid_bdev_module_find(enum raid_level level)
|
static struct raid_bdev_module *
|
||||||
|
raid_bdev_module_find(enum raid_level level)
|
||||||
{
|
{
|
||||||
struct raid_bdev_module *raid_module;
|
struct raid_bdev_module *raid_module;
|
||||||
|
|
||||||
@ -53,7 +54,8 @@ static struct raid_bdev_module *raid_bdev_module_find(enum raid_level level)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void raid_bdev_module_list_add(struct raid_bdev_module *raid_module)
|
void
|
||||||
|
raid_bdev_module_list_add(struct raid_bdev_module *raid_module)
|
||||||
{
|
{
|
||||||
if (raid_bdev_module_find(raid_module->level) != NULL) {
|
if (raid_bdev_module_find(raid_module->level) != NULL) {
|
||||||
SPDK_ERRLOG("module for raid level '%s' already registered.\n",
|
SPDK_ERRLOG("module for raid level '%s' already registered.\n",
|
||||||
@ -359,8 +361,7 @@ raid_base_bdev_reset_complete(struct spdk_bdev_io *bdev_io, bool success, void *
|
|||||||
SPDK_BDEV_IO_STATUS_FAILED);
|
SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void raid_bdev_submit_reset_request(struct raid_bdev_io *raid_io);
|
||||||
raid_bdev_submit_reset_request(struct raid_bdev_io *raid_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_raid_bdev_submit_reset_request(void *_raid_io)
|
_raid_bdev_submit_reset_request(void *_raid_io)
|
||||||
@ -884,7 +885,11 @@ static struct {
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum raid_level raid_bdev_parse_raid_level(const char *str)
|
/* We have to use the typedef in the function declaration to appease astyle. */
|
||||||
|
typedef enum raid_level raid_level_t;
|
||||||
|
|
||||||
|
raid_level_t
|
||||||
|
raid_bdev_parse_raid_level(const char *str)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -280,13 +280,10 @@ __RAID_MODULE_REGISTER(__LINE__)(void) \
|
|||||||
raid_bdev_module_list_add(_module); \
|
raid_bdev_module_list_add(_module); \
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool raid_bdev_io_complete_part(struct raid_bdev_io *raid_io, uint64_t completed,
|
||||||
raid_bdev_io_complete_part(struct raid_bdev_io *raid_io, uint64_t completed,
|
enum spdk_bdev_io_status status);
|
||||||
enum spdk_bdev_io_status status);
|
void raid_bdev_queue_io_wait(struct raid_bdev_io *raid_io, struct spdk_bdev *bdev,
|
||||||
void
|
struct spdk_io_channel *ch, spdk_bdev_io_wait_cb cb_fn);
|
||||||
raid_bdev_queue_io_wait(struct raid_bdev_io *raid_io, struct spdk_bdev *bdev,
|
void raid_bdev_io_complete(struct raid_bdev_io *raid_io, enum spdk_bdev_io_status status);
|
||||||
struct spdk_io_channel *ch, spdk_bdev_io_wait_cb cb_fn);
|
|
||||||
void
|
|
||||||
raid_bdev_io_complete(struct raid_bdev_io *raid_io, enum spdk_bdev_io_status status);
|
|
||||||
|
|
||||||
#endif /* SPDK_BDEV_RAID_INTERNAL_H */
|
#endif /* SPDK_BDEV_RAID_INTERNAL_H */
|
||||||
|
@ -42,8 +42,7 @@ concat_bdev_io_completion(struct spdk_bdev_io *bdev_io, bool success, void *cb_a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void concat_submit_rw_request(struct raid_bdev_io *raid_io);
|
||||||
concat_submit_rw_request(struct raid_bdev_io *raid_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_concat_submit_rw_request(void *_raid_io)
|
_concat_submit_rw_request(void *_raid_io)
|
||||||
@ -127,8 +126,7 @@ concat_submit_rw_request(struct raid_bdev_io *raid_io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void concat_submit_null_payload_request(struct raid_bdev_io *raid_io);
|
||||||
concat_submit_null_payload_request(struct raid_bdev_io *raid_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_concat_submit_null_payload_request(void *_raid_io)
|
_concat_submit_null_payload_request(void *_raid_io)
|
||||||
@ -265,7 +263,8 @@ concat_submit_null_payload_request(struct raid_bdev_io *raid_io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int concat_start(struct raid_bdev *raid_bdev)
|
static int
|
||||||
|
concat_start(struct raid_bdev *raid_bdev)
|
||||||
{
|
{
|
||||||
uint64_t total_blockcnt = 0;
|
uint64_t total_blockcnt = 0;
|
||||||
struct raid_base_bdev_info *base_info;
|
struct raid_base_bdev_info *base_info;
|
||||||
|
@ -38,8 +38,7 @@ raid0_bdev_io_completion(struct spdk_bdev_io *bdev_io, bool success, void *cb_ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void raid0_submit_rw_request(struct raid_bdev_io *raid_io);
|
||||||
raid0_submit_rw_request(struct raid_bdev_io *raid_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_raid0_submit_rw_request(void *_raid_io)
|
_raid0_submit_rw_request(void *_raid_io)
|
||||||
@ -225,8 +224,7 @@ _raid0_split_io_range(struct raid_bdev_io_range *io_range, uint8_t disk_idx,
|
|||||||
*_nblocks_in_disk = nblocks_in_disk;
|
*_nblocks_in_disk = nblocks_in_disk;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void raid0_submit_null_payload_request(struct raid_bdev_io *raid_io);
|
||||||
raid0_submit_null_payload_request(struct raid_bdev_io *raid_io);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_raid0_submit_null_payload_request(void *_raid_io)
|
_raid0_submit_null_payload_request(void *_raid_io)
|
||||||
@ -328,7 +326,8 @@ raid0_submit_null_payload_request(struct raid_bdev_io *raid_io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int raid0_start(struct raid_bdev *raid_bdev)
|
static int
|
||||||
|
raid0_start(struct raid_bdev *raid_bdev)
|
||||||
{
|
{
|
||||||
uint64_t min_blockcnt = UINT64_MAX;
|
uint64_t min_blockcnt = UINT64_MAX;
|
||||||
struct raid_base_bdev_info *base_info;
|
struct raid_base_bdev_info *base_info;
|
||||||
|
@ -53,8 +53,7 @@ static void vbdev_split_examine(struct spdk_bdev *bdev);
|
|||||||
static int vbdev_split_config_json(struct spdk_json_write_ctx *w);
|
static int vbdev_split_config_json(struct spdk_json_write_ctx *w);
|
||||||
static int vbdev_split_get_ctx_size(void);
|
static int vbdev_split_get_ctx_size(void);
|
||||||
|
|
||||||
static void
|
static void _vbdev_split_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io);
|
||||||
_vbdev_split_submit_request(struct spdk_io_channel *_ch, struct spdk_bdev_io *bdev_io);
|
|
||||||
|
|
||||||
static struct spdk_bdev_module split_if = {
|
static struct spdk_bdev_module split_if = {
|
||||||
.name = "split",
|
.name = "split",
|
||||||
|
@ -239,8 +239,9 @@ bdev_uring_group_poll(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_uring_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
static void
|
||||||
bool success)
|
bdev_uring_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
||||||
|
bool success)
|
||||||
{
|
{
|
||||||
if (!success) {
|
if (!success) {
|
||||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
@ -272,7 +273,8 @@ static void bdev_uring_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _bdev_uring_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static int
|
||||||
|
_bdev_uring_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
switch (bdev_io->type) {
|
switch (bdev_io->type) {
|
||||||
/* Read and write operations must be performed on buffers aligned to
|
/* Read and write operations must be performed on buffers aligned to
|
||||||
@ -288,7 +290,8 @@ static int _bdev_uring_submit_request(struct spdk_io_channel *ch, struct spdk_bd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_uring_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static void
|
||||||
|
bdev_uring_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
if (_bdev_uring_submit_request(ch, bdev_io) < 0) {
|
if (_bdev_uring_submit_request(ch, bdev_io) < 0) {
|
||||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
@ -374,7 +377,8 @@ static const struct spdk_bdev_fn_table uring_fn_table = {
|
|||||||
.write_config_json = bdev_uring_write_json_config,
|
.write_config_json = bdev_uring_write_json_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void uring_free_bdev(struct bdev_uring *uring)
|
static void
|
||||||
|
uring_free_bdev(struct bdev_uring *uring)
|
||||||
{
|
{
|
||||||
if (uring == NULL) {
|
if (uring == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -142,7 +142,6 @@ struct spdk_bdev *bdev_virtio_pci_blk_dev_create(const char *name,
|
|||||||
* \param period_us The period time of the hotplug monitor in us
|
* \param period_us The period time of the hotplug monitor in us
|
||||||
* \return 0 for success otherwise failure
|
* \return 0 for success otherwise failure
|
||||||
*/
|
*/
|
||||||
int
|
int bdev_virtio_pci_blk_set_hotplug(bool enabled, uint64_t period_us);
|
||||||
bdev_virtio_pci_blk_set_hotplug(bool enabled, uint64_t period_us);
|
|
||||||
|
|
||||||
#endif /* SPDK_BDEV_VIRTIO_H */
|
#endif /* SPDK_BDEV_VIRTIO_H */
|
||||||
|
@ -614,7 +614,8 @@ bdev_virtio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
|||||||
bdev_virtio_rw(ch, bdev_io);
|
bdev_virtio_rw(ch, bdev_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _bdev_virtio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static int
|
||||||
|
_bdev_virtio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
struct virtio_scsi_disk *disk = SPDK_CONTAINEROF(bdev_io->bdev, struct virtio_scsi_disk, bdev);
|
struct virtio_scsi_disk *disk = SPDK_CONTAINEROF(bdev_io->bdev, struct virtio_scsi_disk, bdev);
|
||||||
|
|
||||||
@ -653,7 +654,8 @@ static int _bdev_virtio_submit_request(struct spdk_io_channel *ch, struct spdk_b
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bdev_virtio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
static void
|
||||||
|
bdev_virtio_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
if (_bdev_virtio_submit_request(ch, bdev_io) < 0) {
|
if (_bdev_virtio_submit_request(ch, bdev_io) < 0) {
|
||||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
|
@ -48,7 +48,8 @@ static const struct spdk_json_object_decoder admin_passthru_decoder[] = {
|
|||||||
{"identify_ctrlr", offsetof(struct spdk_nvmf_admin_passthru_conf, identify_ctrlr), spdk_json_decode_bool}
|
{"identify_ctrlr", offsetof(struct spdk_nvmf_admin_passthru_conf, identify_ctrlr), spdk_json_decode_bool}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int decode_admin_passthru(const struct spdk_json_val *val, void *out)
|
static int
|
||||||
|
decode_admin_passthru(const struct spdk_json_val *val, void *out)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_admin_passthru_conf *req = (struct spdk_nvmf_admin_passthru_conf *)out;
|
struct spdk_nvmf_admin_passthru_conf *req = (struct spdk_nvmf_admin_passthru_conf *)out;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ function check_c_style() {
|
|||||||
# coding standards.
|
# coding standards.
|
||||||
git ls-files '*.[ch]' \
|
git ls-files '*.[ch]' \
|
||||||
| grep -v rte_vhost | grep -v cpp_headers \
|
| grep -v rte_vhost | grep -v cpp_headers \
|
||||||
| xargs -P$(nproc) -n10 astyle \
|
| xargs -P$(nproc) -n10 astyle --break-return-type --attach-return-type-decl \
|
||||||
--options=.astylerc >> astyle.log
|
--options=.astylerc >> astyle.log
|
||||||
git ls-files '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' \
|
git ls-files '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' \
|
||||||
| grep -v rte_vhost | grep -v cpp_headers \
|
| grep -v rte_vhost | grep -v cpp_headers \
|
||||||
|
@ -267,7 +267,8 @@ fuzz_admin_directive_receive_command(struct fuzz_command *cmd)
|
|||||||
g_data += 8;
|
g_data += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_arbitration(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_arbitration(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_arbitration.bits.hpw = g_data[2];
|
cmd->cmd.cdw11_bits.feat_arbitration.bits.hpw = g_data[2];
|
||||||
cmd->cmd.cdw11_bits.feat_arbitration.bits.mpw = g_data[3];
|
cmd->cmd.cdw11_bits.feat_arbitration.bits.mpw = g_data[3];
|
||||||
@ -275,18 +276,21 @@ static void feat_arbitration(struct fuzz_command *cmd)
|
|||||||
cmd->cmd.cdw11_bits.feat_arbitration.bits.ab = g_data[5] & 0x07;
|
cmd->cmd.cdw11_bits.feat_arbitration.bits.ab = g_data[5] & 0x07;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_power_management(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_power_management(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_power_management.bits.wh = g_data[2] & 0x07;
|
cmd->cmd.cdw11_bits.feat_power_management.bits.wh = g_data[2] & 0x07;
|
||||||
cmd->cmd.cdw11_bits.feat_power_management.bits.ps = (g_data[2] >> 3) & 0x1f;
|
cmd->cmd.cdw11_bits.feat_power_management.bits.ps = (g_data[2] >> 3) & 0x1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_lba_range_type(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_lba_range_type(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_lba_range_type.bits.num = (g_data[2] >> 2) & 0x3f;
|
cmd->cmd.cdw11_bits.feat_lba_range_type.bits.num = (g_data[2] >> 2) & 0x3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_temperature_threshold(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_temperature_threshold(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_temp_threshold.bits.thsel = g_data[2] & 0x03;
|
cmd->cmd.cdw11_bits.feat_temp_threshold.bits.thsel = g_data[2] & 0x03;
|
||||||
cmd->cmd.cdw11_bits.feat_temp_threshold.bits.tmpsel = (g_data[2] >> 2) & 0x0f;
|
cmd->cmd.cdw11_bits.feat_temp_threshold.bits.tmpsel = (g_data[2] >> 2) & 0x0f;
|
||||||
@ -294,43 +298,50 @@ static void feat_temperature_threshold(struct fuzz_command *cmd)
|
|||||||
(uint16_t)g_data[4];
|
(uint16_t)g_data[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_error_recover(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_error_recover(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_error_recovery.bits.dulbe = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_error_recovery.bits.dulbe = g_data[2] & 0x01;
|
||||||
cmd->cmd.cdw11_bits.feat_error_recovery.bits.tler = ((uint16_t)g_data[3] << 8) +
|
cmd->cmd.cdw11_bits.feat_error_recovery.bits.tler = ((uint16_t)g_data[3] << 8) +
|
||||||
(uint16_t)g_data[4];
|
(uint16_t)g_data[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_volatile_write_cache(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_volatile_write_cache(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_volatile_write_cache.bits.wce = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_volatile_write_cache.bits.wce = g_data[2] & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_number_of_queues(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_number_of_queues(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_num_of_queues.bits.ncqr = ((uint16_t)g_data[2] << 8) + (uint16_t)g_data[3];
|
cmd->cmd.cdw11_bits.feat_num_of_queues.bits.ncqr = ((uint16_t)g_data[2] << 8) + (uint16_t)g_data[3];
|
||||||
cmd->cmd.cdw11_bits.feat_num_of_queues.bits.nsqr = ((uint16_t)g_data[4] << 8) + (uint16_t)g_data[5];
|
cmd->cmd.cdw11_bits.feat_num_of_queues.bits.nsqr = ((uint16_t)g_data[4] << 8) + (uint16_t)g_data[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_interrupt_coalescing(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_interrupt_coalescing(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_interrupt_coalescing.bits.time = g_data[2];
|
cmd->cmd.cdw11_bits.feat_interrupt_coalescing.bits.time = g_data[2];
|
||||||
cmd->cmd.cdw11_bits.feat_interrupt_coalescing.bits.thr = g_data[3];
|
cmd->cmd.cdw11_bits.feat_interrupt_coalescing.bits.thr = g_data[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_interrupt_vector_configuration(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_interrupt_vector_configuration(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_interrupt_vector_configuration.bits.cd = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_interrupt_vector_configuration.bits.cd = g_data[2] & 0x01;
|
||||||
cmd->cmd.cdw11_bits.feat_interrupt_vector_configuration.bits.iv = ((uint16_t)g_data[3] << 8) +
|
cmd->cmd.cdw11_bits.feat_interrupt_vector_configuration.bits.iv = ((uint16_t)g_data[3] << 8) +
|
||||||
(uint16_t)g_data[4];
|
(uint16_t)g_data[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_write_atomicity(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_write_atomicity(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_write_atomicity.bits.dn = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_write_atomicity.bits.dn = g_data[2] & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_async_event_cfg(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_async_event_cfg(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_async_event_cfg.bits.ana_change_notice = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_async_event_cfg.bits.ana_change_notice = g_data[2] & 0x01;
|
||||||
cmd->cmd.cdw11_bits.feat_async_event_cfg.bits.discovery_log_change_notice = (g_data[2] >> 1) & 0x01;
|
cmd->cmd.cdw11_bits.feat_async_event_cfg.bits.discovery_log_change_notice = (g_data[2] >> 1) & 0x01;
|
||||||
@ -347,26 +358,30 @@ static void feat_async_event_cfg(struct fuzz_command *cmd)
|
|||||||
(g_data[3] >> 4) & 0x01;
|
(g_data[3] >> 4) & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_keep_alive_timer(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_keep_alive_timer(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_keep_alive_timer.bits.kato = ((uint32_t)g_data[2] << 24) + ((
|
cmd->cmd.cdw11_bits.feat_keep_alive_timer.bits.kato = ((uint32_t)g_data[2] << 24) + ((
|
||||||
uint32_t)g_data[3] << 16) +
|
uint32_t)g_data[3] << 16) +
|
||||||
((uint32_t)g_data[4] << 8) + (uint32_t)g_data[5];
|
((uint32_t)g_data[4] << 8) + (uint32_t)g_data[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_host_identifier(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_host_identifier(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_host_identifier.bits.exhid = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_host_identifier.bits.exhid = g_data[2] & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_rsv_notification_mask(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_rsv_notification_mask(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.regpre = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.regpre = g_data[2] & 0x01;
|
||||||
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.respre = (g_data[2] >> 1) & 0x01;
|
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.respre = (g_data[2] >> 1) & 0x01;
|
||||||
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.resrel = (g_data[2] >> 2) & 0x01;
|
cmd->cmd.cdw11_bits.feat_rsv_notification_mask.bits.resrel = (g_data[2] >> 2) & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feat_rsv_persistence(struct fuzz_command *cmd)
|
static void
|
||||||
|
feat_rsv_persistence(struct fuzz_command *cmd)
|
||||||
{
|
{
|
||||||
cmd->cmd.cdw11_bits.feat_rsv_persistence.bits.ptpl = g_data[2] & 0x01;
|
cmd->cmd.cdw11_bits.feat_rsv_persistence.bits.ptpl = g_data[2] & 0x01;
|
||||||
}
|
}
|
||||||
@ -759,7 +774,8 @@ run_cmds(uint32_t queue_depth)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int TestOneInput(const uint8_t *data, size_t size)
|
static int
|
||||||
|
TestOneInput(const uint8_t *data, size_t size)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_detach_ctx *detach_ctx = NULL;
|
struct spdk_nvme_detach_ctx *detach_ctx = NULL;
|
||||||
|
|
||||||
@ -791,7 +807,8 @@ static int TestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
int LLVMFuzzerRunDriver(int *argc, char ***argv, int (*UserCb)(const uint8_t *Data, size_t Size));
|
int LLVMFuzzerRunDriver(int *argc, char ***argv, int (*UserCb)(const uint8_t *Data, size_t Size));
|
||||||
|
|
||||||
static void exit_handler(void)
|
static void
|
||||||
|
exit_handler(void)
|
||||||
{
|
{
|
||||||
if (g_in_fuzzer) {
|
if (g_in_fuzzer) {
|
||||||
spdk_app_stop(0);
|
spdk_app_stop(0);
|
||||||
|
@ -54,7 +54,8 @@ spdk_fuse_shutdown(void)
|
|||||||
spdk_app_stop(0);
|
spdk_app_stop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct spdk_app_opts opts = {};
|
struct spdk_app_opts opts = {};
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
@ -56,7 +56,8 @@ mkfs_parse_arg(int ch, char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct spdk_app_opts opts = {};
|
struct spdk_app_opts opts = {};
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
@ -290,29 +290,32 @@ dma_test_copy_memory(struct dma_test_req *req, struct iovec *dst_iov, uint32_t d
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dma_test_push_memory_cb(struct spdk_memory_domain *dst_domain,
|
static int
|
||||||
void *dst_domain_ctx,
|
dma_test_push_memory_cb(struct spdk_memory_domain *dst_domain,
|
||||||
struct iovec *dst_iov, uint32_t dst_iovcnt, struct iovec *src_iov, uint32_t src_iovcnt,
|
void *dst_domain_ctx,
|
||||||
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
struct iovec *dst_iov, uint32_t dst_iovcnt, struct iovec *src_iov, uint32_t src_iovcnt,
|
||||||
|
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
||||||
{
|
{
|
||||||
struct dma_test_req *req = dst_domain_ctx;
|
struct dma_test_req *req = dst_domain_ctx;
|
||||||
|
|
||||||
return dma_test_copy_memory(req, dst_iov, dst_iovcnt, src_iov, src_iovcnt, cpl_cb, cpl_cb_arg);
|
return dma_test_copy_memory(req, dst_iov, dst_iovcnt, src_iov, src_iovcnt, cpl_cb, cpl_cb_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dma_test_pull_memory_cb(struct spdk_memory_domain *src_domain,
|
static int
|
||||||
void *src_domain_ctx,
|
dma_test_pull_memory_cb(struct spdk_memory_domain *src_domain,
|
||||||
struct iovec *src_iov, uint32_t src_iovcnt, struct iovec *dst_iov, uint32_t dst_iovcnt,
|
void *src_domain_ctx,
|
||||||
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
struct iovec *src_iov, uint32_t src_iovcnt, struct iovec *dst_iov, uint32_t dst_iovcnt,
|
||||||
|
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
||||||
{
|
{
|
||||||
struct dma_test_req *req = src_domain_ctx;
|
struct dma_test_req *req = src_domain_ctx;
|
||||||
|
|
||||||
return dma_test_copy_memory(req, dst_iov, dst_iovcnt, src_iov, src_iovcnt, cpl_cb, cpl_cb_arg);
|
return dma_test_copy_memory(req, dst_iov, dst_iovcnt, src_iov, src_iovcnt, cpl_cb, cpl_cb_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dma_test_memzero_cb(struct spdk_memory_domain *src_domain, void *src_domain_ctx,
|
static int
|
||||||
struct iovec *iov, uint32_t iovcnt,
|
dma_test_memzero_cb(struct spdk_memory_domain *src_domain, void *src_domain_ctx,
|
||||||
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
struct iovec *iov, uint32_t iovcnt,
|
||||||
|
spdk_memory_domain_data_cpl_cb cpl_cb, void *cpl_cb_arg)
|
||||||
{
|
{
|
||||||
struct dma_test_req *req = src_domain_ctx;
|
struct dma_test_req *req = src_domain_ctx;
|
||||||
struct dma_test_data_cpl_ctx *cpl_ctx;
|
struct dma_test_data_cpl_ctx *cpl_ctx;
|
||||||
@ -420,7 +423,8 @@ dma_test_bdev_dummy_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *b
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dma_test_task_run(void *ctx)
|
static void
|
||||||
|
dma_test_task_run(void *ctx)
|
||||||
{
|
{
|
||||||
struct dma_test_task *task = ctx;
|
struct dma_test_task *task = ctx;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
6
test/env/pci/pci_ut.c
vendored
6
test/env/pci/pci_ut.c
vendored
@ -76,7 +76,8 @@ ut_cfg_read(struct spdk_pci_device *dev, void *value, uint32_t len, uint32_t off
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ut_cfg_write(struct spdk_pci_device *dev, void *value, uint32_t len, uint32_t offset)
|
static int
|
||||||
|
ut_cfg_write(struct spdk_pci_device *dev, void *value, uint32_t len, uint32_t offset)
|
||||||
{
|
{
|
||||||
struct ut_pci_dev *ut_dev = (struct ut_pci_dev *)dev;
|
struct ut_pci_dev *ut_dev = (struct ut_pci_dev *)dev;
|
||||||
|
|
||||||
@ -180,7 +181,8 @@ pci_hook_test(void)
|
|||||||
CU_ASSERT(rc != 0);
|
CU_ASSERT(rc != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
CU_pSuite suite = NULL;
|
CU_pSuite suite = NULL;
|
||||||
unsigned int num_failures;
|
unsigned int num_failures;
|
||||||
|
@ -43,7 +43,8 @@ app_repeat_started(void *arg1)
|
|||||||
printf("spdk_app_start is called in Round %d.\n", index);
|
printf("spdk_app_start is called in Round %d.\n", index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _app_repeat_shutdown_cb(void)
|
static void
|
||||||
|
_app_repeat_shutdown_cb(void)
|
||||||
{
|
{
|
||||||
printf("Shutdown signal received, stop current app iteration\n");
|
printf("Shutdown signal received, stop current app iteration\n");
|
||||||
spdk_app_stop(0);
|
spdk_app_stop(0);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user