From 6115a48840935326f36a9603a2b24d8be72c5575 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 3 May 2011 14:16:11 +1000 Subject: [PATCH] cleaner: revise rules for emergency clean. Normally we only clean when there is free space available for dedicated cleaning segments. However if space is tight we might need to clean to the main segment. Do this only if there are no 'clean' segments (otherwise force a checkpoint so those clean segments become free). clean_reserved doesn't really factor into this decision. Signed-off-by: NeilBrown --- clean.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clean.c b/clean.c index b5b026f..ebe329c 100644 --- a/clean.c +++ b/clean.c @@ -629,14 +629,12 @@ unsigned long lafs_do_clean(struct fs *fs) /* If we can only clean to main segment, we may * have to. However: * - only do one segment at a time - * - if there is any clean_reserved, then use it - * - if there are no 'clean' segments, then clean. + * - only if there are no clean (but not yet free) segments * - if CleanerBlocks, then clean. * otherwise don't. */ - if (fs->clean_reserved - || fs->segtrack->clean.cnt == 0 - || test_bit(CleanerBlocks, &fs->fsstate)) + if (fs->segtrack->clean.cnt == 0 + && test_bit(CleanerBlocks, &fs->fsstate)) max_segs = 1; } for (i = 0; i < max_segs; i++) { -- 2.43.0