]> git.neil.brown.name Git - LaFS.git/commitdiff
temp_credits accounting.
authorNeilBrown <neilb@suse.de>
Sat, 8 Aug 2009 05:25:07 +0000 (15:25 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 8 Aug 2009 05:25:07 +0000 (15:25 +1000)
Allow - in a totally smp-unsafe way - for credits which
aren't stored anywhere to be accounted when checking totals.

lafs.h
modify.c
segments.c

diff --git a/lafs.h b/lafs.h
index 5637fce14f936f87ffbcbffd66ca014944ec0aa4..32d9854b2b3da24c7a33cc4a9ff76cff918171ac 100644 (file)
--- 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);
index 0c9b4e9f003d7c4b6aca882c6f467d8cf2344f6f..27a682ed82450c6895249db9663302d9fd580889 100644 (file)
--- 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;
 }
index dc6e2e4115f7e613fc21d7bab3e2ec4c4704706c..65ff770e5b4253d8ab41bad622e831841d65cdcc 100644 (file)
@@ -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);