Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch

This commit is contained in:
Brian Behlendorf 2009-02-19 13:02:05 -08:00
commit f951aec719
5 changed files with 47 additions and 36 deletions

View File

@ -57,6 +57,8 @@
#define GB (MB * 1024) #define GB (MB * 1024)
#define TB (GB * 1024) #define TB (GB * 1024)
#define KMGT_SIZE 16
/* All offsets, sizes and counts can be passed to the application in /* All offsets, sizes and counts can be passed to the application in
* multiple ways. * multiple ways.
* 1. a value (stored in val[0], val_count will be 1) * 1. a value (stored in val[0], val_count will be 1)

View File

@ -45,7 +45,7 @@
#include "zpios.h" #include "zpios.h"
static const char short_opt[] = "t:l:h:e:n:i:j:k:c:u:a:b:g:L:P:R:I:" static const char short_opt[] = "t:l:h:e:n:i:j:k:c:u:a:b:g:L:P:R:I:"
"G:T:Vzs:A:B:C:o:m:q:r:fwxdp:v?"; "G:T:N:VHzOs:A:B:C:o:m:q:r:fwxdp:v?";
static const struct option long_opt[] = { static const struct option long_opt[] = {
{"chunksize", required_argument, 0, 'c' }, {"chunksize", required_argument, 0, 'c' },
{"chunksize_low", required_argument, 0, 'a' }, {"chunksize_low", required_argument, 0, 'a' },
@ -70,6 +70,7 @@ static const struct option long_opt[] = {
{"cleanup", no_argument, 0, 'x' }, {"cleanup", no_argument, 0, 'x' },
{"verify", no_argument, 0, 'V' }, {"verify", no_argument, 0, 'V' },
{"zerocopy", no_argument, 0, 'z' }, {"zerocopy", no_argument, 0, 'z' },
{"nowait", no_argument, 0, 'O' },
{"threaddelay", required_argument, 0, 'T' }, {"threaddelay", required_argument, 0, 'T' },
{"regionnoise", required_argument, 0, 'I' }, {"regionnoise", required_argument, 0, 'I' },
{"chunknoise", required_argument, 0, 'N' }, {"chunknoise", required_argument, 0, 'N' },
@ -118,6 +119,7 @@ usage(void)
" --cleanup -x\n" " --cleanup -x\n"
" --verify -V\n" " --verify -V\n"
" --zerocopy -z\n" " --zerocopy -z\n"
" --nowait -O\n"
" --threaddelay -T =jiffies\n" " --threaddelay -T =jiffies\n"
" --regionnoise -I =shift\n" " --regionnoise -I =shift\n"
" --chunknoise -N =bytes\n" " --chunknoise -N =bytes\n"
@ -166,9 +168,6 @@ args_init(int argc, char **argv)
rc = 0; rc = 0;
switch (c) { switch (c) {
case 'v': /* --verbose */
args->verbose++;
break;
case 't': /* --thread count */ case 't': /* --thread count */
rc = set_count(REGEX_NUMBERS, REGEX_NUMBERS_COMMA, rc = set_count(REGEX_NUMBERS, REGEX_NUMBERS_COMMA,
&args->T, optarg, &fl_th, "threadcount"); &args->T, optarg, &fl_th, "threadcount");
@ -279,12 +278,18 @@ args_init(int argc, char **argv)
case 'V': /* --verify */ case 'V': /* --verify */
args->flags |= DMU_VERIFY; args->flags |= DMU_VERIFY;
break; break;
case 'z': /* --verify */ case 'z': /* --zerocopy */
args->flags |= (DMU_WRITE_ZC | DMU_READ_ZC); args->flags |= (DMU_WRITE_ZC | DMU_READ_ZC);
break; break;
case 'H': case 'O': /* --nowait */
args->flags |= DMU_WRITE_NOWAIT;
break;
case 'H': /* --human-readable */
args->human_readable = 1; args->human_readable = 1;
break; break;
case 'v': /* --verbose */
args->verbose++;
break;
case '?': case '?':
rc = 1; rc = 1;
break; break;

View File

@ -87,9 +87,9 @@ uint64_to_kmgt(char *str, uint64_t val)
} }
if (i >= 4) if (i >= 4)
sprintf(str, "inf"); (void)snprintf(str, KMGT_SIZE-1, "inf");
else else
sprintf(str, "%lu%c", (unsigned long)val, (void)snprintf(str, KMGT_SIZE-1, "%lu%c", (unsigned long)val,
(i == -1) ? '\0' : postfix[i]); (i == -1) ? '\0' : postfix[i]);
return str; return str;
@ -108,9 +108,9 @@ kmgt_per_sec(char *str, uint64_t v, double t)
} }
if (i >= 4) if (i >= 4)
sprintf(str, "inf"); (void)snprintf(str, KMGT_SIZE-1, "inf");
else else
sprintf(str, "%.2f%c", val, (void)snprintf(str, KMGT_SIZE-1, "%.2f%c", val,
(i == -1) ? '\0' : postfix[i]); (i == -1) ? '\0' : postfix[i]);
return str; return str;
@ -125,7 +125,8 @@ print_flags(char *str, uint32_t flags)
str[3] = (flags & DMU_REMOVE) ? 'c' : '-'; str[3] = (flags & DMU_REMOVE) ? 'c' : '-';
str[4] = (flags & DMU_FPP) ? 'p' : 's'; str[4] = (flags & DMU_FPP) ? 'p' : 's';
str[5] = (flags & (DMU_WRITE_ZC | DMU_READ_ZC)) ? 'z' : '-'; str[5] = (flags & (DMU_WRITE_ZC | DMU_READ_ZC)) ? 'z' : '-';
str[6] = '\0'; str[6] = (flags & DMU_WRITE_NOWAIT) ? 'O' : '-';
str[7] = '\0';
return str; return str;
} }
@ -140,7 +141,7 @@ timespec_to_double(struct timespec t)
static int static int
regex_match(const char *string, char *pattern) regex_match(const char *string, char *pattern)
{ {
regex_t re; regex_t re = { 0 };
int rc; int rc;
rc = regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE); rc = regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE);
@ -327,7 +328,7 @@ print_stats_human_readable(cmd_args_t *args, zpios_cmd_t *cmd)
{ {
zpios_stats_t *summary_stats; zpios_stats_t *summary_stats;
double t_time, wr_time, rd_time, cr_time, rm_time; double t_time, wr_time, rd_time, cr_time, rm_time;
char str[16]; char str[KMGT_SIZE];
if (args->rc) if (args->rc)
printf("FAILED: %3d ", args->rc); printf("FAILED: %3d ", args->rc);

View File

@ -53,6 +53,7 @@
#define DMU_FPP 0x10 #define DMU_FPP 0x10
#define DMU_WRITE_ZC 0x20 /* Incompatible with DMU_VERIFY */ #define DMU_WRITE_ZC 0x20 /* Incompatible with DMU_VERIFY */
#define DMU_READ_ZC 0x40 /* Incompatible with DMU_VERIFY */ #define DMU_READ_ZC 0x40 /* Incompatible with DMU_VERIFY */
#define DMU_WRITE_NOWAIT 0x80
#define ZPIOS_NAME_SIZE 16 #define ZPIOS_NAME_SIZE 16
#define ZPIOS_PATH_SIZE 128 #define ZPIOS_PATH_SIZE 128

View File

@ -426,6 +426,9 @@ zpios_dmu_write(run_args_t *run_args, objset_t *os, uint64_t object,
int rc, how = TXG_WAIT; int rc, how = TXG_WAIT;
int flags = 0; int flags = 0;
if (run_args->flags & DMU_WRITE_NOWAIT)
how = TXG_NOWAIT;
while (1) { while (1) {
tx = dmu_tx_create(os); tx = dmu_tx_create(os);
dmu_tx_hold_write(tx, object, offset, size); dmu_tx_hold_write(tx, object, offset, size);
@ -667,7 +670,6 @@ zpios_threads_run(run_args_t *run_args)
zpios_time_t *tw = &(run_args->stats.wr_time); zpios_time_t *tw = &(run_args->stats.wr_time);
zpios_time_t *tr = &(run_args->stats.rd_time); zpios_time_t *tr = &(run_args->stats.rd_time);
int i, rc = 0, tc = run_args->thread_count; int i, rc = 0, tc = run_args->thread_count;
DEFINE_WAIT(wait);
zpios_upcall(run_args->pre, PHASE_PRE, run_args, 0); zpios_upcall(run_args->pre, PHASE_PRE, run_args, 0);