Hi, I'm a kernel newbie and I'm making research about difference
between kernel 2.4 and 2.6 in Disk Cache(Page Cache&Buffer Cache) and
Accessing files. I'm would like also to know which kernel source files
I have to analize (At this moment I know Buffer.c..).
Tnx a lot.
Page Cache / Buffer Cache
(I'm probably almost quoting Robert Love, "Linux Kernel Development")
The main difference is that right now, there aren't two distinct caches in the kernel. Meaning, the buffer cache maps on to the page cache. Earlier, in the 2.4 series, the page cache and buffer cache used to be two separate caches, which led to problems of maintaining coherency when a block was present in the buffer cache as well as the page cache. The other issue was that you would obviously use up too much memory if a lot of blocks were present in both caches. Now that the buffer cache entries (to put it very simply) "point" to parts in the page cache, you don't have to worry much about synchronizing the two caches.
The files you can look at are mm/filemap.c, mm/page-writeback.c. It's also worth looking at mm/pdflush.c and understand how the pdflush daemon works. This'd just be a subset of everything that uses the page cache, but a decent enough place to start.
I hope this helps!
Difference between kernel 2.4 and 2.6 in Disk CacheAndAccessFile
Thanks a lot for your answer...I've another question...I've understood that Buffer Cache maps on page cache, but singles architecture(data structure,fuctions etc) of two caches remains invariate in kernel 2.6?..I ask this because i've to make a presentation and I've made a lot of work to describe the Page and Buffer cache. Can I insert in the final a slide which says that BC points to PC...or I must elimate my slides :)...
tnx
Well, I don't know if "invari
Well, I don't know if "invariate" can be taken as an absolute. But if you check out something like say bread(), it definitely is there in both the 2.4 and 2.6 kernel series. And I know for a fact that bread() goes down somewhere and reads from the page cache in kernel 2.6, and it directly calls a routine in ll_rw_blk.c to perform IO in kernel 2.4. So at least bread() is pretty much the same from the outside. Maybe you should do some more ground work and find out if the other functions are similar, too. But yes, you can put that slide in your presentation that says that the buffer cache maps on to the page cache. :-)
Good luck with your presentation.
;)
thanks a lot!!!!!!