|
1 | 1 | /** |
2 | 2 | * (C) Copyright 2016-2024 Intel Corporation. |
3 | | - * (C) Copyright 2025 Hewlett Packard Enterprise Development LP |
| 3 | + * (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP |
4 | 4 | * |
5 | 5 | * SPDX-License-Identifier: BSD-2-Clause-Patent |
6 | 6 | */ |
|
9 | 9 |
|
10 | 10 | #include <abt.h> |
11 | 11 | #include <daos/common.h> |
| 12 | +#include <daos_srv/vos.h> |
12 | 13 | #include <daos_errno.h> |
13 | 14 | #include "srv_internal.h" |
14 | 15 |
|
@@ -931,3 +932,80 @@ dss_chore_queue_fini(struct dss_xstream *dx) |
931 | 932 | ABT_cond_free(&queue->chq_cond); |
932 | 933 | ABT_mutex_free(&queue->chq_mutex); |
933 | 934 | } |
| 935 | + |
| 936 | +struct dss_vos_pool_create_args { |
| 937 | + const char *spc_path; |
| 938 | + unsigned char *spc_uuid; |
| 939 | + daos_size_t spc_scm_size; |
| 940 | + daos_size_t spc_data_sz; |
| 941 | + daos_size_t spc_meta_sz; |
| 942 | + unsigned int spc_flags; |
| 943 | + uint32_t spc_version; |
| 944 | + daos_handle_t *spc_pool; |
| 945 | +}; |
| 946 | + |
| 947 | +static int |
| 948 | +dss_vos_pool_create_ult(void *varg) |
| 949 | +{ |
| 950 | + struct dss_vos_pool_create_args *arg = varg; |
| 951 | + |
| 952 | + return vos_pool_create(arg->spc_path, arg->spc_uuid, arg->spc_scm_size, arg->spc_data_sz, |
| 953 | + arg->spc_meta_sz, arg->spc_flags, arg->spc_version, arg->spc_pool); |
| 954 | +} |
| 955 | + |
| 956 | +/** |
| 957 | + * Call vos_pool_create in a new deep-stack ULT on the same xstream. This is to |
| 958 | + * avoid pmemobj_create or SPDK from overflowing the stack of the calling ULT. |
| 959 | + */ |
| 960 | +int |
| 961 | +dss_vos_pool_create(const char *path, unsigned char *uuid, daos_size_t scm_size, |
| 962 | + daos_size_t data_sz, daos_size_t meta_sz, unsigned int flags, uint32_t version, |
| 963 | + daos_handle_t *pool) |
| 964 | +{ |
| 965 | + struct dss_vos_pool_create_args args; |
| 966 | + |
| 967 | + args.spc_path = path; |
| 968 | + args.spc_uuid = uuid; |
| 969 | + args.spc_scm_size = scm_size; |
| 970 | + args.spc_data_sz = data_sz; |
| 971 | + args.spc_meta_sz = meta_sz; |
| 972 | + args.spc_flags = flags; |
| 973 | + args.spc_version = version; |
| 974 | + args.spc_pool = pool; |
| 975 | + |
| 976 | + return dss_ult_execute(dss_vos_pool_create_ult, &args, NULL /* user_cb */, |
| 977 | + NULL /* cb_args */, DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ); |
| 978 | +} |
| 979 | + |
| 980 | +struct dss_vos_pool_open_args { |
| 981 | + const char *spo_path; |
| 982 | + unsigned char *spo_uuid; |
| 983 | + unsigned int spo_flags; |
| 984 | + daos_handle_t *spo_pool; |
| 985 | +}; |
| 986 | + |
| 987 | +static int |
| 988 | +dss_vos_pool_open_ult(void *varg) |
| 989 | +{ |
| 990 | + struct dss_vos_pool_open_args *arg = varg; |
| 991 | + |
| 992 | + return vos_pool_open(arg->spo_path, arg->spo_uuid, arg->spo_flags, arg->spo_pool); |
| 993 | +} |
| 994 | + |
| 995 | +/** |
| 996 | + * Call vos_pool_open in a new deep-stack ULT on the same xstream. This is to |
| 997 | + * avoid pmemobj_open or SPDK from overflowing the stack of the calling ULT. |
| 998 | + */ |
| 999 | +int |
| 1000 | +dss_vos_pool_open(const char *path, unsigned char *uuid, unsigned int flags, daos_handle_t *pool) |
| 1001 | +{ |
| 1002 | + struct dss_vos_pool_open_args args; |
| 1003 | + |
| 1004 | + args.spo_path = path; |
| 1005 | + args.spo_uuid = uuid; |
| 1006 | + args.spo_flags = flags; |
| 1007 | + args.spo_pool = pool; |
| 1008 | + |
| 1009 | + return dss_ult_execute(dss_vos_pool_open_ult, &args, NULL /* user_cb */, NULL /* cb_args */, |
| 1010 | + DSS_XS_SELF, 0 /* tgt_id */, DSS_DEEP_STACK_SZ); |
| 1011 | +} |
0 commit comments