[Top] [All Lists]

Direct I/O question: How to get dioinfo using ioctl?

To: "'linux-xfs@xxxxxxxxxxx'" <linux-xfs@xxxxxxxxxxx>
Subject: Direct I/O question: How to get dioinfo using ioctl?
From: "Rosenthal, Eric S." <Eric.S.Rosenthal@xxxxxxxxxx>
Date: Mon, 14 May 2001 15:04:22 -0700
Sender: owner-linux-xfs@xxxxxxxxxxx
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.


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;

{ int fd;
  struct dioattr dioinfo; 
  int fcntlRetval, ioctlRetval;
  struct dioattr  da;

  fd = open("/home/origin/erosenth/test/linux/testFile", O_RDONLY |
  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);


<Prev in Thread] Current Thread [Next in Thread>