diff mbox

[46/88] SQUASHME: pnfsblock: Fix missing extent in commit list

Message ID 5f0b764a27be72fd2861ef4a5f7d1e13d9180635.1307464382.git.rees@umich.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Jim Rees June 7, 2011, 5:31 p.m. UTC
From: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>

When offset is in the middle of a extent, we shouldn't step forward to
offset + extent->be_length, otherwise we may miss some extents in
commit list.

Signed-off-by: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/blocklayout/blocklayout.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index b0ad836..cf306e9 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -348,16 +348,13 @@  static void mark_extents_written(struct pnfs_block_layout *bl,
 	end = (offset + count + PAGE_CACHE_SIZE - 1) & (long)(PAGE_CACHE_MASK);
 	end >>= 9;
 	while (isect < end) {
+		sector_t len;
 		be = find_get_extent(bl, isect, NULL);
 		BUG_ON(!be); /* FIXME */
-		if (be->be_state != PNFS_BLOCK_INVALID_DATA)
-			isect += be->be_length;
-		else {
-			sector_t len;
-			len = min(end, be->be_f_offset + be->be_length) - isect;
+		len = min(end, be->be_f_offset + be->be_length) - isect;
+		if (be->be_state == PNFS_BLOCK_INVALID_DATA)
 			mark_for_commit(be, isect, len); /* What if fails? */
-			isect += len;
-		}
+		isect += len;
 		put_extent(be);
 	}
 }