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()
182 struct journal_device *ja = &ca->journal; in bch_journal_read()
284 c->journal.seq = list_entry(list->prev, in bch_journal_read()
297 struct journal *j = &c->journal; in bch_journal_mark()
408 void bch_journal_space_reserve(struct journal *j) in bch_journal_space_reserve()
423 if (c->journal.btree_flushing) in btree_flush_write()
426 spin_lock(&c->journal.flush_write_lock); in btree_flush_write()
427 if (c->journal.btree_flushing) { in btree_flush_write()
428 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
431 c->journal.btree_flushing = true; in btree_flush_write()
432 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
435 spin_lock(&c->journal.lock); in btree_flush_write()
436 fifo_front_p = &fifo_front(&c->journal.pin); in btree_flush_write()
443 spin_unlock(&c->journal.lock); in btree_flush_write()
446 spin_unlock(&c->journal.lock); in btree_flush_write()
448 mask = c->journal.pin.mask; in btree_flush_write()
461 now_fifo_front_p = &fifo_front(&c->journal.pin); in btree_flush_write()
488 if (!btree_current_write(b)->journal) { in btree_flush_write()
506 if (((btree_current_write(b)->journal - fifo_front_p) & in btree_flush_write()
543 if (!btree_current_write(b)->journal) { in btree_flush_write()
563 spin_lock(&c->journal.flush_write_lock); in btree_flush_write()
564 c->journal.btree_flushing = false; in btree_flush_write()
565 spin_unlock(&c->journal.flush_write_lock); in btree_flush_write()
574 struct cache *ca = container_of(ja, struct cache, journal); in journal_discard_endio()
578 closure_wake_up(&ca->set->journal.wait); in journal_discard_endio()
592 struct journal_device *ja = &ca->journal; in do_journal_discard()
631 struct journal *j = &c->journal; in free_journal_buckets()
633 struct journal_device *ja = &c->cache->journal; in free_journal_buckets()
650 struct bkey *k = &c->journal.key; in journal_reclaim()
653 struct journal_device *ja = &ca->journal; in journal_reclaim()
658 while (!atomic_read(&fifo_front(&c->journal.pin))) in journal_reclaim()
659 fifo_pop(&c->journal.pin, p); in journal_reclaim()
661 last_seq = last_seq(&c->journal); in journal_reclaim()
672 if (c->journal.blocks_free) in journal_reclaim()
686 c->journal.blocks_free = ca->sb.bucket_size >> c->block_bits; in journal_reclaim()
689 if (!journal_full(&c->journal)) in journal_reclaim()
690 __closure_wake_up(&c->journal.wait); in journal_reclaim()
693 void bch_journal_next(struct journal *j) in bch_journal_next()
722 closure_put(&w->c->journal.io); in journal_write_endio()
729 struct journal *j = container_of(cl, struct journal, io); in journal_write_done()
739 __releases(&c->journal.lock) in journal_write_unlock()
741 struct cache_set *c = container_of(cl, struct cache_set, journal.io); in journal_write_unlock()
743 c->journal.io_in_flight = 0; in journal_write_unlock()
744 spin_unlock(&c->journal.lock); in journal_write_unlock()
748 __releases(c->journal.lock) in journal_write_unlocked()
750 struct cache_set *c = container_of(cl, struct cache_set, journal.io); in journal_write_unlocked()
752 struct journal_write *w = c->journal.cur; in journal_write_unlocked()
753 struct bkey *k = &c->journal.key; in journal_write_unlocked()
765 } else if (journal_full(&c->journal)) { in journal_write_unlocked()
767 spin_unlock(&c->journal.lock); in journal_write_unlocked()
774 c->journal.blocks_free -= set_blocks(w->data, block_bytes(ca)); in journal_write_unlocked()
784 w->data->last_seq = last_seq(&c->journal); in journal_write_unlocked()
789 bio = &ca->journal.bio; in journal_write_unlocked()
807 ca->journal.seq[ca->journal.cur_idx] = w->data->seq; in journal_write_unlocked()
813 atomic_dec_bug(&fifo_back(&c->journal.pin)); in journal_write_unlocked()
814 bch_journal_next(&c->journal); in journal_write_unlocked()
817 spin_unlock(&c->journal.lock); in journal_write_unlocked()
827 struct cache_set *c = container_of(cl, struct cache_set, journal.io); in journal_write()
829 spin_lock(&c->journal.lock); in journal_write()
834 __releases(c->journal.lock) in journal_try_write()
836 struct closure *cl = &c->journal.io; in journal_try_write()
837 struct journal_write *w = c->journal.cur; in journal_try_write()
841 if (!c->journal.io_in_flight) { in journal_try_write()
842 c->journal.io_in_flight = 1; in journal_try_write()
845 spin_unlock(&c->journal.lock); in journal_try_write()
851 __acquires(&c->journal.lock) in journal_wait_for_write()
860 spin_lock(&c->journal.lock); in journal_wait_for_write()
863 struct journal_write *w = c->journal.cur; in journal_wait_for_write()
869 c->journal.blocks_free * ca->sb.block_size, in journal_wait_for_write()
874 closure_wait(&c->journal.wait, &cl); in journal_wait_for_write()
876 if (!journal_full(&c->journal)) { in journal_wait_for_write()
894 spin_unlock(&c->journal.lock); in journal_wait_for_write()
900 spin_lock(&c->journal.lock); in journal_wait_for_write()
909 journal.work); in journal_write_work()
910 spin_lock(&c->journal.lock); in journal_write_work()
911 if (c->journal.cur->dirty) in journal_write_work()
914 spin_unlock(&c->journal.lock); in journal_write_work()
942 ret = &fifo_back(&c->journal.pin); in bch_journal()
950 queue_delayed_work(bch_flush_wq, &c->journal.work, in bch_journal()
952 spin_unlock(&c->journal.lock); in bch_journal()
954 spin_unlock(&c->journal.lock); in bch_journal()
975 free_pages((unsigned long) c->journal.w[1].data, JSET_BITS); in bch_journal_free()
976 free_pages((unsigned long) c->journal.w[0].data, JSET_BITS); in bch_journal_free()
977 free_fifo(&c->journal.pin); in bch_journal_free()
982 struct journal *j = &c->journal; in bch_journal_alloc()