A couple of earlier threads mentioned this but didn't explain how to do it.
Direct I/O appears to work with the following code, but the ioctl command
returns an error. I'm looking for a command that does the same thing as
fcntl(fileDescriptor, F_DIOINFO, &dioinfo) does on IRIX. But I don't know
if the
ioctl command is running xfs_ioctl like it should.
Also direct I/O is running slower than unbuffered I/O on our machine for
some reason,
maybe because of how the disk array is striped, I'm not sure.
Thanks,
Eric Rosenthal
Software Engineer
Disney TV animation
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/timeb.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
#include <xfs/xfs_fs.h>
#include <fcntl.h>
#define O_DIRECT 040000
#define O_RDONLY 0
extern int errno;
main()
{ int fd;
struct dioattr dioinfo;
int fcntlRetval, ioctlRetval;
struct dioattr da;
fd = open("/home/origin/erosenth/test/linux/testFile", O_RDONLY |
O_DIRECT);
fprintf(stderr, "File Descriptor = <%d> XFS_IOC_DIOINFO = <%d>\n",
fd, XFS_IOC_DIOINFO);
ioctlRetval = ioctl(fd, XFS_IOC_DIOINFO, &da);
fprintf(stderr, "ioctlRetval = %d\n", ioctlRetval);
fprintf(stderr, "errno = <%d>\n", errno);
perror("");
}
|