<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
στις 5/31/2010 9:04 PM, O/H Andi Kleen έγραψε:
<blockquote cite="mid:87aargt0ap.fsf@basil.nowhere.org" type="cite">
<pre wrap="">Yannis Klonatos <a class="moz-txt-link-rfc2396E" href="mailto:klonatos@ics.forth.gr"><klonatos@ics.forth.gr></a> writes:
</pre>
<blockquote type="cite">
<pre wrap=""> 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.
</pre>
</blockquote>
<pre wrap="">
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
</pre>
</blockquote>
<br>
First of all thanks for your quick reply.<br>
<br>
So, if i understand correctly, what you are saying is that it is
basically impossible to modify xfs code<br>
so that i get that specific information? This sounds a bit strange
since if XFS was indeed using the <br>
buffercache as ext3 or other fs does, the following modification would
suffice (file fs/buffer.c):<br>
<br>
<span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: sans-serif;">
<pre class="done" id="47/d4/e8f84d9c5bc4a779e65d674345bd8729d9aa_3/1000"
style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">struct <a
href="+code=buffer_head" class="sref">buffer_head</a> *
<a href="+code=__find_get_block" class="sref">find_get_block</a>(struct <a
href="+code=block_device" class="sref">block_device</a> *<a
href="+code=bdev" class="sref">bdev</a>, <a href="+code=sector_t"
class="sref">sector_t</a> <a href="+code=block" class="sref">block</a>, int <a
href="+code=size" class="sref">size</a>) {
        struct <a href="+code=buffer_head" class="sref">buffer_head</a> *<a
href="+code=bh" class="sref">bh</a> = <a href="+code=lookup_bh_lru"
class="sref">lookup_bh_lru</a>(<a href="+code=bdev" class="sref">bdev</a>, <a
href="+code=block" class="sref">block</a>, <a href="+code=size"
class="sref">size</a>);
        /* BEGIN MODIFICATION */
        if (bh) buffercache_hits++;
        else buffercache_misses++;
        /* END MODIFICATION */
if (<a href="+code=bh" class="sref">bh</a> == <a
href="+code=NULL" class="sref">NULL</a>) {
<a href="+code=bh" class="sref">bh</a> = <a
href="+code=__find_get_block_slow" class="sref">__find_get_block_slow</a>(<a
href="+code=bdev" class="sref">bdev</a>, <a href="+code=block"
class="sref">block</a>);
if (<a href="+code=bh" class="sref">bh</a>)
<a href="+code=bh_lru_install" class="sref">bh_lru_install</a>(<a
href="+code=bh" class="sref">bh</a>);
}
if (<a href="+code=bh" class="sref">bh</a>) {
<a href="+code=touch_buffer" class="sref">touch_buffer</a>(<a
href="+code=bh" class="sref">bh</a>);
return <a href="+code=bh" class="sref">bh</a>;
}
<a href="+code=EXPORT_SYMBOL" class="sref">XPORT_SYMBOL</a>(<a
href="+code=__find_get_block" class="sref">__find_get_block</a>);</pre>
</span></span><br>
</body>
</html>