* 64 Bits from Larry McVoy
@ 1996-11-04 13:02 Jim Nance
0 siblings, 0 replies; 7+ messages in thread
From: Jim Nance @ 1996-11-04 13:02 UTC (permalink / raw)
Forwarded message:
> Linux is 64 bit in that the types are right. Linux is not 64 bit in that
> the file systems don't support >32 bit offsets (something that wouldn't
> be hard to fix, sounds like a version number on ext2fs).
Well Larry,
I was almost sure you were wrong, so I wrote the following test program.
Unfortunatly, I did manage to tickle enough linux bugs so that you can
claim you are right :-) So instead of claiming victory, I will submit
a bug report :-( For those intrested in reproducing this, I am running
Redhat 4.0 with redhats kernel, and the partition I am working contains an
800MB ext2 file system. Here is the program. It tries to make a large
sparse file:
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define GB ((long)(1024*1024*1024)/2)
#define NG (20L)
int main()
{
off_t offset;
int fd = open("bigfile", O_CREAT|O_TRUNC|O_WRONLY);
if(fd<0) {perror("open:"); exit(1);}
for(offset=0; offset<NG*GB; offset += GB) {
int num;
off_t pos = lseek(fd, offset, SEEK_SET);
if(pos!=offset) {perror("lseek:"); exit(1);}
num=write(fd,"x",1);
if(num!=1) {perror("write:"); exit(1);}
}
printf("Done!");
return 0;
}
The first thing to notice is that I have divided GB by 2. If I don't do
this the program fails after making a 1G file, and I get a nice printk()
from the ext2fs. So I divided by two and reran. Now I can make a very
large file, but something is still wrong:
total 76
-rwxrwxrwx 1 jlnance users 14378 Nov 4 07:39 a.out*
-rw-rw-rw- 1 jlnance users 544 Nov 4 07:38 big.c
-r-xrwS--T 1 jlnance users 10200547329 Nov 4 07:43 bigfile*
I don't know how the S--T bits got set on bigfile, but I certainly did
not mean to do it. I have also found that if I do much in the directory
containing bigfile, its size will eventually shrink down to 1.6G.
Anyone have any ideas?
Jim
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <9611041302.AA00548@scooter>]
* Re: 64 Bits from Larry McVoy
[not found] <9611041302.AA00548@scooter>
@ 1996-11-04 23:10 ` Marc Singer
1996-11-05 0:23 ` Richard Henderson
1 sibling, 0 replies; 7+ messages in thread
From: Marc Singer @ 1996-11-04 23:10 UTC (permalink / raw)
> The first thing to notice is that I have divided GB by 2. If I don't do
> this the program fails after making a 1G file, and I get a nice printk()
> from the ext2fs. So I divided by two and reran. Now I can make a very
> large file, but something is still wrong:
>
> total 76
> -rwxrwxrwx 1 jlnance users 14378 Nov 4 07:39 a.out*
> -rw-rw-rw- 1 jlnance users 544 Nov 4 07:38 big.c
> -r-xrwS--T 1 jlnance users 10200547329 Nov 4 07:43 bigfile*
>
> I don't know how the S--T bits got set on bigfile, but I certainly did
> not mean to do it. I have also found that if I do much in the directory
> containing bigfile, its size will eventually shrink down to 1.6G.
I think there is a bug in your code. If you examine the man page for
open, there is a form with three arguments. When you create files, it
is a good idea to pass the third parameter explicitly. It's the mode
for the new file. ;-)
-- Marc Singer
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: 64 Bits from Larry McVoy
[not found] <9611041302.AA00548@scooter>
1996-11-04 23:10 ` Marc Singer
@ 1996-11-05 0:23 ` Richard Henderson
1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 1996-11-05 0:23 UTC (permalink / raw)
> total 76
> -rwxrwxrwx 1 jlnance users 14378 Nov 4 07:39 a.out*
> -rw-rw-rw- 1 jlnance users 544 Nov 4 07:38 big.c
> -r-xrwS--T 1 jlnance users 10200547329 Nov 4 07:43 bigfile*
What kernel (and patches) are you using? I think I'm currently
running something that resembles 2.1.7 and I don't see it. I
correctly get "write: File too large", and the file size is
-rw-rw-r-- 1 richard richard 2147483648 Nov 4 18:16 bigfile
(this after adding the missing argument to open that someone mentioned).
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <Pine.LNX.3.93.961105175237.464A-100000@darkstar.chrigi.net>]
* Re: 64 Bits from Larry McVoy
[not found] <Pine.LNX.3.93.961105175237.464A-100000@darkstar.chrigi.net>
@ 1996-11-06 12:20 ` Jim Nance
1996-11-06 12:34 ` Philip Blundell
1996-11-07 18:58 ` Christian Hardmeier
0 siblings, 2 replies; 7+ messages in thread
From: Jim Nance @ 1996-11-06 12:20 UTC (permalink / raw)
> I patched the program to use _llseek, and to specify a correct mode on
> open ;-).
> I never got a nice printk() from ext2fs. But from a certain file length on
> (I didn't check but I figure it's when 32 bit can't hold the offset any
> more) write fails with EFBIG: File too large. Very normal, controlled
> behaviour...
First I want to thank all the people who pointed out that I don't know how
to use open(). I have patched the program call it correctly, and have
included the errors I am seeing. Also, I am running on an Alpha, not an
intel machine. I would expect compleatly different behavior on an intel
since the longs are only 32 bits. Here is the program:
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define GB ((long)2*(1024*1024*1024)/2)
#define NG (20L)
int main()
{
off_t offset;
int fd = open("bigfile", O_CREAT|O_TRUNC|O_WRONLY, 0666);
if(fd<0) {perror("open:"); exit(1);}
for(offset=0; offset<=NG*GB; offset += GB) {
int num;
off_t pos = lseek(fd, offset, SEEK_SET);
if(pos!=offset) {perror("lseek:"); exit(1);}
num=write(fd,"x",1);
if(num!=1) {perror("write:"); exit(1);}
}
printf("Done!\n");
return 0;
}
When I run it I get this nice message:
scooter> ./a.out
EXT2-fs warning (device 08:18): ext2_getblk: block > big
write:: Input/output error
Now it does make a file:
scooter> ls -l
total 66
-rwxrwxrwx 1 jlnance users 14317 Nov 5 06:53 a.out*
-rw-rw-rw- 1 jlnance users 555 Nov 5 06:53 big.c
-rw-rw-rw- 1 jlnance users 18253611008 Nov 5 06:57 bigfile
This file is much larger than 2G. I think its about 18G. The really
interesting thing is that sometimes it will spontaneously truncate itself:
scooter> dd bs=1k count=10 if=bigfile of=/dev/null
10+0 records in
10+0 records out
scooter> ls -l
total 66
-rwxrwxrwx 1 jlnance users 14317 Nov 5 06:53 a.out*
-rw-rw-rw- 1 jlnance users 555 Nov 5 06:53 big.c
-rw-rw-rw- 1 jlnance users 1073741824 Nov 5 06:57 bigfile
Now its a 1G file :-( I can not always force it to truncate by accessing it,
but it will always eventually truncate itself if you leave it around for
long enough and read from it enough.
For anyone who is interested in trying to reproduce this, I used the 2.0.18
kernel supplied with RedHat 4.0, recompiled with the RedHat 4.0 compiler.
I am running on an Alphastation 200 4/166 with the SRM console.
Thanks,
Jim
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: 64 Bits from Larry McVoy
1996-11-06 12:20 ` Jim Nance
@ 1996-11-06 12:34 ` Philip Blundell
1996-11-07 18:58 ` Christian Hardmeier
1 sibling, 0 replies; 7+ messages in thread
From: Philip Blundell @ 1996-11-06 12:34 UTC (permalink / raw)
On Wed, 6 Nov 1996, Jim Nance wrote:
> When I run it I get this nice message:
>
> scooter> ./a.out
> EXT2-fs warning (device 08:18): ext2_getblk: block > big
> write:: Input/output error
>
> Now it does make a file:
> scooter> ls -l
> total 66
> -rwxrwxrwx 1 jlnance users 14317 Nov 5 06:53 a.out*
> -rw-rw-rw- 1 jlnance users 555 Nov 5 06:53 big.c
> -rw-rw-rw- 1 jlnance users 18253611008 Nov 5 06:57 bigfile
>
> This file is much larger than 2G. I think its about 18G. The really
> interesting thing is that sometimes it will spontaneously truncate itself:
>
> scooter> dd bs=1k count=10 if=bigfile of=/dev/null
> 10+0 records in
> 10+0 records out
> scooter> ls -l
> total 66
> -rwxrwxrwx 1 jlnance users 14317 Nov 5 06:53 a.out*
> -rw-rw-rw- 1 jlnance users 555 Nov 5 06:53 big.c
> -rw-rw-rw- 1 jlnance users 1073741824 Nov 5 06:57 bigfile
>
> Now its a 1G file :-( I can not always force it to truncate by accessing it,
> but it will always eventually truncate itself if you leave it around for
> long enough and read from it enough.
>
> For anyone who is interested in trying to reproduce this, I used the 2.0.18
> kernel supplied with RedHat 4.0, recompiled with the RedHat 4.0 compiler.
> I am running on an Alphastation 200 4/166 with the SRM console.
[phil@paddington phil]$ uname -a
Linux paddington.london.uk.eu.org 2.1.7 #12-netdev Wed Nov 6 02:47:51 GMT
1996 alpha
[phil@paddington phil]$ ~/bigtest
write:: File too large
[phil@paddington phil]$ ls -l bigfile
-rw-rw-r-- 1 phil phil 2147483648 Nov 6 13:30 bigfile
[phil@paddington phil]$
I make that a 2GB file. Strange. It seems that everybody is seing
different behaviour from this program.
This is on a UDB with (mostly) RedHat 4.0, upgraded to a newer development
kernel. I am using glibc 1.93.
phil
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 64 Bits from Larry McVoy
1996-11-06 12:20 ` Jim Nance
1996-11-06 12:34 ` Philip Blundell
@ 1996-11-07 18:58 ` Christian Hardmeier
1 sibling, 0 replies; 7+ messages in thread
From: Christian Hardmeier @ 1996-11-07 18:58 UTC (permalink / raw)
On Wed, 6 Nov 1996, Jim Nance wrote:
> First I want to thank all the people who pointed out that I don't know how
> to use open(). I have patched the program call it correctly, and have
> included the errors I am seeing. Also, I am running on an Alpha, not an
> intel machine. I would expect compleatly different behavior on an intel
> since the longs are only 32 bits. Here is the program:
>
[code & output snipped]
I tried the program on two Intel boxes. Both of them reacted similarly:
Script started on Wed Nov 6 12:22:52 1996
bash$ gcc bigfile_.c
bigfile_.c: In function `main':
bigfile_.c:17: warning: integer overflow in expression
bigfile_.c:17: warning: integer overflow in expression
bigfile_.c:17: warning: integer overflow in expression
bash$ a.out
lseek:: Invalid argument
bash$ ls -l big*
-rw-r--r-- 1 ch user 1 Nov 6 12:23 bigfile
-rw-r--r-- 1 ch user 311 Nov 6 12:23 bigfile.script
-rw-rw-rw- 1 ch user 555 Nov 6 12:17 bigfile_.c
bash$ exit
exit
Script done on Wed Nov 6 12:23:54 1996
Then, I tried it on an Alpha running NetBSD (unfortunately I have no
access to a Linux Alpha). It worked perfectly.
Then, I tried the one with _llseek:
Script started on Thu Nov 7 19:55:36 1996
darkstar:~$ gcc bigfile.c
darkstar:~$ a.out
pos: 0x80000000; offset: 0x80000000
write:: File too large
darkstar:~$ ls -l bigfile
-rw-r--r-- 1 chrigi users 2147483648 Nov 7 19:55 bigfile
darkstar:~$ exit
Script done on Thu Nov 7 19:56:26 1996
The code follows below.
Christian
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/unistd.h>
#define GB ((long long)(1024*1024*1024))
#define NG (2048L)
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res,
uint, wh);
int main()
{
loff_t offset, pos;
int fd = open("bigfile", O_CREAT|O_TRUNC|O_WRONLY, 0666);
if(fd<0) {perror("open:"); exit(1);}
for(offset=0; offset<((long long)NG*(long long)GB); offset += GB) {
int num;
if(_llseek(fd, offset>>32, (unsigned long)offset,
&pos, SEEK_SET) == -1)
{
printf("pos: 0x%LX; offset: 0x%LX\n", pos, offset);
perror("lseek:"); exit(1);}
num=write(fd,"x",1);
if(num!=1) {
printf("pos: 0x%LX; offset: 0x%LX\n", pos, offset);
perror("write:"); exit(1);}
}
printf("Done!\n");
return 0;
}
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <Pine.SOL.3.95.961106122811.7441C-100000@hammer.thor.cam.ac.uk>]
* Re: 64 Bits from Larry McVoy
[not found] <Pine.SOL.3.95.961106122811.7441C-100000@hammer.thor.cam.ac.uk>
@ 1996-11-06 12:57 ` Jim Nance
0 siblings, 0 replies; 7+ messages in thread
From: Jim Nance @ 1996-11-06 12:57 UTC (permalink / raw)
> [phil@paddington phil]$ uname -a
> Linux paddington.london.uk.eu.org 2.1.7 #12-netdev Wed Nov 6 02:47:51 GMT
> 1996 alpha
> [phil@paddington phil]$ ~/bigtest
> write:: File too large
> [phil@paddington phil]$ ls -l bigfile
> -rw-rw-r-- 1 phil phil 2147483648 Nov 6 13:30 bigfile
> [phil@paddington phil]$
>
> I make that a 2GB file. Strange. It seems that everybody is seing
> different behaviour from this program.
>
> This is on a UDB with (mostly) RedHat 4.0, upgraded to a newer development
> kernel. I am using glibc 1.93.
Well, I think its time to try out 2.1.7 on this machine. I have avoided
moving from 2.0.18 because I don't know what patches I have to apply. I
guess I will dig around on azstarnet and see if I can find any.
Jim
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1996-11-07 18:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-11-04 13:02 64 Bits from Larry McVoy Jim Nance
[not found] <9611041302.AA00548@scooter>
1996-11-04 23:10 ` Marc Singer
1996-11-05 0:23 ` Richard Henderson
[not found] <Pine.LNX.3.93.961105175237.464A-100000@darkstar.chrigi.net>
1996-11-06 12:20 ` Jim Nance
1996-11-06 12:34 ` Philip Blundell
1996-11-07 18:58 ` Christian Hardmeier
[not found] <Pine.SOL.3.95.961106122811.7441C-100000@hammer.thor.cam.ac.uk>
1996-11-06 12:57 ` Jim Nance
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox