[Ocfs2-tools-devel] [PATCH 12/13] fsck.ocfs2: Pre-cache inodes in reverse order.
Joel Becker
joel.becker at oracle.com
Tue May 26 16:03:32 PDT 2009
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--;
--
1.6.3
More information about the Ocfs2-tools-devel
mailing list