From: NeilBrown Date: Sat, 8 Aug 2009 05:25:07 +0000 (+1000) Subject: temp_credits accounting. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=66ead2f97ea0e8d28f4834de629811c3d87444f3;p=LaFS.git temp_credits accounting. Allow - in a totally smp-unsafe way - for credits which aren't stored anywhere to be accounted when checking totals. --- diff --git a/lafs.h b/lafs.h index 5637fce..32d9854 100644 --- a/lafs.h +++ b/lafs.h @@ -602,6 +602,7 @@ void lafs_seg_move(struct fs *fs, u64 oldaddr, u64 newaddr, int lafs_segtrack_init(struct segtracker *st); void lafs_segtrack_free(struct segtracker *st); +extern int temp_credits;/* debugging */ void lafs_space_use(struct fs *fs, int); void lafs_free_get(struct fs *fs, unsigned int *dev, u32 *seg, int nonlogged, int ssnum); diff --git a/modify.c b/modify.c index 0c9b4e9..27a682e 100644 --- a/modify.c +++ b/modify.c @@ -296,6 +296,7 @@ static int incorporate_index(struct block *uninc, char *buf, int size) clear_bit(B_Uninc, &blk->flags); if (test_and_clear_bit(B_UnincCredit, &blk->flags)) credits++; + temp_credits = credits; putref(blk, MKREF(uninc)); } while (i < icnt) { @@ -303,6 +304,7 @@ static int incorporate_index(struct block *uninc, char *buf, int size) encode32(b, 0); i++; } + temp_credits = 0; return credits; } if (delcnt) { @@ -380,9 +382,11 @@ static int incorporate_index(struct block *uninc, char *buf, int size) clear_bit(B_Uninc, &blk->flags); if (test_and_clear_bit(B_UnincCredit, &blk->flags)) credits++; + temp_credits = credits; putref(blk, MKREF(uninc)); } } + temp_credits = 0; BUG_ON(ncnt); return credits; } diff --git a/segments.c b/segments.c index dc6e2e4..65ff770 100644 --- a/segments.c +++ b/segments.c @@ -541,6 +541,7 @@ static int count_credits(struct block *b) return credits; } +int temp_credits; static void check_credits(struct fs *fs) { /* DEBUGGING AID @@ -553,9 +554,9 @@ static void check_credits(struct fs *fs) return; credits = count_credits(&LAFSI(fs->ss[0].root)->iblock->b); credits += count_credits(&LAFSI(fs->ss[0].root)->dblock->b); - if (credits + fs->cluster_updates != fs->allocated_blocks) { - printk("credits=%d updates=%d allocated=%d\n", credits, - fs->cluster_updates, + if (credits + fs->cluster_updates + temp_credits != fs->allocated_blocks) { + printk("credits=%d updates=%d temp=%d allocated=%d\n", credits, + fs->cluster_updates, temp_credits, (int)fs->allocated_blocks); lafs_dump_tree(); BUG_ON(1);