???? 5/31/2010 9:04 PM, O/H Andi Kleen ??????: > Yannis Klonatos writes: > > >> I was looking to add a kernel hook to my system in order to >> monitor buffer-cache hit and misses. Initially I was >> planning to add my modifications to the __getblk(). However, i noticed >> that XFS does not directly use the buffer-cache >> for its pages but it seems to implement its own buffer. >> What I am now looking for is 1) the place where XFS checks >> whether a page exists in its buffer or not and 2) >> what are the possible interactions between xfs_buf and the Linux >> kernel buffer-cache. >> I would appreciate any information regarding the above issues. >> > The kernel does not track all accesses, e.g. through mmap. > So you can only get misses (which is essentially IO rate and already > accounted), but not hits. > > -Andi > First of all thanks for your quick reply. So, if i understand correctly, what you are saying is that it is basically impossible to modify xfs code so that i get that specific information? This sounds a bit strange since if XFS was indeed using the buffercache as ext3 or other fs does, the following modification would suffice (file fs/buffer.c): structbuffer_head <+code=buffer_head> * find_get_block <+code=__find_get_block>(structblock_device <+code=block_device> *bdev <+code=bdev>,sector_t <+code=sector_t> block <+code=block>, intsize <+code=size>) { structbuffer_head <+code=buffer_head> *bh <+code=bh> =lookup_bh_lru <+code=lookup_bh_lru>(bdev <+code=bdev>,block <+code=block>,size <+code=size>); /* BEGIN MODIFICATION */ if (bh) buffercache_hits++; else buffercache_misses++; /* END MODIFICATION */ if (bh <+code=bh> ==NULL <+code=NULL>) { bh <+code=bh> =__find_get_block_slow <+code=__find_get_block_slow>(bdev <+code=bdev>,block <+code=block>); if (bh <+code=bh>) bh_lru_install <+code=bh_lru_install>(bh <+code=bh>); } if (bh <+code=bh>) { touch_buffer <+code=touch_buffer>(bh <+code=bh>); returnbh <+code=bh>; } XPORT_SYMBOL <+code=EXPORT_SYMBOL>(__find_get_block <+code=__find_get_block>);