[Top] [All Lists]

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

To: "Rosenthal, Eric S." <Eric.S.Rosenthal@xxxxxxxxxx>
Subject: Re: Direct I/O question: How to get dioinfo using ioctl?
From: Steve Lord <lord@xxxxxxx>
Date: Mon, 14 May 2001 17:38:43 -0500
Cc: "'linux-xfs@xxxxxxxxxxx'" <linux-xfs@xxxxxxxxxxx>
In-reply-to: Message from "Rosenthal, Eric S." <Eric.S.Rosenthal@xxxxxxxxxx> of "Mon, 14 May 2001 15:04:22 PDT." <99A560B38BC6D21180020004ACA6B36A031FAF64@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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.

The one missing link here is what error do you get back from the ioctl?
And I presume that file is on XFS.

> 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.

That's so you still keep your SGI hardware ;-)  No seriously, I have
found I need to crank the I/O size on direct I/O up fairly high to
get reasonable performance out of it. What sort of speed can you get
from buffered I/O vs direct I/O for what block sizes, and what sort
of raw device speed can you obtain.

One more question - which  kernel are you using, things in the CVS development
tree have changed in this area due to other kernel changes.


> 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 |
>   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("");
> }

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