[CentOS] Kernel question(s): I/O handling

Wed Mar 21 18:50:54 UTC 2007
Peter Kjellstrom <cap at nsc.liu.se>

On Wednesday 21 March 2007, Mark Hull-Richter wrote:
> I have been chasing down the way the inode and page caches are
> structured and handled, but there is a mystery I have not been able to
> track down yet.  How does the I/O queue that dirty inodes and pages are
> put into when it's time to flush them out to disk get picked up?  Also,
> where are the sources for the I/O schedulers?  I haven't been able to
> locate them yet either.

The actual I/O schedulers are in-kernel thingies that live in the 
$KERNELSRC/block directory. There are (normally) four: noop, as, deadline and 
cfq (cfq being the default in centos-4).

However, it doesn't seem like to me that you're actually looking for the I/O 
schedulers but more for why and when the kernel decides to flush dirty pages 
(I've been known to be wrong though ;-).

When a page has yet to be committed to disk it's called a dirty page (see 
eg. /proc/meminfo). Dirty pages are flushed to disk either explicitly 
(umount, sync, ..) or periodically (the kernel won't allow a dirty page to 
age forever).

When the they are finally flushed, then the I/O schedulers for the involved 
block device(s) gets involved as they handle the queueing of all requests for 
their device.

I hope some of that made sense :-)

/Peter

> I know this should not be too hard to locate, but it seems as though
> there's some magic involved when the inode/page gets put in the i/o
> queue and then <something happens here> and the i/o is scheduled and,
> eventually, performed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20070321/9a3b7484/attachment-0005.sig>