How do I enable direct IOs with ia64 ?
If I run the following piece of code to an ia64 (azusa) I can see that direct
io are not enabled, but please,
what do i have to do to have them running?
remark: With ia32, this code works fine and I directly get:
------
"test: completed" and the file "infile" is initialized
with ia64, it does not work and I get:
"write infile failed: Invalid argument"
... and the file "infile" is not filled up.
version:
Linux version 2.4.18 (xb@pegtst2) (gcc version 3.1) #8 SMP Wed Aug 7 14:30:09
CEST 2002
compil:
cc -O -D_GNU_SOURCE voyons.c -o voyons
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/fcntl.h>
#include <errno.h>
#define BUFSIZE 8192
#define NBLKS 20
#define LEN 30
#define TRUE 1
voidfillbuf(char *buf, int count, char value)
{
while (count-- > 0) *buf++ = value;
}intmain(int argc, char *argv[])
{
int bufsize = BUFSIZE; /* Buffer size. Default 8k */
int numblks = NBLKS; /* Number of blocks. Default 20 */
char infile[LEN]; /* Input file. Default "infile" */
int fd1, fd2;
int i, n, offset;
char *buf;
strcpy(infile, "infile"); /* Default input file */
if ((fd1 = open(infile, O_DIRECT|O_RDWR|O_CREAT, 0666)) < 0) {
fprintf(stderr, "open infile: %s\n", strerror(errno));
exit(1);
}
/* Allocate for buf, Create input file */
if ((buf = valloc(bufsize)) == 0) {
fprintf(stderr, "valloc buf: %s\n", strerror(errno));
}
for (i = 0; i < numblks; i++) {
fillbuf(buf, bufsize, 'Z');
if (write(fd1, buf, bufsize) == -1) {
fprintf(stderr, "write infile failed: %s\n",
strerror(errno));
}
}
fprintf(stdout, "test: completed\n");
exit(0);}
Jacky Malcles <[email protected]> writes:
|> If I run the following piece of code to an ia64 (azusa) I can see that |> direct |> io are not enabled, but please, |> what do i have to do to have them running?
Use getpagesize.
|> compil: |> cc -O -D_GNU_SOURCE voyons.c -o voyons#include <stdio.h> |> #include <stdlib.h> |> #include <unistd.h> |> #include <signal.h> |> #include <string.h> |> #include <sys/fcntl.h> |> #include <errno.h> |> |> #define BUFSIZE 8192
Page size is 16k by default on ia64, but can be as large as 64k.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."