Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Direct I/O questions

Direct I/O questions

From: Kramer, James P. <james.p.kramer_at_unisys.com>
Date: Wed, 8 Dec 2004 14:58:56 -0600
Message-ID: <19D0D50E9B1D0A40A9F0323DBFA04ACC15B4D4@USRV-EXCH4.na.uis.unisys.com>


> First things first, this isn't an oracle question but rather a series = of questions based on a previous message on the oracle-l list. If you = think I should post it on a different list please let me know which one.
>=20

> The message I am talking about can be found here.
> http://www.freelists.org/archives/oracle-l/02-2004/msg03007.html

>=20

> Also, I am new to the Linux world (just thought I'd let you know what = kind of a guy your dealing with...newbie).
>=20
> Here is the following information about our Linux server.

>=20

> We are running SUSE LINUX Enterprise Server 9. From the files located = in /usr/src, the version is 2.6.5-7.97. I'm not sure how else to get = the version.
> There are 8 IA64 processors.

>=20

> I have been researching ways to get direct I/O to work on our Linux = machine when I stumbled across the above message. Within the message = was a small code example that tested direct I/O. I tried this code out = to see if it would work. I could not get the code to compile as is. = With some modifying (changed the headers), I was able to get it to = compile but the direct I/O read kept giving me EINVAL (Invalid = Argument).
>=20
> Here is the modified code that I used.

>=20
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <errno.h>
> #include <string.h>
> #include <fcntl.h>
> #include <unistd.h>
> #define BUFFSIZE 65536
> #define ALIGN    4096

>=20
> int main()=20
> {=20
>    char  *buff;
>    int stat1=3D0,stat2=3D0,stat3=3D0;
>    int fd1=3D0,fd2=3D0;
>    if (stat3=3Dposix_memalign((void **)&buff,ALIGN,BUFFSIZE)) {
>       fprintf(stderr,"ALIGN ERR:%s\n",strerror(stat3));
>       exit(0);
>    }

>=20

> fd1=3Dopen("/home/rrd/workspace/IORead.txt", = O_RDONLY|O_DIRECT,S_IRWXU);
>=20

> =
fd2=3Dopen("/home/rrd/workspace/IOWrite.txt",O_CREAT|O_WRONLY|O_DIRECT,S_= IRWXU);
>    while(stat1=3Dread(fd1,buff,BUFFSIZE)) {
>          if (errno) {
>             fprintf(stderr,"READ ERR:%s\n",strerror(errno));
>             exit(0);
>          }
>          stat2=3Dwrite(fd2,buff,(unsigned) stat1);
>          if (errno) {
>             fprintf(stderr,"WRITE ERR:%s\n",strerror(errno));
>             exit(0);
>          }
>    }
>    close(fd1);
>    close(fd2);
>   =20
>    return 0;
> }

>=20

> Also, is there a programmatic way of retrieving the alignment and = block size? I have seen the fcntl call for F_DIOINFO. However, I have = read articles that Linux doesn't have this. Instead one must use ioctl = with XFS_IOC_DIOINFO. When I do a search in /usr/, the only *DIOINFO = that I find is in xfs_fs.h. When I try calling this function, I get an = error and from what I gather it is because the file doesn't support this = type of ioctl. Does this mean I am missing some feature?
>=20

> I have been searching Google about direct I/O and have come across = countless articles that seem to contradict one another. Some articles =
say that Linux doesn't support O_DIRECT and that you need to convert =
your file system to XFS and use those libraries.  Others say it does =
support it.  From the example above it seems it doesn't support it.  =
What must be done to the file system (if anything) to get direct I/O to = work? Do I need to convert to XFS?
>=20

> Could it be that I'm using the wrong libraries? How can I find out = what libraries it is using?
>=20

> Is there anything I should look at on the server to make sure I have = the most up-to-date stuff? Any other ideas on how I should proceed?
>=20
> Any help would greatly be appreciated.

>=20
> James Kramer

>=20
>=20

> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE = PROPRIETARY MATERIAL and is thus for use only by the intended recipient. = If you received this in error, please contact the sender and delete the = e-mail and its attachments from all computers.=20
>=20
>=20
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 08 2004 - 15:02:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US