Lines Matching full:j

42 	struct jset *j, *data = ca->set->journal.w[0].data;  in journal_read_bucket()  local
73 j = data; in journal_read_bucket()
76 size_t blocks, bytes = set_bytes(j); in journal_read_bucket()
78 if (j->magic != jset_magic(&ca->sb)) { in journal_read_bucket()
93 if (j->csum != csum_set(j)) { in journal_read_bucket()
99 blocks = set_blocks(j, block_bytes(ca)); in journal_read_bucket()
103 * i->j.seq, the node on head has the smallest (oldest) in journal_read_bucket()
110 * i->j.seq < j->last_seq, it means the oldest jset in journal_read_bucket()
112 * this list. Otherwise, j is a candidate jset for in journal_read_bucket()
118 if (i->j.seq >= j->last_seq) in journal_read_bucket()
126 if (j->seq == i->j.seq) in journal_read_bucket()
130 * if j->seq is less than any i->j.last_seq in journal_read_bucket()
131 * in list, j is an expired and useless jset. in journal_read_bucket()
133 if (j->seq < i->j.last_seq) in journal_read_bucket()
138 * is elder then j. in journal_read_bucket()
140 if (j->seq > i->j.seq) { in journal_read_bucket()
148 i = kmalloc(offsetof(struct journal_replay, j) + in journal_read_bucket()
152 memcpy(&i->j, j, bytes); in journal_read_bucket()
157 if (j->seq > ja->seq[bucket_index]) in journal_read_bucket()
158 ja->seq[bucket_index] = j->seq; in journal_read_bucket()
162 j = ((void *) j) + blocks * block_bytes(ca); in journal_read_bucket()
232 list)->j.seq; in bch_journal_read()
238 list)->j.seq) in bch_journal_read()
286 list)->j.seq; in bch_journal_read()
297 struct journal *j = &c->journal; in bch_journal_mark() local
298 uint64_t last = j->seq; in bch_journal_mark()
308 BUG_ON(last < i->j.seq); in bch_journal_mark()
311 while (last-- != i->j.seq) in bch_journal_mark()
312 if (fifo_free(&j->pin) > 1) { in bch_journal_mark()
313 fifo_push_front(&j->pin, p); in bch_journal_mark()
314 atomic_set(&fifo_front(&j->pin), 0); in bch_journal_mark()
317 if (fifo_free(&j->pin) > 1) { in bch_journal_mark()
318 fifo_push_front(&j->pin, p); in bch_journal_mark()
319 i->pin = &fifo_front(&j->pin); in bch_journal_mark()
323 for (k = i->j.start; in bch_journal_mark()
324 k < bset_bkey_last(&i->j); in bch_journal_mark()
327 unsigned int j; in bch_journal_mark() local
329 for (j = 0; j < KEY_PTRS(k); j++) in bch_journal_mark()
330 if (ptr_available(c, k, j)) in bch_journal_mark()
331 atomic_inc(&PTR_BUCKET(c, k, j)->pin); in bch_journal_mark()
355 uint64_t start = i->j.last_seq, end = i->j.seq, n = start; in bch_journal_replay()
361 if (n != i->j.seq) { in bch_journal_replay()
364 n, i->j.seq - 1, start, end); in bch_journal_replay()
367 n, i->j.seq - 1, start, end); in bch_journal_replay()
373 for (k = i->j.start; in bch_journal_replay()
374 k < bset_bkey_last(&i->j); in bch_journal_replay()
392 n = i->j.seq + 1; in bch_journal_replay()
408 void bch_journal_space_reserve(struct journal *j) in bch_journal_space_reserve() argument
410 j->do_reserve = true; in bch_journal_space_reserve()
568 #define last_seq(j) ((j)->seq - fifo_used(&(j)->pin) + 1) argument
631 struct journal *j = &c->journal; in free_journal_buckets() local
642 if (n > (1 + j->do_reserve)) in free_journal_buckets()
643 return n - (1 + j->do_reserve); in free_journal_buckets()
693 void bch_journal_next(struct journal *j) in bch_journal_next() argument
697 j->cur = (j->cur == j->w) in bch_journal_next()
698 ? &j->w[1] in bch_journal_next()
699 : &j->w[0]; in bch_journal_next()
702 * The fifo_push() needs to happen at the same time as j->seq is in bch_journal_next()
705 BUG_ON(!fifo_push(&j->pin, p)); in bch_journal_next()
706 atomic_set(&fifo_back(&j->pin), 1); in bch_journal_next()
708 j->cur->data->seq = ++j->seq; in bch_journal_next()
709 j->cur->dirty = false; in bch_journal_next()
710 j->cur->need_write = false; in bch_journal_next()
711 j->cur->data->keys = 0; in bch_journal_next()
713 if (fifo_full(&j->pin)) in bch_journal_next()
714 pr_debug("journal_pin full (%zu)\n", fifo_used(&j->pin)); in bch_journal_next()
729 struct journal *j = container_of(cl, struct journal, io); in journal_write_done() local
730 struct journal_write *w = (j->cur == j->w) in journal_write_done()
731 ? &j->w[1] in journal_write_done()
732 : &j->w[0]; in journal_write_done()
982 struct journal *j = &c->journal; in bch_journal_alloc() local
984 spin_lock_init(&j->lock); in bch_journal_alloc()
985 spin_lock_init(&j->flush_write_lock); in bch_journal_alloc()
986 INIT_DELAYED_WORK(&j->work, journal_write_work); in bch_journal_alloc()
990 j->w[0].c = c; in bch_journal_alloc()
991 j->w[1].c = c; in bch_journal_alloc()
993 if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) || in bch_journal_alloc()
994 !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS)) || in bch_journal_alloc()
995 !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS))) in bch_journal_alloc()