a patch to avoid strange result under linux

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

a patch to avoid strange result under linux

Zhao Qian
Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
the patch is for iometer-2004.07.30-post.DS2 version.
Thanks.

Zhao Qian
AAA Storage Syetem Co.,Ltd.

Patch here:
*****************************************************************
[root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
--- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
+++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
@@ -1336,8 +1336,10 @@
        {
                // Ignore errors that occur if trying to open a floppy or CD-ROM with
                // nothing in the drive.
-#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
-               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
+#if defined(IOMTR_OS_SOLARIS)
+               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
+#elif defined(IOMTR_OS_LINUX)
+               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
 #elif defined(IOMTR_OS_NETWARE)
                NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
                ((struct File *)disk_file)->type = LogicalDiskType;
@@ -1352,8 +1354,10 @@
        }
        else if ( IsType( spec.type, PhysicalDiskType ) )
        {
-#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
-               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
+#if defined(IOMTR_OS_SOLARIS)
+               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
+#elif defined(IOMTR_OS_LINUX)
+               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
 #elif defined(IOMTR_OS_NETWARE)
                ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
 #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)

**************************************************************N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^ǚ­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'ï­ûjYhr'ׯ:æŠrXœŠ&z׫uëޖf¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëޔ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a patch to avoid strange result under linux

Ming Zhang
Thanks. But many people reported that O_DIRECT can not solve the
problem. Have you ever validate the results?

Ming


On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:

> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
> under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
> the patch is for iometer-2004.07.30-post.DS2 version.
> Thanks.
>
> Zhao Qian
> AAA Storage Syetem Co.,Ltd.
>
> Patch here:
> *****************************************************************
> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
> @@ -1336,8 +1336,10 @@
>         {
>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
>                 // nothing in the drive.
> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> +#if defined(IOMTR_OS_SOLARIS)
> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> +#elif defined(IOMTR_OS_LINUX)
> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>  #elif defined(IOMTR_OS_NETWARE)
>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
>                 ((struct File *)disk_file)->type = LogicalDiskType;
> @@ -1352,8 +1354,10 @@
>         }
>         else if ( IsType( spec.type, PhysicalDiskType ) )
>         {
> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> +#if defined(IOMTR_OS_SOLARIS)
> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> +#elif defined(IOMTR_OS_LINUX)
> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>  #elif defined(IOMTR_OS_NETWARE)
>                 ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
>  #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
>
> **************************************************************��N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=click">http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Iometer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/iometer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: a patch to avoid strange result under linux

Harder, David W.
In reply to this post by Zhao Qian
This should be something that can be turned on or off with a command-line switch.  (Or better yet, a parameter in the gui?)  There are certain cases when O_DIRECT is not available and dynamo will fail because of that. (For instance, when running IOmeter against an NFS mounted file on a client that doesn't have the NFS Direct I/O [experimental] feature turned on.)

We have been using IOmeter with an internally generated Direct I/O patch for quite some time and are quite comfortable with the results. (Although we haven't done a true direct comparison to a windows system measurement, we have gotten similar results between windows and linux+O_DIRECT.)

-Dave Harder-

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Ming Zhang
Sent: Tuesday, December 13, 2005 8:06 AM
To: Zhao Qian
Cc: [hidden email]
Subject: Re: [Iometer-devel] a patch to avoid strange result under linux

Thanks. But many people reported that O_DIRECT can not solve the problem. Have you ever validate the results?

Ming


On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:

> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows,
> we'd better do same thing under linux/solaris, under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
> the patch is for iometer-2004.07.30-post.DS2 version.
> Thanks.
>
> Zhao Qian
> AAA Storage Syetem Co.,Ltd.
>
> Patch here:
> *****************************************************************
> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
> @@ -1336,8 +1336,10 @@
>         {
>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
>                 // nothing in the drive.
> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> +#if defined(IOMTR_OS_SOLARIS)
> +               ((struct File *)disk_file)->fd = open(file_name,
> +O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR); #elif defined(IOMTR_OS_LINUX)
> +               ((struct File *)disk_file)->fd = open(file_name,
> +O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>  #elif defined(IOMTR_OS_NETWARE)
>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
>                 ((struct File *)disk_file)->type = LogicalDiskType; @@
> -1352,8 +1354,10 @@
>         }
>         else if ( IsType( spec.type, PhysicalDiskType ) )
>         {
> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> +#if defined(IOMTR_OS_SOLARIS)
> +               ((struct File *)disk_file)->fd = open(file_name,
> +O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR); #elif defined(IOMTR_OS_LINUX)
> +               ((struct File *)disk_file)->fd = open(file_name,
> +O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>  #elif defined(IOMTR_OS_NETWARE)
>                 ((struct File *)disk_file)->fd =
> NWOpenDevice(atoi(file_name), 0);  #elif defined(IOMTR_OS_WIN32) ||
> defined(IOMTR_OS_WIN64)
>
> **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢ â•ë±æ¬É«,º·âž
a{ › å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems?  Stop!  Download the new AJAX search engine that makes searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick">http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
_______________________________________________
Iometer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/iometer-devel
N�HY޵隊X���'���u���[�������
ަ�k��!���W�~�鮆�zk��C� 塧m����@^ǚ��^��z�Z�f�z�j�!�x2�������ɫ,��� a{� �,�H��4�m���i�(��ܢo�v'��jYhr'ׯ:�rX���&z׫u�ޖf��)��+-"�����z���+-��.�ǟ����a��l��b��,���y�+��޷�b��?�+-�w��*&z׫u�ޔ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: a patch to avoid strange result under linux

Ming Zhang
Hi David

Yes, as a switch will be good. So people can use it when appropriate.

Ming
 

On Tue, 2005-12-13 at 09:43 -0600, Harder, David W wrote:

> This should be something that can be turned on or off with a command-line switch.  (Or better yet, a parameter in the gui?)  There are certain cases when O_DIRECT is not available and dynamo will fail because of that. (For instance, when running IOmeter against an NFS mounted file on a client that doesn't have the NFS Direct I/O [experimental] feature turned on.)
>
> We have been using IOmeter with an internally generated Direct I/O patch for quite some time and are quite comfortable with the results. (Although we haven't done a true direct comparison to a windows system measurement, we have gotten similar results between windows and linux+O_DIRECT.)
>
> -Dave Harder-
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Ming Zhang
> Sent: Tuesday, December 13, 2005 8:06 AM
> To: Zhao Qian
> Cc: [hidden email]
> Subject: Re: [Iometer-devel] a patch to avoid strange result under linux
>
> Thanks. But many people reported that O_DIRECT can not solve the problem. Have you ever validate the results?
>
> Ming
>
>
> On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:
> > Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
> > I think if we use FILE_FLAG_NO_BUFFERING with open file under windows,
> > we'd better do same thing under linux/solaris, under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
> > the patch is for iometer-2004.07.30-post.DS2 version.
> > Thanks.
> >
> > Zhao Qian
> > AAA Storage Syetem Co.,Ltd.
> >
> > Patch here:
> > *****************************************************************
> > [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
> > --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
> > +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
> > @@ -1336,8 +1336,10 @@
> >         {
> >                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
> >                 // nothing in the drive.
> > -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> > -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> > +#if defined(IOMTR_OS_SOLARIS)
> > +               ((struct File *)disk_file)->fd = open(file_name,
> > +O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR); #elif defined(IOMTR_OS_LINUX)
> > +               ((struct File *)disk_file)->fd = open(file_name,
> > +O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >  #elif defined(IOMTR_OS_NETWARE)
> >                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
> >                 ((struct File *)disk_file)->type = LogicalDiskType; @@
> > -1352,8 +1354,10 @@
> >         }
> >         else if ( IsType( spec.type, PhysicalDiskType ) )
> >         {
> > -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> > -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> > +#if defined(IOMTR_OS_SOLARIS)
> > +               ((struct File *)disk_file)->fd = open(file_name,
> > +O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR); #elif defined(IOMTR_OS_LINUX)
> > +               ((struct File *)disk_file)->fd = open(file_name,
> > +O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >  #elif defined(IOMTR_OS_NETWARE)
> >                 ((struct File *)disk_file)->fd =
> > NWOpenDevice(atoi(file_name), 0);  #elif defined(IOMTR_OS_WIN32) ||
> > defined(IOMTR_OS_WIN64)
> >
> > **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
> > Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢ â•ë±æ¬É«,º·âž
> a{ › å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems?  Stop!  Download the new AJAX search engine that makes searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> <a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick">http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
> _______________________________________________
> Iometer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/iometer-devel



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=click">http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Iometer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/iometer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a patch to avoid strange result under linux

Zhao Qian
In reply to this post by Ming Zhang
Yes, it seems under some specific gcc version, linux kernel will not work correct with O_DIRECT, but it's not
O_DIRECT's wrong:)


Zhao Qian
AAA Storage Syetem Co.,Ltd.

refrence here(http://lkml.org/lkml/2003/6/17/72):
      Subject Re: gcc-3.2.2 miscompiles kernel 2.4.* O_DIRECT code ?
      From Felipe Alfaro Solana <>
      Date 17 Jun 2003 16:01:32 +0200

On Tue, 2003-06-17 at 14:37, Rob van Nieuwkerk wrote:
> Hi,
>
> I found out that O_DIRECT does not work correctly on 2.4 kernels
> compiled with the RH gcc-3.2.2-5 on RH9.  It is working fine with
> kernels compiled with the RH gcc-2.96-113 on RH 7.3.

Could you please try with gcc 3.3? I had similar problems when compiling
2.5 kernels with gcc 3.2. Compiling them with gcc 3.3 or 2.96 fixed the
problems.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
----- Original Message -----
From: "Ming Zhang" <[hidden email]>
To: "Zhao Qian" <[hidden email]>
Cc: <[hidden email]>
Sent: Tuesday, December 13, 2005 10:05 PM
Subject: Re: [Iometer-devel] a patch to avoid strange result under linux


> Thanks. But many people reported that O_DIRECT can not solve the
> problem. Have you ever validate the results?
>
> Ming
>
>
> On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:
>> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
>> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
>> under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
>> the patch is for iometer-2004.07.30-post.DS2 version.
>> Thanks.
>>
>> Zhao Qian
>> AAA Storage Syetem Co.,Ltd.
>>
>> Patch here:
>> *****************************************************************
>> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
>> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
>> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
>> @@ -1336,8 +1336,10 @@
>>         {
>>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
>>                 // nothing in the drive.
>> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
>> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>> +#if defined(IOMTR_OS_SOLARIS)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>> +#elif defined(IOMTR_OS_LINUX)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>>  #elif defined(IOMTR_OS_NETWARE)
>>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
>>                 ((struct File *)disk_file)->type = LogicalDiskType;
>> @@ -1352,8 +1354,10 @@
>>         }
>>         else if ( IsType( spec.type, PhysicalDiskType ) )
>>         {
>> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
>> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>> +#if defined(IOMTR_OS_SOLARIS)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>> +#elif defined(IOMTR_OS_LINUX)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>>  #elif defined(IOMTR_OS_NETWARE)
>>                 ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
>>  #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
>>
>> **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
>> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë ±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ
>N�HY޵隊X���'���u���[�������
ަ�k��!���W�~�鮆�zk��C� 塧m����@^ǚ��^��z�Z�f�z�j�!�x2�������ɫ,��� a{� �,�H��4�m���i�(��ܢo�v'��jYhr'ׯ:�rX���&z׫u�ޖf��)��+-"�����z���+-��.�ǟ����a��l��b��,���y�+��޷�b��?�+-�w��*&z׫u�ޔ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a patch to avoid strange result under linux

Ming Zhang
related to gcc not glibc? funny to know. ;)

ming

On Wed, 2005-12-14 at 10:21 +0800, Zhao Qian wrote:

> Yes, it seems under some specific gcc version, linux kernel will not work correct with O_DIRECT, but it's not
> O_DIRECT's wrong:)
>
>
> Zhao Qian
> AAA Storage Syetem Co.,Ltd.
>
> refrence here(http://lkml.org/lkml/2003/6/17/72):
>       Subject Re: gcc-3.2.2 miscompiles kernel 2.4.* O_DIRECT code ?
>       From Felipe Alfaro Solana <>
>       Date 17 Jun 2003 16:01:32 +0200
>
> On Tue, 2003-06-17 at 14:37, Rob van Nieuwkerk wrote:
> > Hi,
> >
> > I found out that O_DIRECT does not work correctly on 2.4 kernels
> > compiled with the RH gcc-3.2.2-5 on RH9.  It is working fine with
> > kernels compiled with the RH gcc-2.96-113 on RH 7.3.
>
> Could you please try with gcc 3.3? I had similar problems when compiling
> 2.5 kernels with gcc 3.2. Compiling them with gcc 3.3 or 2.96 fixed the
> problems.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> ----- Original Message -----
> From: "Ming Zhang" <[hidden email]>
> To: "Zhao Qian" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Tuesday, December 13, 2005 10:05 PM
> Subject: Re: [Iometer-devel] a patch to avoid strange result under linux
>
>
> > Thanks. But many people reported that O_DIRECT can not solve the
> > problem. Have you ever validate the results?
> >
> > Ming
> >
> >
> > On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:
> >> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
> >> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
> >> under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
> >> the patch is for iometer-2004.07.30-post.DS2 version.
> >> Thanks.
> >>
> >> Zhao Qian
> >> AAA Storage Syetem Co.,Ltd.
> >>
> >> Patch here:
> >> *****************************************************************
> >> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
> >> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
> >> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
> >> @@ -1336,8 +1336,10 @@
> >>         {
> >>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
> >>                 // nothing in the drive.
> >> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> >> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >> +#if defined(IOMTR_OS_SOLARIS)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >> +#elif defined(IOMTR_OS_LINUX)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >>  #elif defined(IOMTR_OS_NETWARE)
> >>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
> >>                 ((struct File *)disk_file)->type = LogicalDiskType;
> >> @@ -1352,8 +1354,10 @@
> >>         }
> >>         else if ( IsType( spec.type, PhysicalDiskType ) )
> >>         {
> >> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> >> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >> +#if defined(IOMTR_OS_SOLARIS)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >> +#elif defined(IOMTR_OS_LINUX)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >>  #elif defined(IOMTR_OS_NETWARE)
> >>                 ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
> >>  #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
> >>
> >> **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
> >> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë ±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ
> >



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=click">http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Iometer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/iometer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a patch to avoid strange result under linux

Zhao Qian
In reply to this post by Ming Zhang
I tested this patch under my linux kernel 2.6.12. compiled under gcc version 3.2.3 20030502(Red Hat Linux 3.2.3-20) and get reasonable result.

Zhao Qian
AAA Storage Syetem Co.,Ltd.


----- Original Message -----
From: "Ming Zhang" <[hidden email]>
To: "Zhao Qian" <[hidden email]>
Cc: <[hidden email]>
Sent: Tuesday, December 13, 2005 10:05 PM
Subject: Re: [Iometer-devel] a patch to avoid strange result under linux


> Thanks. But many people reported that O_DIRECT can not solve the
> problem. Have you ever validate the results?
>
> Ming
>
>
> On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:
>> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
>> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
>> under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
>> the patch is for iometer-2004.07.30-post.DS2 version.
>> Thanks.
>>
>> Zhao Qian
>> AAA Storage Syetem Co.,Ltd.
>>
>> Patch here:
>> *****************************************************************
>> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
>> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
>> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
>> @@ -1336,8 +1336,10 @@
>>         {
>>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
>>                 // nothing in the drive.
>> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
>> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>> +#if defined(IOMTR_OS_SOLARIS)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>> +#elif defined(IOMTR_OS_LINUX)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
>>  #elif defined(IOMTR_OS_NETWARE)
>>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
>>                 ((struct File *)disk_file)->type = LogicalDiskType;
>> @@ -1352,8 +1354,10 @@
>>         }
>>         else if ( IsType( spec.type, PhysicalDiskType ) )
>>         {
>> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
>> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>> +#if defined(IOMTR_OS_SOLARIS)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>> +#elif defined(IOMTR_OS_LINUX)
>> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
>>  #elif defined(IOMTR_OS_NETWARE)
>>                 ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
>>  #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
>>
>> **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
>> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë ±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ
>N�HY޵隊X���'���u���[�������
ަ�k��!���W�~�鮆�zk��C� 塧m����@^ǚ��^��z�Z�f�z�j�!�x2�������ɫ,��� a{� �,�H��4�m���i�(��ܢo�v'��jYhr'ׯ:�rX���&z׫u�ޖf��)��+-"�����z���+-��.�ǟ����a��l��b��,���y�+��޷�b��?�+-�w��*&z׫u�ޔ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a patch to avoid strange result under linux

Ming Zhang
try to test with 2.4.x kernel.

ps, u seems to use pretty new kernel with a pretty old distro.

ming



On Wed, 2005-12-14 at 10:29 +0800, Zhao Qian wrote:

> I tested this patch under my linux kernel 2.6.12. compiled under gcc version 3.2.3 20030502(Red Hat Linux 3.2.3-20) and get reasonable result.
>
> Zhao Qian
> AAA Storage Syetem Co.,Ltd.
>
>
> ----- Original Message -----
> From: "Ming Zhang" <[hidden email]>
> To: "Zhao Qian" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Tuesday, December 13, 2005 10:05 PM
> Subject: Re: [Iometer-devel] a patch to avoid strange result under linux
>
>
> > Thanks. But many people reported that O_DIRECT can not solve the
> > problem. Have you ever validate the results?
> >
> > Ming
> >
> >
> > On Tue, 2005-12-13 at 15:35 +0800, Zhao Qian wrote:
> >> Many test under linux show us a very higher result than windows platform because the linux cache system, so i analyse iometer's source, seems found the reason in file IOTargetDisk.orig.cpp .
> >> I think if we use FILE_FLAG_NO_BUFFERING with open file under windows, we'd better do same thing under linux/solaris,
> >> under linux, flag O_DIRECT is the answer, under solaris, no perfect solution now, but should use O_DSYNC to improve the result.
> >> the patch is for iometer-2004.07.30-post.DS2 version.
> >> Thanks.
> >>
> >> Zhao Qian
> >> AAA Storage Syetem Co.,Ltd.
> >>
> >> Patch here:
> >> *****************************************************************
> >> [root@darkstar src]# diff -u IOTargetDisk.orig.cpp IOTargetDisk.cpp
> >> --- IOTargetDisk.orig.cpp       2005-12-13 12:12:04.000000000 +0800
> >> +++ IOTargetDisk.cpp    2005-12-13 14:36:04.000000000 +0800
> >> @@ -1336,8 +1336,10 @@
> >>         {
> >>                 // Ignore errors that occur if trying to open a floppy or CD-ROM with
> >>                 // nothing in the drive.
> >> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> >> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >> +#if defined(IOMTR_OS_SOLARIS)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >> +#elif defined(IOMTR_OS_LINUX)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_CREAT|O_LARGEFILE|open_flag, S_IRUSR|S_IWUSR);
> >>  #elif defined(IOMTR_OS_NETWARE)
> >>                 NXFileOpen(0, (void *)file_name, (NXMode_t)(NX_O_RDWR|NX_O_CREAT|open_flag), &((struct File *)disk_file)->fd);
> >>                 ((struct File *)disk_file)->type = LogicalDiskType;
> >> @@ -1352,8 +1354,10 @@
> >>         }
> >>         else if ( IsType( spec.type, PhysicalDiskType ) )
> >>         {
> >> -#if defined(IOMTR_OS_LINUX) || defined(IOMTR_OS_SOLARIS)
> >> -               ((struct File *)disk_file)->fd = open(file_name, O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >> +#if defined(IOMTR_OS_SOLARIS)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DSYNC|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >> +#elif defined(IOMTR_OS_LINUX)
> >> +               ((struct File *)disk_file)->fd = open(file_name, O_DIRECT|O_RDWR|O_LARGEFILE, S_IRUSR|S_IWUSR);
> >>  #elif defined(IOMTR_OS_NETWARE)
> >>                 ((struct File *)disk_file)->fd = NWOpenDevice(atoi(file_name), 0);
> >>  #elif defined(IOMTR_OS_WIN32) || defined(IOMTR_OS_WIN64)
> >>
> >> **************************************************************&#0;&#0;N¬HY޵隊X¬²š'²ŠÞu¼’¦[§‰ÜŒ¨º
> >> Þ¦Øk¢è!–ˆŠW¬~Šé®†åzk¶ŠC£ 塧m…éÞÀ@^Çš­È^ž§zØZ¶f¤zËj·!Šx2¢êå¢â•ë ±æ¬É«,º·âž a{› å,àHòÔ4¨m¶ŸÿiÛ(±ÙÜ¢oÚv'@ï­ûjYhr'@ׯ:æŠ@rXœŠ&z׫uëÞ–f¢–)à–+-"‰žµêÝz÷¥–+-²Ê.­ÇŸ¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?–+-Šwèþ*&z׫uëÞ
> >



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=click">http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Iometer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/iometer-devel
Loading...