[Top] [All Lists]

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

To: "'linux-xfs@xxxxxxxxxxx'" <linux-xfs@xxxxxxxxxxx>
Subject: RE: Direct I/O question: How to get dioinfo using ioctl?
From: "Rosenthal, Eric S." <Eric.S.Rosenthal@xxxxxxxxxx>
Date: Mon, 14 May 2001 16:25:08 -0700
Sender: owner-linux-xfs@xxxxxxxxxxx
Thanks for the reply - 

My mistake - I was trying to run 
"ioctl(fileDescriptor, XFS_IOC_DIOINFO, &dioinfo)" on a 
file that wasn't on the xfs volume.  It worked with the right file.  Got to 
lay off that weekend binge drinking!  

As for the fact that direct I/O is slower than buffered I/O - we're
running version 2.4.2 of the Kernel on a PC, and have 2 striped hard drives
connected with a Scsi controller (we plan to add more drives).  The disks
are striped at 4K and the file system block size is 4K.  I'll have to do
some tests to see which sizes are optimal.

The disk rate I got for direct I/O (25 MB/sec) is about what was expected
but the rate with buffered I/O (27 MB/sec with the cache cleared) is higher 
than I would've throught.  Could Linux just handle buffered I/O better than


-----Original Message-----
From: Steve Lord [mailto:lord@xxxxxxx]
Sent: Monday, May 14, 2001 3:39 PM
To: Rosenthal, Eric S.
Cc: 'linux-xfs@xxxxxxxxxxx'
Subject: Re: Direct I/O question: How to get dioinfo using ioctl? 

> A couple of earlier threads mentioned this but didn't explain how to do
> 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
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>