From b1ec9df8ee807c0b9e4d0f6b0d4e0fac617a75c2 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 9 Jul 2010 20:39:45 +1000 Subject: [PATCH] Only increment pending_nxt when we finish a cluster cluster_reset is called when we reset a cluster, but also when we reposition to the start of a new segment - which should be the same cluster. pending_nxt should only be changed in the first of those cases. Signed-off-by: NeilBrown --- cluster.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cluster.c b/cluster.c index 96b9afa..9e32b2d 100644 --- a/cluster.c +++ b/cluster.c @@ -381,7 +381,6 @@ static void cluster_reset(struct fs *fs, struct wc *wc) int blocksize = fs->prime_sb->s_blocksize; if (wc->seg.dev < 0) { wc->remaining = 0; - wc->chead = NULL; wc->chead_size = 0; return; } @@ -389,11 +388,8 @@ static void cluster_reset(struct fs *fs, struct wc *wc) wc->chead_blocks = 1; wc->remaining--; wc->cluster_space = blocksize - sizeof(struct cluster_head); - wc->chead_size = sizeof(struct cluster_head); - - wc->pending_next = (wc->pending_next+1) % 4; wc->chead = page_address(wc->page[wc->pending_next]); - + wc->chead_size = sizeof(struct cluster_head); } static void close_segment(struct fs *fs, int cnum) @@ -1390,6 +1386,7 @@ static void cluster_flush(struct fs *fs, int cnum) } dprintk("D %d\n", wake); + wc->pending_next = (wc->pending_next+1) % 4; /* now re-initialise the cluster information */ cluster_reset(fs, wc); @@ -1544,6 +1541,8 @@ int lafs_cluster_init(struct fs *fs, int cnum, u64 addr, u64 prev, u64 seq) INIT_LIST_HEAD(&wc->clhead); for (i = 0; i < 4 ; i++) { + wc->pending_vfy_type[i] = VerifyNull; + atomic_set(&wc->pending_cnt[i], 0); wc->page[i] = alloc_page(GFP_KERNEL); if (!wc->page[i]) break; @@ -1555,7 +1554,7 @@ int lafs_cluster_init(struct fs *fs, int cnum, u64 addr, u64 prev, u64 seq) } return -ENOMEM; } - wc->pending_next = -1; + wc->pending_next = 0; wc->cluster_seq = seq; wc->prev_addr = prev; -- 2.39.5