aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-02-27 20:51:12 -0500
committerKent Overstreet <kmo@daterainc.com>2014-03-18 15:24:54 -0400
commit3a2fd9d5090b83aab85378a846fa10f39b0b5aa7 (patch)
tree13862a06f381010ba9716441d4f844d953472670 /drivers/md
parent2531d9ee61fa08a5a9ab8f002c50779888d232c7 (diff)
bcache: Kill bucket->gc_gen
gc_gen was a temporary used to recalculate last_gc, but since we only need bucket->last_gc when gc isn't running (gc_mark_valid = 1), we can just update last_gc directly. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bcache/bcache.h3
-rw-r--r--drivers/md/bcache/btree.c7
-rw-r--r--drivers/md/bcache/extents.c8
-rw-r--r--drivers/md/bcache/super.c2
4 files changed, 9 insertions, 11 deletions
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index 200efc1b5cf8..82c9c5d35251 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -196,7 +196,6 @@ struct bucket {
196 uint16_t prio; 196 uint16_t prio;
197 uint8_t gen; 197 uint8_t gen;
198 uint8_t last_gc; /* Most out of date gen in the btree */ 198 uint8_t last_gc; /* Most out of date gen in the btree */
199 uint8_t gc_gen;
200 uint16_t gc_mark; /* Bitfield used by GC. See below for field */ 199 uint16_t gc_mark; /* Bitfield used by GC. See below for field */
201}; 200};
202 201
@@ -588,7 +587,7 @@ struct cache_set {
588 uint16_t min_prio; 587 uint16_t min_prio;
589 588
590 /* 589 /*
591 * max(gen - gc_gen) for all buckets. When it gets too big we have to gc 590 * max(gen - last_gc) for all buckets. When it gets too big we have to gc
592 * to keep gens from wrapping around. 591 * to keep gens from wrapping around.
593 */ 592 */
594 uint8_t need_gc; 593 uint8_t need_gc;
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 4c340c85b122..7347b6100961 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1178,8 +1178,8 @@ static uint8_t __bch_btree_mark_key(struct cache_set *c, int level,
1178 1178
1179 g = PTR_BUCKET(c, k, i); 1179 g = PTR_BUCKET(c, k, i);
1180 1180
1181 if (gen_after(g->gc_gen, PTR_GEN(k, i))) 1181 if (gen_after(g->last_gc, PTR_GEN(k, i)))
1182 g->gc_gen = PTR_GEN(k, i); 1182 g->last_gc = PTR_GEN(k, i);
1183 1183
1184 if (ptr_stale(c, k, i)) { 1184 if (ptr_stale(c, k, i)) {
1185 stale = max(stale, ptr_stale(c, k, i)); 1185 stale = max(stale, ptr_stale(c, k, i));
@@ -1631,7 +1631,7 @@ static void btree_gc_start(struct cache_set *c)
1631 1631
1632 for_each_cache(ca, c, i) 1632 for_each_cache(ca, c, i)
1633 for_each_bucket(b, ca) { 1633 for_each_bucket(b, ca) {
1634 b->gc_gen = b->gen; 1634 b->last_gc = b->gen;
1635 if (!atomic_read(&b->pin)) { 1635 if (!atomic_read(&b->pin)) {
1636 SET_GC_MARK(b, 0); 1636 SET_GC_MARK(b, 0);
1637 SET_GC_SECTORS_USED(b, 0); 1637 SET_GC_SECTORS_USED(b, 0);
@@ -1693,7 +1693,6 @@ static size_t bch_btree_gc_finish(struct cache_set *c)
1693 SET_GC_MARK(ca->buckets + *i, GC_MARK_METADATA); 1693 SET_GC_MARK(ca->buckets + *i, GC_MARK_METADATA);
1694 1694
1695 for_each_bucket(b, ca) { 1695 for_each_bucket(b, ca) {
1696 b->last_gc = b->gc_gen;
1697 c->need_gc = max(c->need_gc, bucket_gc_gen(b)); 1696 c->need_gc = max(c->need_gc, bucket_gc_gen(b));
1698 1697
1699 if (atomic_read(&b->pin)) 1698 if (atomic_read(&b->pin))
diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
index 82d5e3288a6c..35887330b49d 100644
--- a/drivers/md/bcache/extents.c
+++ b/drivers/md/bcache/extents.c
@@ -194,9 +194,9 @@ err:
194 mutex_unlock(&b->c->bucket_lock); 194 mutex_unlock(&b->c->bucket_lock);
195 bch_extent_to_text(buf, sizeof(buf), k); 195 bch_extent_to_text(buf, sizeof(buf), k);
196 btree_bug(b, 196 btree_bug(b,
197"inconsistent btree pointer %s: bucket %zi pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i", 197"inconsistent btree pointer %s: bucket %zi pin %i prio %i gen %i last_gc %i mark %llu",
198 buf, PTR_BUCKET_NR(b->c, k, i), atomic_read(&g->pin), 198 buf, PTR_BUCKET_NR(b->c, k, i), atomic_read(&g->pin),
199 g->prio, g->gen, g->last_gc, GC_MARK(g), g->gc_gen); 199 g->prio, g->gen, g->last_gc, GC_MARK(g));
200 return true; 200 return true;
201} 201}
202 202
@@ -515,9 +515,9 @@ err:
515 mutex_unlock(&b->c->bucket_lock); 515 mutex_unlock(&b->c->bucket_lock);
516 bch_extent_to_text(buf, sizeof(buf), k); 516 bch_extent_to_text(buf, sizeof(buf), k);
517 btree_bug(b, 517 btree_bug(b,
518"inconsistent extent pointer %s:\nbucket %zu pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i", 518"inconsistent extent pointer %s:\nbucket %zu pin %i prio %i gen %i last_gc %i mark %llu",
519 buf, PTR_BUCKET_NR(b->c, k, ptr), atomic_read(&g->pin), 519 buf, PTR_BUCKET_NR(b->c, k, ptr), atomic_read(&g->pin),
520 g->prio, g->gen, g->last_gc, GC_MARK(g), g->gc_gen); 520 g->prio, g->gen, g->last_gc, GC_MARK(g));
521 return true; 521 return true;
522} 522}
523 523
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a8c57d59a726..926ded8ccbf5 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -635,7 +635,7 @@ static void prio_read(struct cache *ca, uint64_t bucket)
635 } 635 }
636 636
637 b->prio = le16_to_cpu(d->prio); 637 b->prio = le16_to_cpu(d->prio);
638 b->gen = b->last_gc = b->gc_gen = d->gen; 638 b->gen = b->last_gc = d->gen;
639 } 639 }
640} 640}
641 641