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 unsafe_memcpy(&i->j, j, bytes, in journal_read_bucket()
158 if (j->seq > ja->seq[bucket_index]) in journal_read_bucket()
159 ja->seq[bucket_index] = j->seq; in journal_read_bucket()
163 j = ((void *) j) + blocks * block_bytes(ca); in journal_read_bucket()
233 list)->j.seq; in bch_journal_read()
239 list)->j.seq) in bch_journal_read()
287 list)->j.seq; in bch_journal_read()
298 struct journal *j = &c->journal; in bch_journal_mark() local
299 uint64_t last = j->seq; in bch_journal_mark()
309 BUG_ON(last < i->j.seq); in bch_journal_mark()
312 while (last-- != i->j.seq) in bch_journal_mark()
313 if (fifo_free(&j->pin) > 1) { in bch_journal_mark()
314 fifo_push_front(&j->pin, p); in bch_journal_mark()
315 atomic_set(&fifo_front(&j->pin), 0); in bch_journal_mark()
318 if (fifo_free(&j->pin) > 1) { in bch_journal_mark()
319 fifo_push_front(&j->pin, p); in bch_journal_mark()
320 i->pin = &fifo_front(&j->pin); in bch_journal_mark()
324 for (k = i->j.start; in bch_journal_mark()
325 k < bset_bkey_last(&i->j); in bch_journal_mark()
328 unsigned int j; in bch_journal_mark() local
330 for (j = 0; j < KEY_PTRS(k); j++) in bch_journal_mark()
331 if (ptr_available(c, k, j)) in bch_journal_mark()
332 atomic_inc(&PTR_BUCKET(c, k, j)->pin); in bch_journal_mark()
356 uint64_t start = i->j.last_seq, end = i->j.seq, n = start; in bch_journal_replay()
362 if (n != i->j.seq) { in bch_journal_replay()
365 n, i->j.seq - 1, start, end); in bch_journal_replay()
368 n, i->j.seq - 1, start, end); in bch_journal_replay()
374 for (k = i->j.start; in bch_journal_replay()
375 k < bset_bkey_last(&i->j); in bch_journal_replay()
393 n = i->j.seq + 1; in bch_journal_replay()
409 void bch_journal_space_reserve(struct journal *j) in bch_journal_space_reserve() argument
411 j->do_reserve = true; in bch_journal_space_reserve()
569 #define last_seq(j) ((j)->seq - fifo_used(&(j)->pin) + 1) argument
632 struct journal *j = &c->journal; in free_journal_buckets() local
643 if (n > (1 + j->do_reserve)) in free_journal_buckets()
644 return n - (1 + j->do_reserve); in free_journal_buckets()
694 void bch_journal_next(struct journal *j) in bch_journal_next() argument
698 j->cur = (j->cur == j->w) in bch_journal_next()
699 ? &j->w[1] in bch_journal_next()
700 : &j->w[0]; in bch_journal_next()
703 * The fifo_push() needs to happen at the same time as j->seq is in bch_journal_next()
706 BUG_ON(!fifo_push(&j->pin, p)); in bch_journal_next()
707 atomic_set(&fifo_back(&j->pin), 1); in bch_journal_next()
709 j->cur->data->seq = ++j->seq; in bch_journal_next()
710 j->cur->dirty = false; in bch_journal_next()
711 j->cur->need_write = false; in bch_journal_next()
712 j->cur->data->keys = 0; in bch_journal_next()
714 if (fifo_full(&j->pin)) in bch_journal_next()
715 pr_debug("journal_pin full (%zu)\n", fifo_used(&j->pin)); in bch_journal_next()
730 closure_type(j, struct journal, io); in CLOSURE_CALLBACK()
731 struct journal_write *w = (j->cur == j->w) in CLOSURE_CALLBACK()
732 ? &j->w[1] in CLOSURE_CALLBACK()
733 : &j->w[0]; in CLOSURE_CALLBACK()
983 struct journal *j = &c->journal; in bch_journal_alloc() local
985 spin_lock_init(&j->lock); in bch_journal_alloc()
986 spin_lock_init(&j->flush_write_lock); in bch_journal_alloc()
987 INIT_DELAYED_WORK(&j->work, journal_write_work); in bch_journal_alloc()
991 j->w[0].c = c; in bch_journal_alloc()
992 j->w[1].c = c; in bch_journal_alloc()
994 if (!(init_fifo(&j->pin, JOURNAL_PIN, GFP_KERNEL)) || in bch_journal_alloc()
995 !(j->w[0].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS)) || in bch_journal_alloc()
996 !(j->w[1].data = (void *) __get_free_pages(GFP_KERNEL|__GFP_COMP, JSET_BITS))) in bch_journal_alloc()