Re: [PATCH 10/11] readahead: dont do start-of-file readahead after lseek()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 02, 2010 at 10:40:41AM -0800, Linus Torvalds wrote:
> IOW, if you start off with a SEEK_END, I think it's reasonable to expect 
> it to _not_ read the whole thing.

I've seen a lot of:
  int fd = open(...);
  size = lseek(fd, 0, SEEK_END);
  lseek(fd, 0, SEEK_SET);

  data = malloc(size);
  read(fd, data, size);
  close(fd);

Why not fstat?  I don't know.  Perhaps a case of cargo culting,
perhaps a case of "other unixes suck for portability"[1].  But it's
probably still there a lot in real code.

  OG.

[1] In the hpux, dgux, sunos, etc sense.  Not to be taken as a comment
    on modern BSDs.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux