LWN.net Logo

The 3.8 kernel is out

The 3.8 kernel is out

Posted Feb 19, 2013 15:46 UTC (Tue) by Aliasundercover (subscriber, #69009)
In reply to: The 3.8 kernel is out by ssam
Parent article: The 3.8 kernel is out

It would make a mess of alignment.


(Log in to post comments)

The 3.8 kernel is out

Posted Feb 19, 2013 16:24 UTC (Tue) by ssam (subscriber, #46587) [Link]

good point. but if there was a notable speed boost for having quick access to the first few bytes, and you were not bothered about the space savings, you could just put a copy of the data in the inode, so the blocks that held the rest of the file would still start from byte zero.

The 3.8 kernel is out

Posted Feb 19, 2013 17:15 UTC (Tue) by dkg (subscriber, #55359) [Link]

but now you have two copies of the data. which one is authoritative? what would you do when accessing a file that had different bytes in the inlined stub than in the first block? At which points would you check the two copies for consistency?

The 3.8 kernel is out

Posted Feb 19, 2013 18:26 UTC (Tue) by hummassa (subscriber, #307) [Link]

> which one is authoritative?

the one on the inode. for economy, the other one could even not be guaranteed to exist.

The 3.8 kernel is out

Posted Feb 19, 2013 21:38 UTC (Tue) by Aliasundercover (subscriber, #69009) [Link]

> but if there was a notable speed boost for having quick access to the first few bytes

Few programs would get anything out of early access to the first few bytes of a longer file. Most programs dealing in text or small binary records use fread() or similar to make full block reads delivering convenient quantities without bothering the kernel repeatedly. fread() will read the whole first block and wait for it.

The kernel deals in whole pages making a valuable correspondence between mapped memory and file buffering. Space in a page past the end of a file can be all bytes zero. Space in a page which is unknown because it hasn't been read yet is complicated.

The 3.8 kernel is out

Posted Feb 20, 2013 8:25 UTC (Wed) by Otus (guest, #67685) [Link]

> Few programs would get anything out of early access to the first few bytes of a longer file.

How about programs that need to find the file format and look for an initial magic number?

The 3.8 kernel is out

Posted Feb 20, 2013 13:20 UTC (Wed) by Wol (guest, #4433) [Link]

Then when they've found out what the magic number is, and invoked the correct program, that program is going to try and read the entire first block and get a cache hit, rather than having to wait for spinning rust.

Cheers,
Wol

The 3.8 kernel is out

Posted Feb 20, 2013 14:37 UTC (Wed) by ssam (subscriber, #46587) [Link]

Some sort of read ahead could be fetching the first block while the program initializes.

Also you may just be reading the first few bytes to know what icon to draw in your file browser.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds