freebsd-dev/include/zpios-internal.h
Don Brady 56b3986316 Add large block support to zpios(1) benchmark
As part of the large block support effort, it makes sense to add
support for large blocks to **zpios(1)**. The specifying of a zfs
block size for zpios is optional and will default to 128K if the
block size is not specified.

  `zpios ... -S size | --blocksize size ...`

This will use *size* ZFS blocks for each test, specified as a comma
delimited list with an optional unit suffix. The supported range is
powers of two from 128K through 16M. A range of block sizes can be
tested as follows: `-S 128K,256K,512K,1M`

Example run below
(non realistic results from a VM and output abbreviated for space)

```
 --regioncount=750 --regionsize=8M --chunksize=1M --offset=4K
 --threaddelay=0 --cleanup --human-readable --verbose --cleanup
 --blocksize=128K,256K,512K,1M

 th-cnt  rg-cnt  rg-sz  ch-sz  blksz  wr-data wr-bw   rd-data rd-bw
---------------------------------------------------------------------
 4       750     8m     1m     128k   5g      90.06m  5g      93.37m
 4       750     8m     1m     256k   5g      79.71m  5g      99.81m
 4       750     8m     1m     512k   5g      42.20m  5g      93.14m
 4       750     8m     1m     1m     5g      35.51m  5g      89.36m
 8       750     8m     1m     128k   5g      85.49m  5g      90.81m
 8       750     8m     1m     256k   5g      61.42m  5g      99.24m
 8       750     8m     1m     512k   5g      49.09m  5g     108.78m
 16      750     8m     1m     128k   5g      86.28m  5g      88.73m
 16      750     8m     1m     256k   5g      64.34m  5g      93.47m
 16      750     8m     1m     512k   5g      68.84m  5g     124.47m
 16      750     8m     1m     1m     5g      53.97m  5g      97.20m
---------------------------------------------------------------------
```

Signed-off-by: Don Brady <don.brady@intel.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3795
Closes #2071
2015-09-22 09:13:20 -07:00

116 lines
2.9 KiB
C

/*
* 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 <behlendorf1@llnl.gov>.
* LLNL-CODE-403049
*
* Original PIOS Test Code
* Copyright (C) 2004 Cluster File Systems, Inc.
* Written by Peter Braam <braam@clusterfs.com>
* Atul Vidwansa <atul@clusterfs.com>
* Milind Dumbare <milind@clusterfs.com>
*
* This file is part of ZFS on Linux.
* For details, see <http://zfsonlinux.org/>.
*
* 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/>.
*
* Copyright (c) 2015, Intel Corporation.
*/
#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;
__u32 block_size;
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;
#endif /* _ZPIOS_INTERNAL_H */