diff options
Diffstat (limited to 'drivers/md/bcache/movinggc.c')
-rw-r--r-- | drivers/md/bcache/movinggc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/md/bcache/movinggc.c b/drivers/md/bcache/movinggc.c index 9eb60d102de8..cd7490311e51 100644 --- a/drivers/md/bcache/movinggc.c +++ b/drivers/md/bcache/movinggc.c | |||
@@ -24,12 +24,10 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k) | |||
24 | moving_gc_keys); | 24 | moving_gc_keys); |
25 | unsigned i; | 25 | unsigned i; |
26 | 26 | ||
27 | for (i = 0; i < KEY_PTRS(k); i++) { | 27 | for (i = 0; i < KEY_PTRS(k); i++) |
28 | struct bucket *g = PTR_BUCKET(c, k, i); | 28 | if (ptr_available(c, k, i) && |
29 | 29 | GC_MOVE(PTR_BUCKET(c, k, i))) | |
30 | if (GC_MOVE(g)) | ||
31 | return true; | 30 | return true; |
32 | } | ||
33 | 31 | ||
34 | return false; | 32 | return false; |
35 | } | 33 | } |
@@ -115,7 +113,7 @@ static void write_moving(struct closure *cl) | |||
115 | closure_call(&op->cl, bch_data_insert, NULL, cl); | 113 | closure_call(&op->cl, bch_data_insert, NULL, cl); |
116 | } | 114 | } |
117 | 115 | ||
118 | continue_at(cl, write_moving_finish, system_wq); | 116 | continue_at(cl, write_moving_finish, op->wq); |
119 | } | 117 | } |
120 | 118 | ||
121 | static void read_moving_submit(struct closure *cl) | 119 | static void read_moving_submit(struct closure *cl) |
@@ -125,7 +123,7 @@ static void read_moving_submit(struct closure *cl) | |||
125 | 123 | ||
126 | bch_submit_bbio(bio, io->op.c, &io->w->key, 0); | 124 | bch_submit_bbio(bio, io->op.c, &io->w->key, 0); |
127 | 125 | ||
128 | continue_at(cl, write_moving, system_wq); | 126 | continue_at(cl, write_moving, io->op.wq); |
129 | } | 127 | } |
130 | 128 | ||
131 | static void read_moving(struct cache_set *c) | 129 | static void read_moving(struct cache_set *c) |
@@ -160,6 +158,7 @@ static void read_moving(struct cache_set *c) | |||
160 | io->w = w; | 158 | io->w = w; |
161 | io->op.inode = KEY_INODE(&w->key); | 159 | io->op.inode = KEY_INODE(&w->key); |
162 | io->op.c = c; | 160 | io->op.c = c; |
161 | io->op.wq = c->moving_gc_wq; | ||
163 | 162 | ||
164 | moving_init(io); | 163 | moving_init(io); |
165 | bio = &io->bio.bio; | 164 | bio = &io->bio.bio; |
@@ -216,7 +215,10 @@ void bch_moving_gc(struct cache_set *c) | |||
216 | ca->heap.used = 0; | 215 | ca->heap.used = 0; |
217 | 216 | ||
218 | for_each_bucket(b, ca) { | 217 | for_each_bucket(b, ca) { |
219 | if (!GC_SECTORS_USED(b)) | 218 | if (GC_MARK(b) == GC_MARK_METADATA || |
219 | !GC_SECTORS_USED(b) || | ||
220 | GC_SECTORS_USED(b) == ca->sb.bucket_size || | ||
221 | atomic_read(&b->pin)) | ||
220 | continue; | 222 | continue; |
221 | 223 | ||
222 | if (!heap_full(&ca->heap)) { | 224 | if (!heap_full(&ca->heap)) { |