42 args->cia_block_count);
49 args->cia_block_count);
56 int writer_numb,
int reader_numb)
60 for (
i = 0;
i < writer_numb; ++
i) {
66 for (
i = 0;
i < reader_numb; ++
i) {
72 for (
i = 0;
i < writer_numb; ++
i) {
76 for (
i = 0;
i < reader_numb; ++
i) {
83 fprintf(
file,
"Usage: %s [OPTION]... SOURCE... DESTINATION...\n" 84 "Launch multithreaded concurrent Read/Write\n" 86 "Mandatory arguments to long options are mandatory for short options too.\n" 87 " -l, --local ADDR local endpoint address\n" 88 " -H, --ha ADDR HA endpoint address\n" 89 " -p, --profile FID profile FID\n" 90 " -P, --process FID process FID\n" 91 " -o, --object FID ID of the motr object\n" 92 " -W, --writer_numb INT number of writer threads\n" 93 " -R, --reader_numb INT number of reader threads\n" 94 " -s, --block-size INT block size multiple of 4k in bytes or " \
95 "with suffix b/k/m/g Ex: 1k=1024, " \
97 " -c, --block-count INT number of blocks to copy, can give with " \
98 "suffix b/k/m/g/K/M/G. Ex: 1k=1024, " \
99 "1m=1024*1024, 1K=1000 1M=1000*1000\n" 100 " -r, --read-verify verify parity after reading the data\n" 101 " -h, --help shows this help text and exit\n" 105 int main(
int argc,
char **argv)
111 char **dest_fnames =
NULL;
112 char **src_fnames =
NULL;
113 uint32_t block_size = 0;
114 uint32_t block_count = 0;
117 int option_index = 0;
121 static struct option l_opts[] = {
122 {
"local", required_argument,
NULL,
'l'},
123 {
"ha", required_argument,
NULL,
'H'},
124 {
"profile", required_argument,
NULL,
'p'},
125 {
"process", required_argument,
NULL,
'P'},
126 {
"object", required_argument,
NULL,
'o'},
127 {
"writer-numb", required_argument,
NULL,
'W'},
128 {
"reader-numb", required_argument,
NULL,
'R'},
129 {
"block-size", required_argument,
NULL,
's'},
130 {
"block-count", required_argument,
NULL,
'c'},
131 {
"read-verify", no_argument,
NULL,
'r'},
132 {
"help", no_argument,
NULL,
'h'},
135 while ((
c = getopt_long(argc, argv,
":l:H:p:P:o:W:R:s:c:rh", l_opts,
136 &option_index)) != -1) {
146 case 'o':
id.u_lo = atoi(
optarg);
148 case 'W': writer_numb = atoi(
optarg);
150 case 'R': reader_numb = atoi(
optarg);
152 case 's': block_size = atoi(
optarg);
154 case 'c': block_count = atoi(
optarg);
156 case 'r':
conf.mc_is_read_verify =
true;
158 case 'h':
usage(stderr, basename(argv[0]));
160 case '?': fprintf(stderr,
"Unsupported option '%c'\n",
162 usage(stderr, basename(argv[0]));
164 case ':': fprintf(stderr,
"No argument given for '%c'\n",
166 usage(stderr, basename(argv[0]));
168 default: fprintf(stderr,
"Unsupported option '%c'\n",
c);
172 conf.mc_is_oostore =
true;
182 fprintf(stderr,
"init failed! rc = %d\n",
rc);
191 for (
i = 0;
i < writer_numb; ++
i, ++
optind) {
192 src_fnames[
i] = strdup(argv[
optind]);
195 for (
i = 0;
i < reader_numb; ++
i, ++
optind) {
196 dest_fnames[
i] = strdup(argv[
optind]);
214 writer_numb, reader_numb);
216 for (
i = 0;
i < writer_numb; ++
i) {
221 for (
i = 0;
i < reader_numb; ++
i) {
#define M0_ALLOC_ARR(arr, nr)
static void mt_io(struct m0_thread *writer_t, struct m0_cc_io_args writer_args, struct m0_thread *reader_t, struct m0_cc_io_args reader_args, int writer_numb, int reader_numb)
static void writer_thread_launch(struct m0_cc_io_args *args)
static struct m0_container container
int m0_thread_join(struct m0_thread *q)
static struct m0_cc_io_args writer_args
static struct m0_client * instance
struct m0_addb_ctx m0_addb_ctx
struct m0_container * cia_container
M0_INTERNAL void client_init(struct sim *s, struct client_conf *conf)
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
int m0_read_cc(struct m0_container *container, struct m0_uint128 id, char **dest, int *index, uint32_t block_size, uint32_t block_count)
const struct m0_uint128 M0_ID_APP
int main(int argc, char **argv)
int m0_write_cc(struct m0_container *container, char **src, struct m0_uint128 id, int *index, uint32_t block_size, uint32_t block_count)
static struct m0_idx_dix_config dix_conf
static struct m0_addb2_callback c
static void reader_thread_launch(struct m0_cc_io_args *args)
void m0_thread_fini(struct m0_thread *q)
static void usage(FILE *file, char *prog_name)
M0_INTERNAL void client_fini(struct client_conf *conf)
static struct m0_cc_io_args reader_args