Hello people,
Doing tests to open a >2GB file (large file) using open() syscall on 32 and
64 bit machine using SuSe I got what I call of a "strange behaviour" on the
32 bit machine. I would like to share this test with you to see if it there
is a workaround to my problem.
I compiled two versions of a short program to execute the 'open' syscall.
version1 - called test1
int main(void) { int fd; if((fd = open("morethan2gbfile", O_RDONLY)) < 0)
{ printf("TEST: ERRO"); } else { printf("TEST: OK"); close(fd); }
version2 - called test2
int main(void) { int fd; if((fd = open("morethan2gbfile", O_RDONLY |
O_LARGEFILE))) < 0) { printf("TEST: ERRO"); } else { printf("TEST:
OK"); close(fd); }
Here are the scenarios:
1)
*64bit* machine
SUSE Version 9 PATCHLEVEL 3
kernel 2.6.5-7.252-smp
xfsprogs-2.6.25-0.6
XFS partition mount options: rw,noatime,nodiratime
glibc-2.3.3-98.61
ran 'test1' on a XFS partition -> output: TEST: OK
2)
*32bit* machine
SUSE Version 9 PATCHLEVEL 3
kernel 2.6.5-7.252-smp
xfsprogs-2.6.25-0.6
XFS partition mount options: rw,noatime,nodiratime
glibc-2.3.3-98.61
ran 'test1' on a XFS partition -> output: TEST: ERRO
ran 'test2' on a XFS partition -> output: TEST: OK
3)
*32bit* machine
SUSE Version 9 PATCHLEVEL 3
kernel 2.6.5-7.252-smp
reiserfs-3.6.19-3.2
ReiserFS partition mount options: rw
glibc-2.3.3-98.61
ran 'test1' on a ReiserFS partition -> output: TEST: OK
The point is that when I ran my 'test2' program (using O_LARGEFILE) on the
scenario 2 I got "TEST: OK". So, XFS DO support large files with this trick
but there are softwares like OpenLDAP that does not make use of O_LARGEFILE
flag on its open() calls, so if I want to use LDAP on this archtecture I
have to fix openldap to make it use O_LARGEFILE (and I think this work will
not worth if there is something I can do in XFS space ;)
Well, the question here is WHY :) Why do I need to make use of O_LARGEFILE
when open()ing large files (>2GB) from a XFS filesystem and do not when
using ReiserFS filesystem ?
Thanks in advance,
Fabiano Silos Reis
Brasil Telecom Internet
[[HTML alternate version deleted]]
|