home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
- From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
- Newsgroups: comp.os.linux
- Subject: Re: Why GNU cp is flakey under Linux
- Message-ID: <1992Aug13.132338.8532@klaava.Helsinki.FI>
- Date: 13 Aug 92 13:23:38 GMT
- References: <1992Aug12.060338.24805@ennews.eas.asu.edu> <1992Aug12.063534.4178@muddcs.claremont.edu> <JRS.92Aug12190300@lepton.world.std.com>
- Organization: University of Helsinki
- Lines: 23
-
- In article <JRS.92Aug12190300@lepton.world.std.com> jrs@world.std.com (Rick Sladkey) writes:
- >
- >An examination of the source code shows that GNU cp only performs this
- >optimization if it thinks that the original file also had holes. The
- >way GNU cp determines this is by comparing the number of blocks used
- >with the actual file size. Furthermore, it only does this when it is
- >compiled without ST_BLOCKS_MISSING defined. Note that the kernel is
- >created by build and does not have any holes.
-
- Yes, but GNU cp looks /only/ at the st_blocks field, and seems to ignore
- st_blksize altogether, assuming it's a constant (usually 512). Or
- that's what it looks like when just taking a quick look at the source.
- And as the current linux kernel happens to use st_blksize = 1024 (and
- thus also st_blocks is only half of what GNU cp seems to expect), the
- test doesn't work very well. The result being that GNU cp creates holes
- even if there were none in the original image.
-
- I'll probably change the default st_blksize to 512 - easy enough to
- change the math in linux/fs/stat.c, and it seems that's what some
- programs expect. Programs which understand about st_blksize shouldn't
- care one way or the other.
-
- Linus
-