[Ocfs2-tools-devel] [PATCH 12/13] fsck.ocfs2: Pre-cache inodes in reverse order.

Joel Becker Joel.Becker at oracle.com
Fri Jun 19 15:50:57 PDT 2009


On Fri, Jun 19, 2009 at 03:26:53PM -0700, Sunil Mushran wrote:
> What if the chain record is empty? This patch does not mesh
> with the PR_CHAIN_EMPTY case.

	I fixed it to ... oh, wait, we don't go back around to fix the
bg_chain value.  Is that what you mean?

Joel

> Joel Becker wrote:
> >We want the first inodes seen by the inode scan to have a higher
> >priority in the cache.  That way they aren't flushed from the cache by
> >extent blocks.
> >
> >Signed-off-by: Joel Becker <joel.becker at oracle.com>
> >---
> > fsck.ocfs2/pass0.c |   11 ++++++++---
> > 1 files changed, 8 insertions(+), 3 deletions(-)
> >
> >diff --git a/fsck.ocfs2/pass0.c b/fsck.ocfs2/pass0.c
> >index 1961aae..0e3f346 100644
> >--- a/fsck.ocfs2/pass0.c
> >+++ b/fsck.ocfs2/pass0.c
> >@@ -650,7 +650,7 @@ static errcode_t verify_chain_alloc(o2fsck_state *ost,
> > {
> > 	struct chain_state cs = {0, };
> > 	struct ocfs2_chain_list *cl;
> >-	uint16_t i, max_count;
> >+	int i, max_count;
> > 	struct ocfs2_chain_rec *cr;
> > 	uint32_t free = 0, total = 0;
> > 	int changed = 0, trust_next_free = 1;
> >@@ -741,7 +741,13 @@ static errcode_t verify_chain_alloc(o2fsck_state *ost,
> > 	if (trust_next_free)
> > 		max_count = cl->cl_next_free_rec;
> >-	for (i = 0; i < max_count; i++) {
> >+	/*
> >+	 * We walk the chains backwards for caching reasons.  Basically,
> >+	 * at the end the last blocks we read will be the most recently
> >+	 * used in the cache.  We want that to be the first chains,
> >+	 * especially for the inode scan, which will read forwards.
> >+	 */
> >+	for (i = max_count - 1; i >= 0; i--) {
> > 		cr = &cl->cl_recs[i];
> > 		/* reset for each run */
> >@@ -782,7 +788,6 @@ static errcode_t verify_chain_alloc(o2fsck_state *ost,
> > 				*cr = cl->cl_recs[cl->cl_next_free_rec - 1];
> > 				memset(&cl->cl_recs[cl->cl_next_free_rec - 1],
> > 					0, sizeof(struct ocfs2_chain_rec));
> >-				i--;
> > 			}
> > 			cl->cl_next_free_rec--;
> 

-- 

"Senator let's be sincere,
 As much as you can."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list