Lines Matching full:j
118 static inline void journal_wake(struct journal *j) in journal_wake() argument
120 wake_up(&j->wait); in journal_wake()
121 closure_wake_up(&j->async_wait); in journal_wake()
124 static inline struct journal_buf *journal_cur_buf(struct journal *j) in journal_cur_buf() argument
126 return j->buf + j->reservations.idx; in journal_cur_buf()
131 static inline u64 journal_last_seq(struct journal *j) in journal_last_seq() argument
133 return j->pin.front; in journal_last_seq()
136 static inline u64 journal_cur_seq(struct journal *j) in journal_cur_seq() argument
138 return atomic64_read(&j->seq); in journal_cur_seq()
141 static inline u64 journal_last_unwritten_seq(struct journal *j) in journal_last_unwritten_seq() argument
143 return j->seq_ondisk + 1; in journal_last_unwritten_seq()
174 static inline int journal_entry_overhead(struct journal *j) in journal_entry_overhead() argument
176 return sizeof(struct jset) / sizeof(u64) + j->entry_u64s_reserved; in journal_entry_overhead()
194 journal_res_entry(struct journal *j, struct journal_res *res) in journal_res_entry() argument
196 return vstruct_idx(j->buf[res->idx].data, res->offset); in journal_res_entry()
224 bch2_journal_add_entry(struct journal *j, struct journal_res *res, in bch2_journal_add_entry() argument
228 struct jset_entry *entry = journal_res_entry(j, res); in bch2_journal_add_entry()
239 static inline bool journal_entry_empty(struct jset *j) in journal_entry_empty() argument
241 if (j->seq != j->last_seq) in journal_entry_empty()
244 vstruct_for_each(j, i) in journal_entry_empty()
253 static inline union journal_res_state journal_state_buf_put(struct journal *j, unsigned idx) in journal_state_buf_put() argument
262 }).v, &j->reservations.counter); in journal_state_buf_put()
269 static inline void __bch2_journal_buf_put(struct journal *j, unsigned idx, u64 seq) in __bch2_journal_buf_put() argument
273 s = journal_state_buf_put(j, idx); in __bch2_journal_buf_put()
275 bch2_journal_buf_put_final(j, seq, idx == s.unwritten_idx); in __bch2_journal_buf_put()
278 static inline void bch2_journal_buf_put(struct journal *j, unsigned idx, u64 seq) in bch2_journal_buf_put() argument
282 s = journal_state_buf_put(j, idx); in bch2_journal_buf_put()
284 spin_lock(&j->lock); in bch2_journal_buf_put()
285 bch2_journal_buf_put_final(j, seq, idx == s.unwritten_idx); in bch2_journal_buf_put()
286 spin_unlock(&j->lock); in bch2_journal_buf_put()
294 static inline void bch2_journal_res_put(struct journal *j, in bch2_journal_res_put() argument
300 lock_release(&j->res_map, _THIS_IP_); in bch2_journal_res_put()
303 bch2_journal_add_entry(j, res, in bch2_journal_res_put()
307 bch2_journal_buf_put(j, res->idx, res->seq); in bch2_journal_res_put()
324 static inline int journal_res_get_fast(struct journal *j, in journal_res_get_fast() argument
329 u64 v = atomic64_read(&j->reservations.counter); in journal_res_get_fast()
338 if (new.cur_entry_offset + res->u64s > j->cur_entry_u64s) in journal_res_get_fast()
343 if ((flags & BCH_WATERMARK_MASK) < j->watermark) in journal_res_get_fast()
358 } while ((v = atomic64_cmpxchg(&j->reservations.counter, in journal_res_get_fast()
364 res->seq = le64_to_cpu(j->buf[old.idx].data->seq); in journal_res_get_fast()
368 static inline int bch2_journal_res_get(struct journal *j, struct journal_res *res, in bch2_journal_res_get() argument
374 EBUG_ON(!test_bit(JOURNAL_STARTED, &j->flags)); in bch2_journal_res_get()
378 if (journal_res_get_fast(j, res, flags)) in bch2_journal_res_get()
381 ret = bch2_journal_res_get_slowpath(j, res, flags); in bch2_journal_res_get()
386 lock_acquire_shared(&j->res_map, 0, in bch2_journal_res_get()
410 static inline int bch2_journal_error(struct journal *j) in bch2_journal_error() argument
412 return j->reservations.cur_entry_offset == JOURNAL_ENTRY_ERROR_VAL in bch2_journal_error()
418 static inline void bch2_journal_set_replay_done(struct journal *j) in bch2_journal_set_replay_done() argument
420 BUG_ON(!test_bit(JOURNAL_STARTED, &j->flags)); in bch2_journal_set_replay_done()
421 set_bit(JOURNAL_REPLAY_DONE, &j->flags); in bch2_journal_set_replay_done()
426 struct journal_buf *bch2_next_write_buffer_flush_journal_buf(struct journal *j, u64 max_seq);