From: "David S. Miller" <davem@redhat.com>
To: neilb@cse.unsw.edu.au
Cc: trond.myklebust@fys.uio.no, nfs@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: Fix knfsd readahead cache in 2.4.15
Date: Mon, 26 Nov 2001 16:05:59 -0800 (PST) [thread overview]
Message-ID: <20011126.160559.57441929.davem@redhat.com> (raw)
In-Reply-To: <20011126.155347.45872112.davem@redhat.com>
In-Reply-To: <15362.18626.303009.379772@charged.uio.no> <15362.53694.192797.275363@esther.cse.unsw.edu.au> <20011126.155347.45872112.davem@redhat.com>
From: "David S. Miller" <davem@redhat.com>
Date: Mon, 26 Nov 2001 15:53:47 -0800 (PST)
There are other problems remaining, this function is a logical
mess.
Replying to myself, I'd suggest a patch like the following to clear up
all the issues discovered:
--- fs/nfsd/vfs.c.~1~ Sun Oct 21 02:47:53 2001
+++ fs/nfsd/vfs.c Mon Nov 26 16:03:40 2001
@@ -545,32 +545,43 @@
static inline struct raparms *
nfsd_get_raparms(dev_t dev, ino_t ino)
{
- struct raparms *ra, **rap, **frap = NULL;
+ struct raparms *ra, *fra;
int depth = 0;
- for (rap = &raparm_cache; (ra = *rap); rap = &ra->p_next) {
+ ra = raparm_cache;
+ fra = NULL;
+ do {
if (ra->p_ino == ino && ra->p_dev == dev)
goto found;
+
depth++;
+
if (ra->p_count == 0)
- frap = rap;
- }
- depth = nfsdstats.ra_size*11/10;
- if (!frap)
+ fra = ra;
+
+ ra = ra->p_next;
+ } while (ra != raparm_cache);
+
+ if (!fra)
return NULL;
- rap = frap;
- ra = *frap;
- memset(ra, 0, sizeof(*ra));
+
+ ra = fra;
ra->p_dev = dev;
ra->p_ino = ino;
+ ra->p_reada = 0;
+ ra->p_ramax = 0;
+ ra->p_raend = 0;
+ ra->p_ralen = 0;
+ ra->p_rawin = 0;
+
found:
- if (rap != &raparm_cache) {
- *rap = ra->p_next;
- ra->p_next = raparm_cache;
+ if (ra != raparm_cache)
raparm_cache = ra;
- }
+
ra->p_count++;
- nfsdstats.ra_depth[depth*10/nfsdstats.ra_size]++;
+
+ nfsdstats.ra_depth[(depth <= 10 ? depth : 10)]++;
+
return ra;
}
@@ -1576,9 +1587,13 @@
dprintk("nfsd: allocating %d readahead buffers.\n",
cache_size);
memset(raparml, 0, sizeof(struct raparms) * cache_size);
+
+ /* Circular list. */
for (i = 0; i < cache_size - 1; i++) {
raparml[i].p_next = raparml + i + 1;
}
+ raparml[i].p_next = raparml;
+
raparm_cache = raparml;
} else {
printk(KERN_WARNING
next prev parent reply other threads:[~2001-11-27 0:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-26 13:50 Trond Myklebust
2001-11-26 23:35 ` Neil Brown
2001-11-27 0:05 ` David S. Miller [this message]
2001-11-26 23:53 ` David S. Miller
2001-11-27 0:29 ` Neil Brown
2001-11-27 0:33 ` David S. Miller
2001-11-27 1:25 ` [NFS] " Benjamin LaHaise
2001-11-27 13:54 ` Trond Myklebust
2001-11-27 15:23 ` Benjamin LaHaise
2001-11-27 15:44 ` Trond Myklebust
2001-11-28 21:03 ` Benjamin LaHaise
[not found] <15362.18626.303009.379772@charged.uio.no.suse.lists.linux.kernel>
[not found] ` <15362.53694.192797.275363@esther.cse.unsw.edu.au.suse.lists.linux.kernel>
[not found] ` <20011126.155347.45872112.davem@redhat.com.suse.lists.linux.kernel>
2001-11-27 7:16 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011126.160559.57441929.davem@redhat.com \
--to=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
--cc=nfs@lists.sourceforge.net \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome