1 #ifndef _BCACHE_MOVINGGC_H
2 #define _BCACHE_MOVINGGC_H
5 * We can't use the entire copygc reserve in one iteration of copygc: we may
6 * need the buckets we're freeing up to go back into the copygc reserve to make
7 * forward progress, but if the copygc reserve is full they'll be available for
8 * any allocation - and it's possible that in a given iteration, we free up most
9 * of the buckets we're going to free before we allocate most of the buckets
10 * we're going to allocate.
12 * If we only use half of the reserve per iteration, then in steady state we'll
13 * always have room in the reserve for the buckets we're going to need in the
16 #define COPYGC_BUCKETS_PER_ITER(ca) \
17 ((ca)->free[RESERVE_MOVINGGC].size / 2)
20 * Max sectors to move per iteration: Have to take into account internal
21 * fragmentation from the multiple write points for each generation:
23 #define COPYGC_SECTORS_PER_ITER(ca) \
24 ((ca)->mi.bucket_size * COPYGC_BUCKETS_PER_ITER(ca))
26 void bch_moving_init_cache(struct cache *);
27 void bch_moving_gc_stop(struct cache *);
28 int bch_moving_gc_thread_start(struct cache *);