+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc.
* All Rights Reserved.
- *
- * This program 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.
- *
- * This program is distributed in the hope that it would 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 this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* iogen - a tool for generating file/sds io for a doio process
int Naio_Strat_Types = 0; /* # async io completion types */
struct strmap *Aio_Strat_List[128]; /* Async io completion types */
-void startup_info();
+void startup_info(FILE *stream, int seed);
/*
* Map async io completion modes (-a args) names to values. Macros are
{ "write", WRITE, SY_WRITE },
{ "pread", PREAD },
{ "pwrite", PWRITE, SY_WRITE },
-#ifndef NO_XFS
{ "resvsp", RESVSP, SY_WRITE },
{ "unresvsp", UNRESVSP, SY_WRITE },
{ "reserve", RESVSP, SY_WRITE },
{ "unreserve", UNRESVSP, SY_WRITE },
-#endif
{ "readv", READV },
{ "writev", WRITEV, SY_WRITE },
{ "mmread", MMAPR },
void
startup_info(FILE *stream, int seed)
{
- char *value_to_string(), *type;
+ char *value_to_string(struct strmap *map, int val), *type;
int i;
fprintf(stream, "\n");
struct file_info *rec;
{
struct stat sbuf;
-#ifndef NO_XFS
int fd;
struct dioattr finfo;
-#endif
/*
* Figure out if the files is regular, block or character special. Any
}
rec->f_riou = BSIZE;
-#ifndef NO_XFS
if( (fd = open(rec->f_path, O_RDWR|O_DIRECT, 0)) != -1 ) {
+ char *dio_env;
#ifdef XFS_IOC_DIOINFO
if(xfsctl(rec->f_path, fd, XFS_IOC_DIOINFO, &finfo) != -1) {
#else
bozo!
#endif
#endif
+ dio_env = getenv("XFS_DIO_MIN");
+ if (dio_env)
+ finfo.d_mem = finfo.d_miniosz = atoi(dio_env);
+
rec->f_riou = finfo.d_miniosz;
} else {
fprintf(stderr,
} else {
rec->f_riou = BBSIZE;
}
-#endif
} else {
rec->f_riou = BSIZE;
int fd, rval;
char c;
struct stat sbuf;
-#ifndef NO_XFS
int nb;
struct flock64 f;
struct fsxattr xattr;
struct dioattr finfo;
char *b, *buf;
-#endif
errno = 0;
rval = stat(path, &sbuf);
}
} else {
-#ifndef NO_XFS
/*
* The file must be designated as Real-Time before any data
* is allocated to it.
fprintf(stderr, "get: fsx_xflags = 0x%x\n",
xattr.fsx_xflags);
}
-#endif
}
/*
* file size.
*/
-#ifndef NO_XFS
if(Owrite == 2) {
close(fd);
if( (fd = open(path, O_CREAT|O_RDWR|O_DIRECT, 0)) != -1 ) {
+ char *dio_env;
#ifdef XFS_IOC_DIOINFO
if(xfsctl(path, fd, XFS_IOC_DIOINFO, &finfo) == -1) {
#else
/*fprintf(stderr, "%s: miniosz=%d\n",
path, finfo.d_miniosz);*/
}
+
+ dio_env = getenv("XFS_DIO_MIN");
+ if (dio_env)
+ finfo.d_mem = finfo.d_miniosz = atoi(dio_env);
} else {
fprintf(stderr, "iogen%s: Error %s (%d) opening file %s with flags O_CREAT|O_RDWR|O_DIRECT\n",
TagName, SYSERR, errno, path);
}
free(b);
} else
-#endif
if(Owrite) {
/*fprintf(stderr,
"create_file_Owrite: lseek(%d, %d {%d}, SEEK_SET)\n",
break;
case 'N':
- sprintf( TagName, "(%.39s)", optarg );
+ sprintf( TagName, "(%.37s)", optarg );
break;
case 'o':
case 'O':
nopenargs = string_to_tokens(optarg, openargs, 4, ":/");
-#ifndef NO_XFS
if(!strcmp(openargs[0], "realtime")) {
/*
* -O realtime:extsize
TagName, openargs[0]);
exit(1);
}
-#else
- Oflags = parse_open_flags(openargs[0], &errmsg);
- if(Oflags == -1) {
- fprintf(stderr, "iogen%s: -O %s error: %s\n", TagName, optarg, errmsg);
- exit(1);
- }
-#endif
-
O_opt++;
break;
fprintf(stream, "\t-a (Not used on Linux).\n");
#endif /* !linux */
fprintf(stream, "\t-f flag,... Flags to use for file IO. Supported flags are\n");
-#ifndef NO_XFS
fprintf(stream, "\t buffered, direct, sync.\n");
fprintf(stream, "\t Default is 'buffered,sync'.\n");
-#else
- fprintf(stream, "\t buffered, sync.\n");
- fprintf(stream, "\t Default is 'buffered,sync'.\n");
-#endif /* sgi */
fprintf(stream, "\t-h This help.\n");
fprintf(stream, "\t-i iterations[s] # of requests to generate. 0 means causes iogen\n");
fprintf(stream, "\t to run until it's killed. If iterations is suffixed\n");
fprintf(stream, "\t-N tagname Tag name, for Monster.\n");
fprintf(stream, "\t-o Form overlapping consecutive requests.\n");
fprintf(stream, "\t-O Open flags for creating files\n");
-#ifndef NO_XFS
fprintf(stream, "\t realtime:extsize - put file on real-time volume\n");
fprintf(stream, "\t allocate - allocate space with F_ALLOCSP\n");
fprintf(stream, "\t reserve - reserve space with F_RESVSP (default)\n");
fprintf(stream, "\t noreserve - do not reserve with F_RESVSP\n");
fprintf(stream, "\t direct - use O_DIRECT I/O to write to the file\n");
-#else
- fprintf(stream, "\t {O_SYNC,etc}\n");
-#endif
fprintf(stream, "\t-p Output pipe. Default is stdout.\n");
fprintf(stream, "\t-q Quiet mode. Normally iogen spits out info\n");
fprintf(stream, "\t about test files, options, etc. before starting.\n");