Lines Matching refs:journal
38 struct journal_device *ja = &ca->journal; in journal_read_bucket()
42 struct jset *j, *data = ca->set->journal.w[0].data; in journal_read_bucket()
183 struct journal_device *ja = &ca->journal; in bch_journal_read()
285 c->journal.seq = list_entry(list->prev, in bch_journal_read()
298 struct journal *j = &c->journal; in bch_journal_mark()
409 void bch_journal_space_reserve(struct journal *j) in bch_journal_space_reserve()
424 if (c->journal.btree_flushing) in btree_flush_write()
427 spin_lock(&c->journal.flush_write_lock); in btree_flush_write()
428 if (c->journal.btree_flushing) { in btree_flush_write()
429 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
432 c->journal.btree_flushing = true; in btree_flush_write()
433 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
436 spin_lock(&c->journal.lock); in btree_flush_write()
437 fifo_front_p = &fifo_front(&c->journal.pin); in btree_flush_write()
444 spin_unlock(&c->journal.lock); in btree_flush_write()
447 spin_unlock(&c->journal.lock); in btree_flush_write()
449 mask = c->journal.pin.mask; in btree_flush_write()
462 now_fifo_front_p = &fifo_front(&c->journal.pin); in btree_flush_write()
489 if (!btree_current_write(b)->journal) { in btree_flush_write()
507 if (((btree_current_write(b)->journal - fifo_front_p) & in btree_flush_write()
544 if (!btree_current_write(b)->journal) { in btree_flush_write()
564 spin_lock(&c->journal.flush_write_lock); in btree_flush_write()
565 c->journal.btree_flushing = false; in btree_flush_write()
566 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
575 struct cache *ca = container_of(ja, struct cache, journal); in journal_discard_endio()
579 closure_wake_up(&ca->set->journal.wait); in journal_discard_endio()
593 struct journal_device *ja = &ca->journal; in do_journal_discard()
632 struct journal *j = &c->journal; in free_journal_buckets()
634 struct journal_device *ja = &c->cache->journal; in free_journal_buckets()
651 struct bkey *k = &c->journal.key; in journal_reclaim()
654 struct journal_device *ja = &ca->journal; in journal_reclaim()
659 while (!atomic_read(&fifo_front(&c->journal.pin))) in journal_reclaim()
660 fifo_pop(&c->journal.pin, p); in journal_reclaim()
662 last_seq = last_seq(&c->journal); in journal_reclaim()
673 if (c->journal.blocks_free) in journal_reclaim()
687 c->journal.blocks_free = ca->sb.bucket_size >> c->block_bits; in journal_reclaim()
690 if (!journal_full(&c->journal)) in journal_reclaim()
691 __closure_wake_up(&c->journal.wait); in journal_reclaim()
694 void bch_journal_next(struct journal *j) in bch_journal_next()
723 closure_put(&w->c->journal.io); in journal_write_endio()
730 closure_type(j, struct journal, io); in CLOSURE_CALLBACK()
740 __releases(&c->journal.lock)
742 closure_type(c, struct cache_set, journal.io);
744 c->journal.io_in_flight = 0;
745 spin_unlock(&c->journal.lock);
749 __releases(c->journal.lock)
751 closure_type(c, struct cache_set, journal.io);
753 struct journal_write *w = c->journal.cur;
754 struct bkey *k = &c->journal.key;
766 } else if (journal_full(&c->journal)) {
768 spin_unlock(&c->journal.lock);
775 c->journal.blocks_free -= set_blocks(w->data, block_bytes(ca));
785 w->data->last_seq = last_seq(&c->journal);
790 bio = &ca->journal.bio;
808 ca->journal.seq[ca->journal.cur_idx] = w->data->seq;
814 atomic_dec_bug(&fifo_back(&c->journal.pin));
815 bch_journal_next(&c->journal);
818 spin_unlock(&c->journal.lock);
828 closure_type(c, struct cache_set, journal.io); in CLOSURE_CALLBACK()
830 spin_lock(&c->journal.lock); in CLOSURE_CALLBACK()
835 __releases(c->journal.lock) in journal_try_write()
837 struct closure *cl = &c->journal.io; in journal_try_write()
838 struct journal_write *w = c->journal.cur; in journal_try_write()
842 if (!c->journal.io_in_flight) { in journal_try_write()
843 c->journal.io_in_flight = 1; in journal_try_write()
846 spin_unlock(&c->journal.lock); in journal_try_write()
852 __acquires(&c->journal.lock) in journal_wait_for_write()
861 spin_lock(&c->journal.lock); in journal_wait_for_write()
864 struct journal_write *w = c->journal.cur; in journal_wait_for_write()
870 c->journal.blocks_free * ca->sb.block_size, in journal_wait_for_write()
875 closure_wait(&c->journal.wait, &cl); in journal_wait_for_write()
877 if (!journal_full(&c->journal)) { in journal_wait_for_write()
895 spin_unlock(&c->journal.lock); in journal_wait_for_write()
901 spin_lock(&c->journal.lock); in journal_wait_for_write()
910 journal.work); in journal_write_work()
911 spin_lock(&c->journal.lock); in journal_write_work()
912 if (c->journal.cur->dirty) in journal_write_work()
915 spin_unlock(&c->journal.lock); in journal_write_work()
943 ret = &fifo_back(&c->journal.pin); in bch_journal()
951 queue_delayed_work(bch_flush_wq, &c->journal.work, in bch_journal()
953 spin_unlock(&c->journal.lock); in bch_journal()
955 spin_unlock(&c->journal.lock); in bch_journal()
976 free_pages((unsigned long) c->journal.w[1].data, JSET_BITS); in bch_journal_free()
977 free_pages((unsigned long) c->journal.w[0].data, JSET_BITS); in bch_journal_free()
978 free_fifo(&c->journal.pin); in bch_journal_free()
983 struct journal *j = &c->journal; in bch_journal_alloc()