diff options
author | Brian Behlendorf <[email protected]> | 2010-09-04 13:26:23 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-09-08 12:38:56 -0700 |
commit | 6283f55ea1b91e680386388c17d14b89e344fa8d (patch) | |
tree | 2d475646019ffc2cf23c62a64de77cd220c53ebd /module/zpios | |
parent | 5e6121455c0b941f4612ceb2c1f312d527534b46 (diff) |
Support custom build directories and move includes
One of the neat tricks an autoconf style project is capable of
is allow configurion/building in a directory other than the
source directory. The major advantage to this is that you can
build the project various different ways while making changes
in a single source tree.
For example, this project is designed to work on various different
Linux distributions each of which work slightly differently. This
means that changes need to verified on each of those supported
distributions perferably before the change is committed to the
public git repo.
Using nfs and custom build directories makes this much easier.
I now have a single source tree in nfs mounted on several different
systems each running a supported distribution. When I make a
change to the source base I suspect may break things I can
concurrently build from the same source on all the systems each
in their own subdirectory.
wget -c http://github.com/downloads/behlendorf/zfs/zfs-x.y.z.tar.gz
tar -xzf zfs-x.y.z.tar.gz
cd zfs-x-y-z
------------------------- run concurrently ----------------------
<ubuntu system> <fedora system> <debian system> <rhel6 system>
mkdir ubuntu mkdir fedora mkdir debian mkdir rhel6
cd ubuntu cd fedora cd debian cd rhel6
../configure ../configure ../configure ../configure
make make make make
make check make check make check make check
This change also moves many of the include headers from individual
incude/sys directories under the modules directory in to a single
top level include directory. This has the advantage of making
the build rules cleaner and logically it makes a bit more sense.
Diffstat (limited to 'module/zpios')
-rw-r--r-- | module/zpios/Makefile.in | 15 | ||||
-rw-r--r-- | module/zpios/include/zpios-ctl.h | 198 | ||||
-rw-r--r-- | module/zpios/include/zpios-internal.h | 138 | ||||
-rw-r--r-- | module/zpios/pios.c (renamed from module/zpios/zpios.c) | 0 |
4 files changed, 7 insertions, 344 deletions
diff --git a/module/zpios/Makefile.in b/module/zpios/Makefile.in index 4924082a1..93a89a914 100644 --- a/module/zpios/Makefile.in +++ b/module/zpios/Makefile.in @@ -1,11 +1,10 @@ MODULE := zpios -EXTRA_CFLAGS = -I@MODDIR@/zfs/include -EXTRA_CFLAGS += -I@MODDIR@/zcommon/include -EXTRA_CFLAGS += -I@MODDIR@/avl/include -EXTRA_CFLAGS += -I@MODDIR@/nvpair/include -EXTRA_CFLAGS += -I@MODDIR@/unicode/include -EXTRA_CFLAGS += -I@MODDIR@/zpios/include -EXTRA_CFLAGS += @KERNELCPPFLAGS@ +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -include @SPL_OBJ@/spl_config.h +EXTRA_CFLAGS += -include @abs_top_builddir@/zfs_config.h +EXTRA_CFLAGS += -I@abs_top_srcdir@/include -I@SPL@/include -I@SPL@ -obj-m := ${MODULE}.o +obj-m := $(MODULE).o + +$(MODULE)-objs += @top_srcdir@/module/zpios/pios.o diff --git a/module/zpios/include/zpios-ctl.h b/module/zpios/include/zpios-ctl.h deleted file mode 100644 index 234e96c11..000000000 --- a/module/zpios/include/zpios-ctl.h +++ /dev/null @@ -1,198 +0,0 @@ -/*****************************************************************************\ - * ZPIOS is a heavily modified version of the original PIOS test code. - * It is designed to have the test code running in the Linux kernel - * against ZFS while still being flexibly controled from user space. - * - * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * LLNL-CODE-403049 - * - * Original PIOS Test Code - * Copyright (C) 2004 Cluster File Systems, Inc. - * Written by Peter Braam <[email protected]> - * Atul Vidwansa <[email protected]> - * Milind Dumbare <[email protected]> - * - * This file is part of ZFS on Linux. - * For details, see <http://github.com/behlendorf/zfs/>. - * - * ZPIOS is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * ZPIOS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with ZPIOS. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ - -#ifndef _ZPIOS_CTL_H -#define _ZPIOS_CTL_H - -/* Contains shared definitions which both the userspace - * and kernelspace portions of zpios must agree on. - */ -#ifndef _KERNEL -#include <stdint.h> -#endif - -#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */ -#define ZPIOS_MINORS 1 -#define ZPIOS_NAME "zpios" -#define ZPIOS_DEV "/dev/zpios" - -#define DMU_IO 0x01 - -#define DMU_WRITE 0x0001 -#define DMU_READ 0x0002 -#define DMU_VERIFY 0x0004 -#define DMU_REMOVE 0x0008 -#define DMU_FPP 0x0010 -#define DMU_WRITE_ZC 0x0020 /* Incompatible w/DMU_VERIFY */ -#define DMU_READ_ZC 0x0040 /* Incompatible w/DMU_VERIFY */ -#define DMU_WRITE_NOWAIT 0x0080 -#define DMU_READ_NOPF 0x0100 - -#define ZPIOS_NAME_SIZE 16 -#define ZPIOS_PATH_SIZE 128 - -#define PHASE_PRE_RUN "pre-run" -#define PHASE_PRE_CREATE "pre-create" -#define PHASE_PRE_WRITE "pre-write" -#define PHASE_PRE_READ "pre-read" -#define PHASE_PRE_REMOVE "pre-remove" -#define PHASE_POST_RUN "post-run" -#define PHASE_POST_CREATE "post-create" -#define PHASE_POST_WRITE "post-write" -#define PHASE_POST_READ "post-read" -#define PHASE_POST_REMOVE "post-remove" - -#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 */ -} zpios_cfg_t; - -typedef struct zpios_timespec { - uint32_t ts_sec; - uint32_t ts_nsec; -} zpios_timespec_t; - -typedef struct zpios_time { - zpios_timespec_t start; - zpios_timespec_t stop; - zpios_timespec_t delta; -} zpios_time_t; - -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; -} zpios_stats_t; - -#define ZPIOS_CMD_MAGIC 0x49715385U -typedef struct zpios_cmd { - uint32_t cmd_magic; /* Unique magic */ - uint32_t cmd_id; /* Run ID */ - 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 */ - uint64_t cmd_region_size; /* Region size */ - uint64_t cmd_offset; /* Region offset */ - uint32_t cmd_region_noise; /* Region noise */ - uint32_t cmd_chunk_noise; /* Chunk noise */ - uint32_t cmd_thread_delay; /* Thread delay */ - uint32_t cmd_flags; /* Test flags */ - 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 */ -} zpios_cmd_t; - -/* Valid ioctls */ -#define ZPIOS_CFG _IOWR('f', 101, zpios_cfg_t) -#define ZPIOS_CMD _IOWR('f', 102, zpios_cmd_t) - -/* Valid configuration commands */ -#define ZPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ -#define ZPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ - -#ifndef NSEC_PER_SEC -#define NSEC_PER_SEC 1000000000L -#endif - -static inline -void zpios_timespec_normalize(zpios_timespec_t *ts, uint32_t sec, uint32_t nsec) -{ - while (nsec >= NSEC_PER_SEC) { - nsec -= NSEC_PER_SEC; - sec++; - } - while (nsec < 0) { - nsec += NSEC_PER_SEC; - sec--; - } - ts->ts_sec = sec; - ts->ts_nsec = nsec; -} - -static inline -zpios_timespec_t zpios_timespec_add(zpios_timespec_t lhs, zpios_timespec_t rhs) -{ - zpios_timespec_t ts_delta; - zpios_timespec_normalize(&ts_delta, lhs.ts_sec + rhs.ts_sec, - lhs.ts_nsec + rhs.ts_nsec); - return ts_delta; -} - -static inline -zpios_timespec_t zpios_timespec_sub(zpios_timespec_t lhs, zpios_timespec_t rhs) -{ - zpios_timespec_t ts_delta; - zpios_timespec_normalize(&ts_delta, lhs.ts_sec - rhs.ts_sec, - lhs.ts_nsec - rhs.ts_nsec); - return ts_delta; -} - -#ifdef _KERNEL - -static inline -zpios_timespec_t zpios_timespec_now(void) -{ - zpios_timespec_t zts_now; - struct timespec ts_now; - - ts_now = current_kernel_time(); - zts_now.ts_sec = ts_now.tv_sec; - zts_now.ts_nsec = ts_now.tv_nsec; - - return zts_now; -} - -#else - -static inline -double zpios_timespec_to_double(zpios_timespec_t ts) -{ - return ((double)(ts.ts_sec) + - ((double)(ts.ts_nsec) / (double)(NSEC_PER_SEC))); -} - -#endif /* _KERNEL */ - -#endif /* _ZPIOS_CTL_H */ diff --git a/module/zpios/include/zpios-internal.h b/module/zpios/include/zpios-internal.h deleted file mode 100644 index c9b6e0092..000000000 --- a/module/zpios/include/zpios-internal.h +++ /dev/null @@ -1,138 +0,0 @@ -/*****************************************************************************\ - * ZPIOS is a heavily modified version of the original PIOS test code. - * It is designed to have the test code running in the Linux kernel - * against ZFS while still being flexibly controled from user space. - * - * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf <[email protected]>. - * LLNL-CODE-403049 - * - * Original PIOS Test Code - * Copyright (C) 2004 Cluster File Systems, Inc. - * Written by Peter Braam <[email protected]> - * Atul Vidwansa <[email protected]> - * Milind Dumbare <[email protected]> - * - * This file is part of ZFS on Linux. - * For details, see <http://github.com/behlendorf/zfs/>. - * - * ZPIOS is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * ZPIOS is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with ZPIOS. If not, see <http://www.gnu.org/licenses/>. -\*****************************************************************************/ - -#ifndef _ZPIOS_INTERNAL_H -#define _ZPIOS_INTERNAL_H - -#include "zpios-ctl.h" - -#define OBJ_SIZE 64 - -struct run_args; - -typedef struct dmu_obj { - objset_t *os; - uint64_t obj; -} dmu_obj_t; - -/* thread doing the IO data */ -typedef struct thread_data { - struct run_args *run_args; - int thread_no; - int rc; - zpios_stats_t stats; - kmutex_t lock; -} thread_data_t; - -/* region for IO data */ -typedef struct zpios_region { - __u64 wr_offset; - __u64 rd_offset; - __u64 init_offset; - __u64 max_offset; - dmu_obj_t obj; - zpios_stats_t stats; - kmutex_t lock; -} zpios_region_t; - -/* arguments for one run */ -typedef struct run_args { - /* Config args */ - int id; - char pool[ZPIOS_NAME_SIZE]; - __u64 chunk_size; - __u32 thread_count; - __u32 region_count; - __u64 region_size; - __u64 offset; - __u32 region_noise; - __u32 chunk_noise; - __u32 thread_delay; - __u32 flags; - char pre[ZPIOS_PATH_SIZE]; - char post[ZPIOS_PATH_SIZE]; - char log[ZPIOS_PATH_SIZE]; - - /* Control data */ - objset_t *os; - wait_queue_head_t waitq; - volatile uint64_t threads_done; - kmutex_t lock_work; - kmutex_t lock_ctl; - __u32 region_next; - - /* Results data */ - struct file *file; - zpios_stats_t stats; - - thread_data_t **threads; - zpios_region_t regions[0]; /* Must be last element */ -} run_args_t; - -#define ZPIOS_INFO_BUFFER_SIZE 65536 -#define ZPIOS_INFO_BUFFER_REDZONE 1024 - -typedef struct zpios_info { - spinlock_t info_lock; - int info_size; - char *info_buffer; - char *info_head; /* Internal kernel use only */ -} zpios_info_t; - -#define zpios_print(file, format, args...) \ -({ zpios_info_t *_info_ = (zpios_info_t *)file->private_data; \ - int _rc_; \ - \ - ASSERT(_info_); \ - ASSERT(_info_->info_buffer); \ - \ - spin_lock(&_info_->info_lock); \ - \ - /* Don't allow the kernel to start a write in the red zone */ \ - if ((int)(_info_->info_head - _info_->info_buffer) > \ - (_info_->info_size - ZPIOS_INFO_BUFFER_REDZONE)) { \ - _rc_ = -EOVERFLOW; \ - } else { \ - _rc_ = sprintf(_info_->info_head, format, args); \ - if (_rc_ >= 0) \ - _info_->info_head += _rc_; \ - } \ - \ - spin_unlock(&_info_->info_lock); \ - _rc_; \ -}) - -#define zpios_vprint(file, test, format, args...) \ - zpios_print(file, "%*s: " format, ZPIOS_NAME_SIZE, test, args) - -#endif /* _ZPIOS_INTERNAL_H */ diff --git a/module/zpios/zpios.c b/module/zpios/pios.c index 3edc16105..3edc16105 100644 --- a/module/zpios/zpios.c +++ b/module/zpios/pios.c |