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

This commit is contained in:
Brian Behlendorf 2009-01-14 08:42:39 -08:00
commit 0817cfaa4b
11 changed files with 269 additions and 307 deletions

View File

@ -46,7 +46,7 @@
- Minor build system improvements
- Minor script improvements
- Create a full copy and not a link tree with quilt
- KPIOS_MAJOR changed from 231 to 232
- ZPIOS_MAJOR changed from 231 to 232
- BIO_RW_BARRIER flag removed from IO request
2008-06-30 Brian Behlendorf <behlendorf1@llnl.gov>

View File

@ -89,9 +89,9 @@ typedef struct cmd_args {
uint64_t chunknoise; /* Chunk noise */
uint64_t thread_delay; /* Thread delay */
char pre[KPIOS_PATH_SIZE]; /* Pre-exec hook */
char post[KPIOS_PATH_SIZE]; /* Post-exec hook */
char log[KPIOS_PATH_SIZE]; /* Requested log dir */
char pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
char post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
char log[ZPIOS_PATH_SIZE]; /* Requested log dir */
/* Control */
int current_id;
@ -112,6 +112,6 @@ int set_noise(uint64_t *noise, char *optarg, char *arg);
int set_load_params(cmd_args_t *args, char *optarg);
int check_mutual_exclusive_command_lines(uint32_t flag, char *arg);
void print_stats_header(void);
void print_stats(cmd_args_t *args, kpios_cmd_t *cmd);
void print_stats(cmd_args_t *args, zpios_cmd_t *cmd);
#endif /* _ZPIOS_H */

View File

@ -259,13 +259,13 @@ args_init(int argc, char **argv)
args->flags |= DMU_REMOVE;
break;
case 'P': /* --prerun */
strncpy(args->pre, optarg, KPIOS_PATH_SIZE - 1);
strncpy(args->pre, optarg, ZPIOS_PATH_SIZE - 1);
break;
case 'R': /* --postrun */
strncpy(args->post, optarg, KPIOS_PATH_SIZE - 1);
strncpy(args->post, optarg, ZPIOS_PATH_SIZE - 1);
break;
case 'G': /* --log */
strncpy(args->log, optarg, KPIOS_PATH_SIZE - 1);
strncpy(args->log, optarg, ZPIOS_PATH_SIZE - 1);
break;
case 'I': /* --regionnoise */
rc = set_noise(&args->regionnoise, optarg, "regionnoise");
@ -329,18 +329,18 @@ args_init(int argc, char **argv)
static int
dev_clear(void)
{
kpios_cfg_t cfg;
zpios_cfg_t cfg;
int rc;
memset(&cfg, 0, sizeof(cfg));
cfg.cfg_magic = KPIOS_CFG_MAGIC;
cfg.cfg_cmd = KPIOS_CFG_BUFFER_CLEAR;
cfg.cfg_magic = ZPIOS_CFG_MAGIC;
cfg.cfg_cmd = ZPIOS_CFG_BUFFER_CLEAR;
cfg.cfg_arg1 = 0;
rc = ioctl(zpiosctl_fd, KPIOS_CFG, &cfg);
rc = ioctl(zpiosctl_fd, ZPIOS_CFG, &cfg);
if (rc)
fprintf(stderr, "Ioctl() error %lu / %d: %d\n",
(unsigned long) KPIOS_CFG, cfg.cfg_cmd, errno);
(unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
lseek(zpiosctl_fd, 0, SEEK_SET);
@ -351,18 +351,18 @@ dev_clear(void)
static int
dev_size(int size)
{
kpios_cfg_t cfg;
zpios_cfg_t cfg;
int rc;
memset(&cfg, 0, sizeof(cfg));
cfg.cfg_magic = KPIOS_CFG_MAGIC;
cfg.cfg_cmd = KPIOS_CFG_BUFFER_SIZE;
cfg.cfg_magic = ZPIOS_CFG_MAGIC;
cfg.cfg_cmd = ZPIOS_CFG_BUFFER_SIZE;
cfg.cfg_arg1 = size;
rc = ioctl(zpiosctl_fd, KPIOS_CFG, &cfg);
rc = ioctl(zpiosctl_fd, ZPIOS_CFG, &cfg);
if (rc) {
fprintf(stderr, "Ioctl() error %lu / %d: %d\n",
(unsigned long) KPIOS_CFG, cfg.cfg_cmd, errno);
(unsigned long) ZPIOS_CFG, cfg.cfg_cmd, errno);
return rc;
}
@ -378,7 +378,7 @@ dev_fini(void)
if (zpiosctl_fd != -1) {
if (close(zpiosctl_fd) == -1) {
fprintf(stderr, "Unable to close %s: %d\n",
KPIOS_DEV, errno);
ZPIOS_DEV, errno);
}
}
}
@ -388,10 +388,10 @@ dev_init(void)
{
int rc;
zpiosctl_fd = open(KPIOS_DEV, O_RDONLY);
zpiosctl_fd = open(ZPIOS_DEV, O_RDONLY);
if (zpiosctl_fd == -1) {
fprintf(stderr, "Unable to open %s: %d\n"
"Is the zpios module loaded?\n", KPIOS_DEV, errno);
"Is the zpios module loaded?\n", ZPIOS_DEV, errno);
rc = errno;
goto error;
}
@ -415,7 +415,7 @@ error:
if (zpiosctl_fd != -1) {
if (close(zpiosctl_fd) == -1) {
fprintf(stderr, "Unable to close %s: %d\n",
KPIOS_DEV, errno);
ZPIOS_DEV, errno);
}
}
@ -468,22 +468,22 @@ static int
run_one(cmd_args_t *args, uint32_t id, uint32_t T, uint32_t N,
uint64_t C, uint64_t S, uint64_t O)
{
kpios_cmd_t *cmd;
zpios_cmd_t *cmd;
int rc, rc2, cmd_size;
dev_clear();
cmd_size = sizeof(kpios_cmd_t) + ((T + N + 1) * sizeof(kpios_stats_t));
cmd = (kpios_cmd_t *)malloc(cmd_size);
cmd_size = sizeof(zpios_cmd_t) + ((T + N + 1) * sizeof(zpios_stats_t));
cmd = (zpios_cmd_t *)malloc(cmd_size);
if (cmd == NULL)
return ENOMEM;
memset(cmd, 0, cmd_size);
cmd->cmd_magic = KPIOS_CMD_MAGIC;
strncpy(cmd->cmd_pool, args->pool, KPIOS_NAME_SIZE - 1);
strncpy(cmd->cmd_pre, args->pre, KPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_post, args->post, KPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_log, args->log, KPIOS_PATH_SIZE - 1);
cmd->cmd_magic = ZPIOS_CMD_MAGIC;
strncpy(cmd->cmd_pool, args->pool, ZPIOS_NAME_SIZE - 1);
strncpy(cmd->cmd_pre, args->pre, ZPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_post, args->post, ZPIOS_PATH_SIZE - 1);
strncpy(cmd->cmd_log, args->log, ZPIOS_PATH_SIZE - 1);
cmd->cmd_id = id;
cmd->cmd_chunk_size = C;
cmd->cmd_thread_count = T;
@ -494,9 +494,9 @@ run_one(cmd_args_t *args, uint32_t id, uint32_t T, uint32_t N,
cmd->cmd_chunk_noise = args->chunknoise;
cmd->cmd_thread_delay = args->thread_delay;
cmd->cmd_flags = args->flags;
cmd->cmd_data_size = (T + N + 1) * sizeof(kpios_stats_t);
cmd->cmd_data_size = (T + N + 1) * sizeof(zpios_stats_t);
rc = ioctl(zpiosctl_fd, KPIOS_CMD, cmd);
rc = ioctl(zpiosctl_fd, ZPIOS_CMD, cmd);
if (rc)
args->rc = errno;

View File

@ -323,9 +323,9 @@ print_stats_header(void)
}
static void
print_stats_human_readable(cmd_args_t *args, kpios_cmd_t *cmd)
print_stats_human_readable(cmd_args_t *args, zpios_cmd_t *cmd)
{
kpios_stats_t *summary_stats;
zpios_stats_t *summary_stats;
double t_time, wr_time, rd_time, cr_time, rm_time;
char str[16];
@ -350,7 +350,7 @@ print_stats_human_readable(cmd_args_t *args, kpios_cmd_t *cmd)
return;
}
summary_stats = (kpios_stats_t *)cmd->cmd_data_str;
summary_stats = (zpios_stats_t *)cmd->cmd_data_str;
t_time = timespec_to_double(summary_stats->total_time.delta);
wr_time = timespec_to_double(summary_stats->wr_time.delta);
rd_time = timespec_to_double(summary_stats->rd_time.delta);
@ -374,9 +374,9 @@ print_stats_human_readable(cmd_args_t *args, kpios_cmd_t *cmd)
}
static void
print_stats_table(cmd_args_t *args, kpios_cmd_t *cmd)
print_stats_table(cmd_args_t *args, zpios_cmd_t *cmd)
{
kpios_stats_t *summary_stats;
zpios_stats_t *summary_stats;
double wr_time, rd_time;
if (args->rc)
@ -400,7 +400,7 @@ print_stats_table(cmd_args_t *args, kpios_cmd_t *cmd)
return;
}
summary_stats = (kpios_stats_t *)cmd->cmd_data_str;
summary_stats = (zpios_stats_t *)cmd->cmd_data_str;
wr_time = timespec_to_double(summary_stats->wr_time.delta);
rd_time = timespec_to_double(summary_stats->rd_time.delta);
@ -431,7 +431,7 @@ print_stats_table(cmd_args_t *args, kpios_cmd_t *cmd)
}
void
print_stats(cmd_args_t *args, kpios_cmd_t *cmd)
print_stats(cmd_args_t *args, zpios_cmd_t *cmd)
{
if (args->human_readable)
print_stats_human_readable(args, cmd);

View File

@ -2088,44 +2088,6 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
spa->spa_minref = refcount_count(&spa->spa_refcount);
#if defined(_KERNEL) && !defined(HAVE_ZPL)
{
objset_t *os;
nvlist_t *zprops;
/*
* Create the pool's root filesystem.
*/
error = dmu_objset_open(pool, DMU_OST_ZFS, DS_MODE_OWNER, &os);
if (error != 0)
return (error);
tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* master */
dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* del queue */
dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); /* root node */
error = dmu_tx_assign(tx, TXG_WAIT);
ASSERT3U(error, ==, 0);
if (spa_version(dmu_objset_spa(os)) >= SPA_VERSION_FUID)
version = ZPL_VERSION;
else
version = MIN(ZPL_VERSION, ZPL_VERSION_FUID - 1);
VERIFY(nvlist_alloc(&zprops, NV_UNIQUE_NAME, KM_SLEEP) == 0);
VERIFY(nvlist_add_uint64(zprops, zfs_prop_to_name(ZFS_PROP_VERSION),
version) == 0);
zfs_create_fs(os, CRED(), zprops, tx);
nvlist_free(zprops);
dmu_tx_commit(tx);
dmu_objset_close(os);
}
#endif
return (0);
}

View File

@ -30,19 +30,19 @@
* CDDL HEADER END
*/
#ifndef _KPIOS_CTL_H
#define _KPIOS_CTL_H
#ifndef _ZPIOS_CTL_H
#define _ZPIOS_CTL_H
/* Contains shared definitions which both the userspace
* and kernelspace portions of kpios must agree on.
* and kernelspace portions of zpios must agree on.
*/
#ifndef _KERNEL
#include <stdint.h>
#endif
#define KPIOS_MAJOR 232 /* XXX - Arbitrary */
#define KPIOS_MINORS 1
#define KPIOS_DEV "/dev/zpios"
#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */
#define ZPIOS_MINORS 1
#define ZPIOS_DEV "/dev/zpios"
#define DMU_IO 0x01
@ -54,45 +54,45 @@
#define DMU_WRITE_ZC 0x20 /* Incompatible with DMU_VERIFY */
#define DMU_READ_ZC 0x40 /* Incompatible with DMU_VERIFY */
#define KPIOS_NAME_SIZE 16
#define KPIOS_PATH_SIZE 128
#define ZPIOS_NAME_SIZE 16
#define ZPIOS_PATH_SIZE 128
#define PHASE_PRE "pre"
#define PHASE_POST "post"
#define PHASE_WRITE "write"
#define PHASE_READ "read"
#define KPIOS_CFG_MAGIC 0x87237190U
typedef struct kpios_cfg {
#define ZPIOS_CFG_MAGIC 0x87237190U
typedef struct zpios_cfg {
uint32_t cfg_magic; /* Unique magic */
int32_t cfg_cmd; /* Config command */
int32_t cfg_arg1; /* Config command arg 1 */
int32_t cfg_rc1; /* Config response 1 */
} kpios_cfg_t;
} zpios_cfg_t;
typedef struct kpios_time {
typedef struct zpios_time {
struct timespec start;
struct timespec stop;
struct timespec delta;
} kpios_time_t;
} zpios_time_t;
typedef struct kpios_stats {
kpios_time_t total_time;
kpios_time_t cr_time;
kpios_time_t rm_time;
kpios_time_t wr_time;
kpios_time_t rd_time;
typedef struct zpios_stats {
zpios_time_t total_time;
zpios_time_t cr_time;
zpios_time_t rm_time;
zpios_time_t wr_time;
zpios_time_t rd_time;
uint64_t wr_data;
uint64_t wr_chunks;
uint64_t rd_data;
uint64_t rd_chunks;
} kpios_stats_t;
} zpios_stats_t;
#define KPIOS_CMD_MAGIC 0x49715385U
typedef struct kpios_cmd {
#define ZPIOS_CMD_MAGIC 0x49715385U
typedef struct zpios_cmd {
uint32_t cmd_magic; /* Unique magic */
uint32_t cmd_id; /* Run ID */
char cmd_pool[KPIOS_NAME_SIZE]; /* Pool name */
char cmd_pool[ZPIOS_NAME_SIZE]; /* Pool name */
uint64_t cmd_chunk_size; /* Chunk size */
uint32_t cmd_thread_count; /* Thread count */
uint32_t cmd_region_count; /* Region count */
@ -102,19 +102,19 @@ typedef struct kpios_cmd {
uint32_t cmd_chunk_noise; /* Chunk noise */
uint32_t cmd_thread_delay; /* Thread delay */
uint32_t cmd_flags; /* Test flags */
char cmd_pre[KPIOS_PATH_SIZE]; /* Pre-exec hook */
char cmd_post[KPIOS_PATH_SIZE]; /* Post-exec hook */
char cmd_log[KPIOS_PATH_SIZE]; /* Requested log dir */
char cmd_pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
char cmd_post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
char cmd_log[ZPIOS_PATH_SIZE]; /* Requested log dir */
uint64_t cmd_data_size; /* Opaque data size */
char cmd_data_str[0]; /* Opaque data region */
} kpios_cmd_t;
} zpios_cmd_t;
/* Valid ioctls */
#define KPIOS_CFG _IOWR('f', 101, long)
#define KPIOS_CMD _IOWR('f', 102, long)
#define ZPIOS_CFG _IOWR('f', 101, long)
#define ZPIOS_CMD _IOWR('f', 102, long)
/* Valid configuration commands */
#define KPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
#define KPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
#define ZPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
#define ZPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
#endif /* _KPIOS_CTL_H */
#endif /* _ZPIOS_CTL_H */

View File

@ -30,8 +30,8 @@
* CDDL HEADER END
*/
#ifndef _KPIOS_INTERNAL_H
#define _KPIOS_INTERNAL_H
#ifndef _ZPIOS_INTERNAL_H
#define _ZPIOS_INTERNAL_H
#include "zpios-ctl.h"
@ -49,26 +49,26 @@ typedef struct thread_data {
struct run_args *run_args;
int thread_no;
int rc;
kpios_stats_t stats;
zpios_stats_t stats;
kmutex_t lock;
} thread_data_t;
/* region for IO data */
typedef struct kpios_region {
typedef struct zpios_region {
__u64 wr_offset;
__u64 rd_offset;
__u64 init_offset;
__u64 max_offset;
dmu_obj_t obj;
kpios_stats_t stats;
zpios_stats_t stats;
kmutex_t lock;
} kpios_region_t;
} zpios_region_t;
/* arguments for one run */
typedef struct run_args {
/* Config args */
int id;
char pool[KPIOS_NAME_SIZE];
char pool[ZPIOS_NAME_SIZE];
__u64 chunk_size;
__u32 thread_count;
__u32 region_count;
@ -78,9 +78,9 @@ typedef struct run_args {
__u32 chunk_noise;
__u32 thread_delay;
__u32 flags;
char pre[KPIOS_PATH_SIZE];
char post[KPIOS_PATH_SIZE];
char log[KPIOS_PATH_SIZE];
char pre[ZPIOS_PATH_SIZE];
char post[ZPIOS_PATH_SIZE];
char log[ZPIOS_PATH_SIZE];
/* Control data */
objset_t *os;
@ -92,24 +92,24 @@ typedef struct run_args {
/* Results data */
struct file *file;
kpios_stats_t stats;
zpios_stats_t stats;
thread_data_t **threads;
kpios_region_t regions[0]; /* Must be last element */
zpios_region_t regions[0]; /* Must be last element */
} run_args_t;
#define KPIOS_INFO_BUFFER_SIZE 65536
#define KPIOS_INFO_BUFFER_REDZONE 1024
#define ZPIOS_INFO_BUFFER_SIZE 65536
#define ZPIOS_INFO_BUFFER_REDZONE 1024
typedef struct kpios_info {
typedef struct zpios_info {
spinlock_t info_lock;
int info_size;
char *info_buffer;
char *info_head; /* Internal kernel use only */
} kpios_info_t;
} zpios_info_t;
#define kpios_print(file, format, args...) \
({ kpios_info_t *_info_ = (kpios_info_t *)file->private_data; \
#define zpios_print(file, format, args...) \
({ zpios_info_t *_info_ = (zpios_info_t *)file->private_data; \
int _rc_; \
\
ASSERT(_info_); \
@ -119,7 +119,7 @@ typedef struct kpios_info {
\
/* Don't allow the kernel to start a write in the red zone */ \
if ((int)(_info_->info_head - _info_->info_buffer) > \
(_info_->info_size - KPIOS_INFO_BUFFER_REDZONE)) { \
(_info_->info_size - ZPIOS_INFO_BUFFER_REDZONE)) { \
_rc_ = -EOVERFLOW; \
} else { \
_rc_ = sprintf(_info_->info_head, format, args); \
@ -131,7 +131,7 @@ typedef struct kpios_info {
_rc_; \
})
#define kpios_vprint(file, test, format, args...) \
kpios_print(file, "%*s: " format, KPIOS_NAME_SIZE, test, args)
#define zpios_vprint(file, test, format, args...) \
zpios_print(file, "%*s: " format, ZPIOS_NAME_SIZE, test, args)
#endif /* _KPIOS_INTERNAL_H */
#endif /* _ZPIOS_INTERNAL_H */

View File

@ -40,7 +40,7 @@
#include "zpios-internal.h"
static struct class *kpios_class;
static struct class *zpios_class;
static inline
@ -53,7 +53,7 @@ struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
}
static
int kpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
int zpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
{
/* This is stack heavy but it should be OK since we are only
* making the upcall between tests when the stack is shallow.
@ -106,7 +106,7 @@ int kpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
}
static uint64_t
kpios_dmu_object_create(run_args_t *run_args, objset_t *os)
zpios_dmu_object_create(run_args_t *run_args, objset_t *os)
{
struct dmu_tx *tx;
uint64_t obj = 0ULL;
@ -116,7 +116,7 @@ kpios_dmu_object_create(run_args_t *run_args, objset_t *os)
dmu_tx_hold_write(tx, DMU_NEW_OBJECT, 0, OBJ_SIZE);
rc = dmu_tx_assign(tx, TXG_WAIT);
if (rc) {
kpios_print(run_args->file,
zpios_print(run_args->file,
"dmu_tx_assign() failed: %d\n", rc);
dmu_tx_abort(tx);
return obj;
@ -126,7 +126,7 @@ kpios_dmu_object_create(run_args_t *run_args, objset_t *os)
DMU_OT_NONE, 0, tx);
rc = dmu_object_set_blocksize(os, obj, 128ULL << 10, 0, tx);
if (rc) {
kpios_print(run_args->file,
zpios_print(run_args->file,
"dmu_object_set_blocksize() failed: %d\n", rc);
dmu_tx_abort(tx);
return obj;
@ -138,7 +138,7 @@ kpios_dmu_object_create(run_args_t *run_args, objset_t *os)
}
static int
kpios_dmu_object_free(run_args_t *run_args, objset_t *os, uint64_t obj)
zpios_dmu_object_free(run_args_t *run_args, objset_t *os, uint64_t obj)
{
struct dmu_tx *tx;
int rc;
@ -147,7 +147,7 @@ kpios_dmu_object_free(run_args_t *run_args, objset_t *os, uint64_t obj)
dmu_tx_hold_free(tx, obj, 0, DMU_OBJECT_END);
rc = dmu_tx_assign(tx, TXG_WAIT);
if (rc) {
kpios_print(run_args->file,
zpios_print(run_args->file,
"dmu_tx_assign() failed: %d\n", rc);
dmu_tx_abort(tx);
return rc;
@ -155,7 +155,7 @@ kpios_dmu_object_free(run_args_t *run_args, objset_t *os, uint64_t obj)
rc = dmu_object_free(os, obj, tx);
if (rc) {
kpios_print(run_args->file,
zpios_print(run_args->file,
"dmu_object_free() failed: %d\n", rc);
dmu_tx_abort(tx);
return rc;
@ -167,9 +167,9 @@ kpios_dmu_object_free(run_args_t *run_args, objset_t *os, uint64_t obj)
}
static int
kpios_dmu_setup(run_args_t *run_args)
zpios_dmu_setup(run_args_t *run_args)
{
kpios_time_t *t = &(run_args->stats.cr_time);
zpios_time_t *t = &(run_args->stats.cr_time);
objset_t *os;
uint64_t obj = 0ULL;
int i, rc = 0;
@ -178,23 +178,23 @@ kpios_dmu_setup(run_args_t *run_args)
rc = dmu_objset_open(run_args->pool, DMU_OST_ZFS, DS_MODE_USER, &os);
if (rc) {
kpios_print(run_args->file, "Error dmu_objset_open() "
zpios_print(run_args->file, "Error dmu_objset_open() "
"failed: %d\n", rc);
goto out;
}
if (!(run_args->flags & DMU_FPP)) {
obj = kpios_dmu_object_create(run_args, os);
obj = zpios_dmu_object_create(run_args, os);
if (obj == 0) {
rc = -EBADF;
kpios_print(run_args->file, "Error kpios_dmu_"
zpios_print(run_args->file, "Error zpios_dmu_"
"object_create() failed, %d\n", rc);
goto out;
}
}
for (i = 0; i < run_args->region_count; i++) {
kpios_region_t *region;
zpios_region_t *region;
region = &run_args->regions[i];
mutex_init(&region->lock, NULL, MUTEX_DEFAULT, NULL);
@ -202,7 +202,7 @@ kpios_dmu_setup(run_args_t *run_args)
if (run_args->flags & DMU_FPP) {
/* File per process */
region->obj.os = os;
region->obj.obj = kpios_dmu_object_create(run_args, os);
region->obj.obj = zpios_dmu_object_create(run_args, os);
ASSERT(region->obj.obj > 0); /* XXX - Handle this */
region->wr_offset = run_args->offset;
region->rd_offset = run_args->offset;
@ -230,25 +230,25 @@ out:
}
static int
kpios_setup_run(run_args_t **run_args, kpios_cmd_t *kcmd, struct file *file)
zpios_setup_run(run_args_t **run_args, zpios_cmd_t *kcmd, struct file *file)
{
run_args_t *ra;
int rc, size;
size = sizeof(*ra) + kcmd->cmd_region_count * sizeof(kpios_region_t);
size = sizeof(*ra) + kcmd->cmd_region_count * sizeof(zpios_region_t);
ra = vmem_zalloc(size, KM_SLEEP);
if (ra == NULL) {
kpios_print(file, "Unable to vmem_zalloc() %d bytes "
zpios_print(file, "Unable to vmem_zalloc() %d bytes "
"for regions\n", size);
return -ENOMEM;
}
*run_args = ra;
strncpy(ra->pool, kcmd->cmd_pool, KPIOS_NAME_SIZE - 1);
strncpy(ra->pre, kcmd->cmd_pre, KPIOS_PATH_SIZE - 1);
strncpy(ra->post, kcmd->cmd_post, KPIOS_PATH_SIZE - 1);
strncpy(ra->log, kcmd->cmd_log, KPIOS_PATH_SIZE - 1);
strncpy(ra->pool, kcmd->cmd_pool, ZPIOS_NAME_SIZE - 1);
strncpy(ra->pre, kcmd->cmd_pre, ZPIOS_PATH_SIZE - 1);
strncpy(ra->post, kcmd->cmd_post, ZPIOS_PATH_SIZE - 1);
strncpy(ra->log, kcmd->cmd_log, ZPIOS_PATH_SIZE - 1);
ra->id = kcmd->cmd_id;
ra->chunk_size = kcmd->cmd_chunk_size;
ra->thread_count = kcmd->cmd_thread_count;
@ -268,7 +268,7 @@ kpios_setup_run(run_args_t **run_args, kpios_cmd_t *kcmd, struct file *file)
mutex_init(&ra->lock_work, NULL, MUTEX_DEFAULT, NULL);
mutex_init(&ra->lock_ctl, NULL, MUTEX_DEFAULT, NULL);
rc = kpios_dmu_setup(ra);
rc = zpios_dmu_setup(ra);
if (rc) {
mutex_destroy(&ra->lock_ctl);
mutex_destroy(&ra->lock_work);
@ -280,8 +280,8 @@ kpios_setup_run(run_args_t **run_args, kpios_cmd_t *kcmd, struct file *file)
}
static int
kpios_get_work_item(run_args_t *run_args, dmu_obj_t *obj, __u64 *offset,
__u32 *chunk_size, kpios_region_t **region, __u32 flags)
zpios_get_work_item(run_args_t *run_args, dmu_obj_t *obj, __u64 *offset,
__u32 *chunk_size, zpios_region_t **region, __u32 flags)
{
int i, j, count = 0;
unsigned int random_int;
@ -298,7 +298,7 @@ kpios_get_work_item(run_args_t *run_args, dmu_obj_t *obj, __u64 *offset,
*/
while (count < run_args->region_count) {
__u64 *rw_offset;
kpios_time_t *rw_time;
zpios_time_t *rw_time;
j = i % run_args->region_count;
*region = &(run_args->regions[j]);
@ -346,10 +346,10 @@ kpios_get_work_item(run_args_t *run_args, dmu_obj_t *obj, __u64 *offset,
}
static void
kpios_remove_objects(run_args_t *run_args)
zpios_remove_objects(run_args_t *run_args)
{
kpios_time_t *t = &(run_args->stats.rm_time);
kpios_region_t *region;
zpios_time_t *t = &(run_args->stats.rm_time);
zpios_region_t *region;
int rc = 0, i;
t->start = current_kernel_time();
@ -358,21 +358,21 @@ kpios_remove_objects(run_args_t *run_args)
if (run_args->flags & DMU_FPP) {
for (i = 0; i < run_args->region_count; i++) {
region = &run_args->regions[i];
rc = kpios_dmu_object_free(run_args,
rc = zpios_dmu_object_free(run_args,
region->obj.os,
region->obj.obj);
if (rc)
kpios_print(run_args->file, "Error "
zpios_print(run_args->file, "Error "
"removing object %d, %d\n",
(int)region->obj.obj, rc);
}
} else {
region = &run_args->regions[0];
rc = kpios_dmu_object_free(run_args,
rc = zpios_dmu_object_free(run_args,
region->obj.os,
region->obj.obj);
if (rc)
kpios_print(run_args->file, "Error "
zpios_print(run_args->file, "Error "
"removing object %d, %d\n",
(int)region->obj.obj, rc);
}
@ -385,7 +385,7 @@ kpios_remove_objects(run_args_t *run_args)
}
static void
kpios_cleanup_run(run_args_t *run_args)
zpios_cleanup_run(run_args_t *run_args)
{
int i, size = 0;
@ -413,13 +413,13 @@ kpios_cleanup_run(run_args_t *run_args)
mutex_destroy(&run_args->lock_ctl);
if (run_args->regions != NULL)
size = run_args->region_count * sizeof(kpios_region_t);
size = run_args->region_count * sizeof(zpios_region_t);
vmem_free(run_args, sizeof(*run_args) + size);
}
static int
kpios_dmu_write(run_args_t *run_args, objset_t *os, uint64_t object,
zpios_dmu_write(run_args_t *run_args, objset_t *os, uint64_t object,
uint64_t offset, uint64_t size, const void *buf)
{
struct dmu_tx *tx;
@ -437,7 +437,7 @@ kpios_dmu_write(run_args_t *run_args, objset_t *os, uint64_t object,
dmu_tx_abort(tx);
continue;
}
kpios_print(run_args->file,
zpios_print(run_args->file,
"Error in dmu_tx_assign(), %d", rc);
dmu_tx_abort(tx);
return rc;
@ -455,7 +455,7 @@ kpios_dmu_write(run_args_t *run_args, objset_t *os, uint64_t object,
}
static int
kpios_dmu_read(run_args_t *run_args, objset_t *os, uint64_t object,
zpios_dmu_read(run_args_t *run_args, objset_t *os, uint64_t object,
uint64_t offset, uint64_t size, void *buf)
{
int flags = 0;
@ -467,16 +467,16 @@ kpios_dmu_read(run_args_t *run_args, objset_t *os, uint64_t object,
}
static int
kpios_thread_main(void *data)
zpios_thread_main(void *data)
{
thread_data_t *thr = (thread_data_t *)data;
run_args_t *run_args = thr->run_args;
kpios_time_t t;
zpios_time_t t;
dmu_obj_t obj;
__u64 offset;
__u32 chunk_size;
kpios_region_t *region;
zpios_region_t *region;
char *buf;
unsigned int random_int;
@ -511,7 +511,7 @@ kpios_thread_main(void *data)
thr->stats.wr_time.start = current_kernel_time();
mutex_exit(&thr->lock);
while (kpios_get_work_item(run_args, &obj, &offset,
while (zpios_get_work_item(run_args, &obj, &offset,
&chunk_size, &region, DMU_WRITE)) {
if (thread_delay) {
get_random_bytes(&random_int, sizeof(unsigned int));
@ -521,13 +521,13 @@ kpios_thread_main(void *data)
}
t.start = current_kernel_time();
rc = kpios_dmu_write(run_args, obj.os, obj.obj,
rc = zpios_dmu_write(run_args, obj.os, obj.obj,
offset, chunk_size, buf);
t.stop = current_kernel_time();
t.delta = timespec_sub(t.stop, t.start);
if (rc) {
kpios_print(run_args->file, "IO error while doing "
zpios_print(run_args->file, "IO error while doing "
"dmu_write(): %d\n", rc);
break;
}
@ -577,7 +577,7 @@ kpios_thread_main(void *data)
thr->stats.rd_time.start = current_kernel_time();
mutex_exit(&thr->lock);
while (kpios_get_work_item(run_args, &obj, &offset,
while (zpios_get_work_item(run_args, &obj, &offset,
&chunk_size, &region, DMU_READ)) {
if (thread_delay) {
get_random_bytes(&random_int, sizeof(unsigned int));
@ -590,13 +590,13 @@ kpios_thread_main(void *data)
memset(buf, 0, chunk_size);
t.start = current_kernel_time();
rc = kpios_dmu_read(run_args, obj.os, obj.obj,
rc = zpios_dmu_read(run_args, obj.os, obj.obj,
offset, chunk_size, buf);
t.stop = current_kernel_time();
t.delta = timespec_sub(t.stop, t.start);
if (rc) {
kpios_print(run_args->file, "IO error while doing "
zpios_print(run_args->file, "IO error while doing "
"dmu_read(): %d\n", rc);
break;
}
@ -605,7 +605,7 @@ kpios_thread_main(void *data)
if (run_args->flags & DMU_VERIFY) {
for (i = 0; i < chunk_size; i++) {
if (buf[i] != 'z') {
kpios_print(run_args->file,
zpios_print(run_args->file,
"IO verify error: %d/%d/%d\n",
(int)obj.obj, (int)offset,
(int)chunk_size);
@ -652,24 +652,24 @@ out:
}
static int
kpios_thread_done(run_args_t *run_args)
zpios_thread_done(run_args_t *run_args)
{
ASSERT(run_args->threads_done <= run_args->thread_count);
return (run_args->threads_done == run_args->thread_count);
}
static int
kpios_threads_run(run_args_t *run_args)
zpios_threads_run(run_args_t *run_args)
{
struct task_struct *tsk, **tsks;
thread_data_t *thr = NULL;
kpios_time_t *tt = &(run_args->stats.total_time);
kpios_time_t *tw = &(run_args->stats.wr_time);
kpios_time_t *tr = &(run_args->stats.rd_time);
zpios_time_t *tt = &(run_args->stats.total_time);
zpios_time_t *tw = &(run_args->stats.wr_time);
zpios_time_t *tr = &(run_args->stats.rd_time);
int i, rc = 0, tc = run_args->thread_count;
DEFINE_WAIT(wait);
kpios_upcall(run_args->pre, PHASE_PRE, run_args, 0);
zpios_upcall(run_args->pre, PHASE_PRE, run_args, 0);
tsks = kmem_zalloc(sizeof(struct task_struct *) * tc, KM_SLEEP);
if (tsks == NULL) {
@ -700,8 +700,8 @@ kpios_threads_run(run_args_t *run_args)
mutex_init(&thr->lock, NULL, MUTEX_DEFAULT, NULL);
run_args->threads[i] = thr;
tsk = kthread_create(kpios_thread_main, (void *)thr,
"%s/%d", "kpios_io", i);
tsk = kthread_create(zpios_thread_main, (void *)thr,
"%s/%d", "zpios_io", i);
if (IS_ERR(tsk)) {
rc = -EINVAL;
goto taskerr;
@ -713,13 +713,13 @@ kpios_threads_run(run_args_t *run_args)
tt->start = current_kernel_time();
/* Wake up all threads for write phase */
kpios_upcall(run_args->pre, PHASE_WRITE, run_args, 0);
zpios_upcall(run_args->pre, PHASE_WRITE, run_args, 0);
for (i = 0; i < tc; i++)
wake_up_process(tsks[i]);
/* Wait for write phase to complete */
tw->start = current_kernel_time();
wait_event(run_args->waitq, kpios_thread_done(run_args));
wait_event(run_args->waitq, zpios_thread_done(run_args));
tw->stop = current_kernel_time();
for (i = 0; i < tc; i++) {
@ -735,7 +735,7 @@ kpios_threads_run(run_args_t *run_args)
mutex_exit(&thr->lock);
}
kpios_upcall(run_args->post, PHASE_WRITE, run_args, rc);
zpios_upcall(run_args->post, PHASE_WRITE, run_args, rc);
if (rc) {
/* Wake up all threads and tell them to exit */
for (i = 0; i < tc; i++) {
@ -754,13 +754,13 @@ kpios_threads_run(run_args_t *run_args)
mutex_exit(&run_args->lock_ctl);
/* Wake up all threads for read phase */
kpios_upcall(run_args->pre, PHASE_READ, run_args, 0);
zpios_upcall(run_args->pre, PHASE_READ, run_args, 0);
for (i = 0; i < tc; i++)
wake_up_process(tsks[i]);
/* Wait for read phase to complete */
tr->start = current_kernel_time();
wait_event(run_args->waitq, kpios_thread_done(run_args));
wait_event(run_args->waitq, zpios_thread_done(run_args));
tr->stop = current_kernel_time();
for (i = 0; i < tc; i++) {
@ -776,7 +776,7 @@ kpios_threads_run(run_args_t *run_args)
mutex_exit(&thr->lock);
}
kpios_upcall(run_args->post, PHASE_READ, run_args, rc);
zpios_upcall(run_args->post, PHASE_READ, run_args, rc);
out:
tt->stop = current_kernel_time();
tt->delta = timespec_sub(tt->stop, tt->start);
@ -786,7 +786,7 @@ out:
cleanup:
kmem_free(tsks, sizeof(struct task_struct *) * tc);
cleanup2:
kpios_upcall(run_args->post, PHASE_POST, run_args, rc);
zpios_upcall(run_args->post, PHASE_POST, run_args, rc);
/* Returns first encountered thread error (if any) */
return rc;
@ -801,30 +801,30 @@ taskerr:
}
static int
kpios_do_one_run(struct file *file, kpios_cmd_t *kcmd,
zpios_do_one_run(struct file *file, zpios_cmd_t *kcmd,
int data_size, void *data)
{
run_args_t *run_args;
kpios_stats_t *stats = (kpios_stats_t *)data;
zpios_stats_t *stats = (zpios_stats_t *)data;
int i, n, m, size, rc;
if ((!kcmd->cmd_chunk_size) || (!kcmd->cmd_region_size) ||
(!kcmd->cmd_thread_count) || (!kcmd->cmd_region_count)) {
kpios_print(file, "Invalid chunk_size, region_size, "
zpios_print(file, "Invalid chunk_size, region_size, "
"thread_count, or region_count, %d\n", -EINVAL);
return -EINVAL;
}
if (!(kcmd->cmd_flags & DMU_WRITE) ||
!(kcmd->cmd_flags & DMU_READ)) {
kpios_print(file, "Invalid flags, minimally DMU_WRITE "
zpios_print(file, "Invalid flags, minimally DMU_WRITE "
"and DMU_READ must be set, %d\n", -EINVAL);
return -EINVAL;
}
if ((kcmd->cmd_flags & (DMU_WRITE_ZC | DMU_READ_ZC)) &&
(kcmd->cmd_flags & DMU_VERIFY)) {
kpios_print(file, "Invalid flags, DMU_*_ZC incompatible "
zpios_print(file, "Invalid flags, DMU_*_ZC incompatible "
"with DMU_VERIFY, used for performance analysis "
"only, %d\n", -EINVAL);
return -EINVAL;
@ -832,28 +832,28 @@ kpios_do_one_run(struct file *file, kpios_cmd_t *kcmd,
/* Opaque data on return contains structs of the following form:
*
* kpios_stat_t stats[];
* zpios_stat_t stats[];
* stats[0] = run_args->stats;
* stats[1-N] = threads[N]->stats;
* stats[N+1-M] = regions[M]->stats;
*
* Where N is the number of threads, and M is the number of regions.
*/
size = (sizeof(kpios_stats_t) +
(kcmd->cmd_thread_count * sizeof(kpios_stats_t)) +
(kcmd->cmd_region_count * sizeof(kpios_stats_t)));
size = (sizeof(zpios_stats_t) +
(kcmd->cmd_thread_count * sizeof(zpios_stats_t)) +
(kcmd->cmd_region_count * sizeof(zpios_stats_t)));
if (data_size < size) {
kpios_print(file, "Invalid size, command data buffer "
zpios_print(file, "Invalid size, command data buffer "
"size too small, (%d < %d)\n", data_size, size);
return -ENOSPC;
}
rc = kpios_setup_run(&run_args, kcmd, file);
rc = zpios_setup_run(&run_args, kcmd, file);
if (rc)
return rc;
rc = kpios_threads_run(run_args);
kpios_remove_objects(run_args);
rc = zpios_threads_run(run_args);
zpios_remove_objects(run_args);
if (rc)
goto cleanup;
@ -870,26 +870,26 @@ kpios_do_one_run(struct file *file, kpios_cmd_t *kcmd,
}
cleanup:
kpios_cleanup_run(run_args);
zpios_cleanup_run(run_args);
return rc;
}
static int
kpios_open(struct inode *inode, struct file *file)
zpios_open(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode);
kpios_info_t *info;
zpios_info_t *info;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
info = (kpios_info_t *)kmem_alloc(sizeof(*info), KM_SLEEP);
info = (zpios_info_t *)kmem_alloc(sizeof(*info), KM_SLEEP);
if (info == NULL)
return -ENOMEM;
spin_lock_init(&info->info_lock);
info->info_size = KPIOS_INFO_BUFFER_SIZE;
info->info_buffer = (char *)vmem_alloc(KPIOS_INFO_BUFFER_SIZE,KM_SLEEP);
info->info_size = ZPIOS_INFO_BUFFER_SIZE;
info->info_buffer = (char *)vmem_alloc(ZPIOS_INFO_BUFFER_SIZE,KM_SLEEP);
if (info->info_buffer == NULL) {
kmem_free(info, sizeof(*info));
return -ENOMEM;
@ -902,27 +902,27 @@ kpios_open(struct inode *inode, struct file *file)
}
static int
kpios_release(struct inode *inode, struct file *file)
zpios_release(struct inode *inode, struct file *file)
{
unsigned int minor = iminor(inode);
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
ASSERT(info);
ASSERT(info->info_buffer);
vmem_free(info->info_buffer, KPIOS_INFO_BUFFER_SIZE);
vmem_free(info->info_buffer, ZPIOS_INFO_BUFFER_SIZE);
kmem_free(info, sizeof(*info));
return 0;
}
static int
kpios_buffer_clear(struct file *file, kpios_cfg_t *kcfg, unsigned long arg)
zpios_buffer_clear(struct file *file, zpios_cfg_t *kcfg, unsigned long arg)
{
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
ASSERT(info);
ASSERT(info->info_buffer);
@ -936,9 +936,9 @@ kpios_buffer_clear(struct file *file, kpios_cfg_t *kcfg, unsigned long arg)
}
static int
kpios_buffer_size(struct file *file, kpios_cfg_t *kcfg, unsigned long arg)
zpios_buffer_size(struct file *file, zpios_cfg_t *kcfg, unsigned long arg)
{
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
char *buf;
int min, size, rc = 0;
@ -967,7 +967,7 @@ kpios_buffer_size(struct file *file, kpios_cfg_t *kcfg, unsigned long arg)
kcfg->cfg_rc1 = info->info_size;
if (copy_to_user((struct kpios_cfg_t __user *)arg, kcfg, sizeof(*kcfg)))
if (copy_to_user((struct zpios_cfg_t __user *)arg, kcfg, sizeof(*kcfg)))
rc = -EFAULT;
out:
spin_unlock(&info->info_lock);
@ -976,35 +976,35 @@ out:
}
static int
kpios_ioctl_cfg(struct file *file, unsigned long arg)
zpios_ioctl_cfg(struct file *file, unsigned long arg)
{
kpios_cfg_t kcfg;
zpios_cfg_t kcfg;
int rc = 0;
if (copy_from_user(&kcfg, (kpios_cfg_t *)arg, sizeof(kcfg)))
if (copy_from_user(&kcfg, (zpios_cfg_t *)arg, sizeof(kcfg)))
return -EFAULT;
if (kcfg.cfg_magic != KPIOS_CFG_MAGIC) {
kpios_print(file, "Bad config magic 0x%x != 0x%x\n",
kcfg.cfg_magic, KPIOS_CFG_MAGIC);
if (kcfg.cfg_magic != ZPIOS_CFG_MAGIC) {
zpios_print(file, "Bad config magic 0x%x != 0x%x\n",
kcfg.cfg_magic, ZPIOS_CFG_MAGIC);
return -EINVAL;
}
switch (kcfg.cfg_cmd) {
case KPIOS_CFG_BUFFER_CLEAR:
case ZPIOS_CFG_BUFFER_CLEAR:
/* cfg_arg1 - Unused
* cfg_rc1 - Unused
*/
rc = kpios_buffer_clear(file, &kcfg, arg);
rc = zpios_buffer_clear(file, &kcfg, arg);
break;
case KPIOS_CFG_BUFFER_SIZE:
case ZPIOS_CFG_BUFFER_SIZE:
/* cfg_arg1 - 0 - query size; >0 resize
* cfg_rc1 - Set to current buffer size
*/
rc = kpios_buffer_size(file, &kcfg, arg);
rc = zpios_buffer_size(file, &kcfg, arg);
break;
default:
kpios_print(file, "Bad config command %d\n",
zpios_print(file, "Bad config command %d\n",
kcfg.cfg_cmd);
rc = -EINVAL;
break;
@ -1014,22 +1014,22 @@ kpios_ioctl_cfg(struct file *file, unsigned long arg)
}
static int
kpios_ioctl_cmd(struct file *file, unsigned long arg)
zpios_ioctl_cmd(struct file *file, unsigned long arg)
{
kpios_cmd_t kcmd;
zpios_cmd_t kcmd;
int rc = -EINVAL;
void *data = NULL;
rc = copy_from_user(&kcmd, (kpios_cfg_t *)arg, sizeof(kcmd));
rc = copy_from_user(&kcmd, (zpios_cfg_t *)arg, sizeof(kcmd));
if (rc) {
kpios_print(file, "Unable to copy command structure "
zpios_print(file, "Unable to copy command structure "
"from user to kernel memory, %d\n", rc);
return -EFAULT;
}
if (kcmd.cmd_magic != KPIOS_CMD_MAGIC) {
kpios_print(file, "Bad command magic 0x%x != 0x%x\n",
kcmd.cmd_magic, KPIOS_CFG_MAGIC);
if (kcmd.cmd_magic != ZPIOS_CMD_MAGIC) {
zpios_print(file, "Bad command magic 0x%x != 0x%x\n",
kcmd.cmd_magic, ZPIOS_CFG_MAGIC);
return -EINVAL;
}
@ -1037,33 +1037,33 @@ kpios_ioctl_cmd(struct file *file, unsigned long arg)
if (kcmd.cmd_data_size > 0) {
data = (void *)vmem_alloc(kcmd.cmd_data_size, KM_SLEEP);
if (data == NULL) {
kpios_print(file, "Unable to vmem_alloc() %ld "
zpios_print(file, "Unable to vmem_alloc() %ld "
"bytes for data buffer\n",
(long)kcmd.cmd_data_size);
return -ENOMEM;
}
rc = copy_from_user(data, (void *)(arg + offsetof(kpios_cmd_t,
rc = copy_from_user(data, (void *)(arg + offsetof(zpios_cmd_t,
cmd_data_str)), kcmd.cmd_data_size);
if (rc) {
kpios_print(file, "Unable to copy data buffer "
zpios_print(file, "Unable to copy data buffer "
"from user to kernel memory, %d\n", rc);
vmem_free(data, kcmd.cmd_data_size);
return -EFAULT;
}
}
rc = kpios_do_one_run(file, &kcmd, kcmd.cmd_data_size, data);
rc = zpios_do_one_run(file, &kcmd, kcmd.cmd_data_size, data);
if (data != NULL) {
/* If the test failed do not print out the stats */
if (rc)
goto cleanup;
rc = copy_to_user((void *)(arg + offsetof(kpios_cmd_t,
rc = copy_to_user((void *)(arg + offsetof(zpios_cmd_t,
cmd_data_str)), data, kcmd.cmd_data_size);
if (rc) {
kpios_print(file, "Unable to copy data buffer "
zpios_print(file, "Unable to copy data buffer "
"from kernel to user memory, %d\n", rc);
rc = -EFAULT;
}
@ -1076,7 +1076,7 @@ cleanup:
}
static int
kpios_ioctl(struct inode *inode, struct file *file,
zpios_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
@ -1086,18 +1086,18 @@ kpios_ioctl(struct inode *inode, struct file *file,
if ((cmd & 0xffffff00) == ((int)'T') << 8)
return -ENOTTY;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
switch (cmd) {
case KPIOS_CFG:
rc = kpios_ioctl_cfg(file, arg);
case ZPIOS_CFG:
rc = zpios_ioctl_cfg(file, arg);
break;
case KPIOS_CMD:
rc = kpios_ioctl_cmd(file, arg);
case ZPIOS_CMD:
rc = zpios_ioctl_cmd(file, arg);
break;
default:
kpios_print(file, "Bad ioctl command %d\n", cmd);
zpios_print(file, "Bad ioctl command %d\n", cmd);
rc = -EINVAL;
break;
}
@ -1110,14 +1110,14 @@ kpios_ioctl(struct inode *inode, struct file *file,
* back to the user space, but I don't see any reason to prevent it.
*/
static ssize_t
kpios_write(struct file *file, const char __user *buf,
zpios_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = 0;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
ASSERT(info);
@ -1148,14 +1148,14 @@ out:
}
static ssize_t
kpios_read(struct file *file, char __user *buf,
zpios_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = 0;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
ASSERT(info);
@ -1183,13 +1183,13 @@ out:
return rc;
}
static loff_t kpios_seek(struct file *file, loff_t offset, int origin)
static loff_t zpios_seek(struct file *file, loff_t offset, int origin)
{
unsigned int minor = iminor(file->f_dentry->d_inode);
kpios_info_t *info = (kpios_info_t *)file->private_data;
zpios_info_t *info = (zpios_info_t *)file->private_data;
int rc = -EINVAL;
if (minor >= KPIOS_MINORS)
if (minor >= ZPIOS_MINORS)
return -ENXIO;
ASSERT(info);
@ -1219,73 +1219,73 @@ static loff_t kpios_seek(struct file *file, loff_t offset, int origin)
return rc;
}
static struct file_operations kpios_fops = {
static struct file_operations zpios_fops = {
.owner = THIS_MODULE,
.open = kpios_open,
.release = kpios_release,
.ioctl = kpios_ioctl,
.read = kpios_read,
.write = kpios_write,
.llseek = kpios_seek,
.open = zpios_open,
.release = zpios_release,
.ioctl = zpios_ioctl,
.read = zpios_read,
.write = zpios_write,
.llseek = zpios_seek,
};
static struct cdev kpios_cdev = {
static struct cdev zpios_cdev = {
.owner = THIS_MODULE,
.kobj = { .name = "kpios", },
.kobj = { .name = "zpios", },
};
static int __init
kpios_init(void)
zpios_init(void)
{
dev_t dev;
int rc;
dev = MKDEV(KPIOS_MAJOR, 0);
if ((rc = register_chrdev_region(dev, KPIOS_MINORS, "kpios")))
dev = MKDEV(ZPIOS_MAJOR, 0);
if ((rc = register_chrdev_region(dev, ZPIOS_MINORS, "zpios")))
goto error;
/* Support for registering a character driver */
cdev_init(&kpios_cdev, &kpios_fops);
if ((rc = cdev_add(&kpios_cdev, dev, KPIOS_MINORS))) {
printk(KERN_ERR "kpios: Error adding cdev, %d\n", rc);
kobject_put(&kpios_cdev.kobj);
unregister_chrdev_region(dev, KPIOS_MINORS);
cdev_init(&zpios_cdev, &zpios_fops);
if ((rc = cdev_add(&zpios_cdev, dev, ZPIOS_MINORS))) {
printk(KERN_ERR "ZPIOS: Error adding cdev, %d\n", rc);
kobject_put(&zpios_cdev.kobj);
unregister_chrdev_region(dev, ZPIOS_MINORS);
goto error;
}
/* Support for udev make driver info available in sysfs */
kpios_class = class_create(THIS_MODULE, "kpios");
if (IS_ERR(kpios_class)) {
rc = PTR_ERR(kpios_class);
printk(KERN_ERR "kpios: Error creating kpios class, %d\n", rc);
cdev_del(&kpios_cdev);
unregister_chrdev_region(dev, KPIOS_MINORS);
zpios_class = class_create(THIS_MODULE, "zpios");
if (IS_ERR(zpios_class)) {
rc = PTR_ERR(zpios_class);
printk(KERN_ERR "ZPIOS: Error creating zpios class, %d\n", rc);
cdev_del(&zpios_cdev);
unregister_chrdev_region(dev, ZPIOS_MINORS);
goto error;
}
class_device_create(kpios_class, NULL, dev, NULL, "kpios");
class_device_create(zpios_class, NULL, dev, NULL, "zpios");
return 0;
error:
printk(KERN_ERR "kpios: Error registering kpios device, %d\n", rc);
printk(KERN_ERR "ZPIOS: Error registering zpios device, %d\n", rc);
return rc;
}
static void
kpios_fini(void)
zpios_fini(void)
{
dev_t dev = MKDEV(KPIOS_MAJOR, 0);
dev_t dev = MKDEV(ZPIOS_MAJOR, 0);
class_device_destroy(kpios_class, dev);
class_destroy(kpios_class);
class_device_destroy(zpios_class, dev);
class_destroy(zpios_class);
cdev_del(&kpios_cdev);
unregister_chrdev_region(dev, KPIOS_MINORS);
cdev_del(&zpios_cdev);
unregister_chrdev_region(dev, ZPIOS_MINORS);
return;
}
module_init(kpios_init);
module_exit(kpios_fini);
module_init(zpios_init);
module_exit(zpios_fini);
MODULE_AUTHOR("LLNL / Sun");
MODULE_DESCRIPTION("Kernel PIOS implementation");

View File

@ -43,7 +43,7 @@ for PID_FILE in `ls -r --sort=time --time=ctime ${RUN_LOG_DIR}/${RUN_ID}/pids-[0
txg_timelimit) IDX=15;;
arc_reclaim) IDX=16;;
l2arc_feed) IDX=17;;
kpios_io) IDX=18;;
zpios_io) IDX=18;;
*) continue;;
esac
@ -55,7 +55,7 @@ for PID_FILE in `ls -r --sort=time --time=ctime ${RUN_LOG_DIR}/${RUN_ID}/pids-[0
"zio_req_rd, zio_irq_rd, zio_req_wr, zio_irq_wr, " \
"zio_req_fr, zio_irq_fr, zio_req_cm, zio_irq_cm, " \
"zio_req_ctl, zio_irq_ctl, txg_quiesce, txg_sync, " \
"txg_timelimit, arc_reclaim, l2arc_feed, kpios_io, " \
"txg_timelimit, arc_reclaim, l2arc_feed, zpios_io, " \
"idle"
HEADER=0
fi

View File

@ -21,7 +21,7 @@ POLL_INTERVAL=2.99
# txg_timelimit_t
# arc_reclaim_thr
# l2arc_feed_thre
# kpios_io/#
# zpios_io/#
ZIO_TASKQ_PIDS=()
ZIO_REQ_NUL_PIDS=()
@ -44,7 +44,7 @@ TXG_TIMELIMIT_PIDS=()
ARC_RECLAIM_PIDS=()
L2ARC_FEED_PIDS=()
KPIOS_IO_PIDS=()
ZPIOS_IO_PIDS=()
show_pids() {
echo "* zio_taskq: { ${ZIO_TASKQ_PIDS[@]} } = ${#ZIO_TASKQ_PIDS[@]}"
@ -65,7 +65,7 @@ show_pids() {
echo "* txg_timelimit: { ${TXG_TIMELIMIT_PIDS[@]} } = ${#TXG_TIMELIMIT_PIDS[@]}"
echo "* arc_reclaim: { ${ARC_RECLAIM_PIDS[@]} } = ${#ARC_RECLAIM_PIDS[@]}"
echo "* l2arc_feed: { ${L2ARC_FEED_PIDS[@]} } = ${#L2ARC_FEED_PIDS[@]}"
echo "* kpios_io: { ${KPIOS_IO_PIDS[@]} } = ${#KPIOS_IO_PIDS[@]}"
echo "* zpios_io: { ${ZPIOS_IO_PIDS[@]} } = ${#ZPIOS_IO_PIDS[@]}"
}
check_pid() {
@ -154,13 +154,13 @@ aquire_pids() {
"$(echo "${L2ARC_FEED_PIDS[@]}")"` )
done
# Wait for kpios_io threads to start
# Wait for zpios_io threads to start
kill -s SIGHUP ${PPID}
echo "* Waiting for kpios_io threads to start"
echo "* Waiting for zpios_io threads to start"
while [ ${RUN_DONE} -eq 0 ]; do
KPIOS_IO_PIDS=( `ps ax | grep kpios_io | grep -v grep | \
ZPIOS_IO_PIDS=( `ps ax | grep zpios_io | grep -v grep | \
sed 's/^ *//g' | cut -f1 -d' '` )
if [ ${#KPIOS_IO_PIDS[@]} -gt 0 ]; then
if [ ${#ZPIOS_IO_PIDS[@]} -gt 0 ]; then
break;
fi
sleep 0.1
@ -189,7 +189,7 @@ log_pids() {
${TXG_TIMELIMIT_PIDS[@]} \
${ARC_RECLAIM_PIDS[@]} \
${L2ARC_FEED_PIDS[@]} \
${KPIOS_IO_PIDS[@]} )
${ZPIOS_IO_PIDS[@]} )
while [ ${RUN_DONE} -eq 0 ]; do
NOW=`date +%s.%N`

View File

@ -3,7 +3,7 @@
prog=zpios.sh
. ../.script-config
SPL_OPTIONS="spl=spl_debug_mask=-1 spl_debug_subsys=-1 spl_debug_mb=10 ${1}"
SPL_OPTIONS="spl=spl_debug_mask=0 spl_debug_subsys=0 spl_debug_mb=-1 ${1}"
ZFS_OPTIONS="zfs=${2}"
ZPIOS_OPTIONS=$3
PROFILE_ZPIOS_LOGS=$4