Lines Matching refs:trans
25 static inline struct btree_transaction_stats *btree_trans_stats(struct btree_trans *trans) in btree_trans_stats() argument
27 return trans->fn_idx < ARRAY_SIZE(trans->c->btree_transaction_stats) in btree_trans_stats()
28 ? &trans->c->btree_transaction_stats[trans->fn_idx] in btree_trans_stats()
85 static inline void mark_btree_node_locked(struct btree_trans *trans, in mark_btree_node_locked() argument
115 static void btree_trans_lock_hold_time_update(struct btree_trans *trans, in btree_trans_lock_hold_time_update() argument
119 __bch2_time_stats_update(&btree_trans_stats(trans)->lock_hold_times, in btree_trans_lock_hold_time_update()
127 static inline void btree_node_unlock(struct btree_trans *trans, in btree_node_unlock() argument
137 btree_trans_lock_hold_time_update(trans, path, level); in btree_node_unlock()
152 static inline void __bch2_btree_path_unlock(struct btree_trans *trans, in __bch2_btree_path_unlock() argument
158 btree_node_unlock(trans, path, btree_path_lowest_level_locked(path)); in __bch2_btree_path_unlock()
166 bch2_btree_node_unlock_write_inlined(struct btree_trans *trans, struct btree_path *path, in bch2_btree_node_unlock_write_inlined() argument
178 trans_for_each_path_with_node(trans, b, linked, i) in bch2_btree_node_unlock_write_inlined()
191 static inline void trans_set_locked(struct btree_trans *trans) in trans_set_locked() argument
193 if (!trans->locked) { in trans_set_locked()
194 lock_acquire_exclusive(&trans->dep_map, 0, 0, NULL, _THIS_IP_); in trans_set_locked()
195 trans->locked = true; in trans_set_locked()
196 trans->last_unlock_ip = 0; in trans_set_locked()
198 trans->pf_memalloc_nofs = (current->flags & PF_MEMALLOC_NOFS) != 0; in trans_set_locked()
203 static inline void trans_set_unlocked(struct btree_trans *trans) in trans_set_unlocked() argument
205 if (trans->locked) { in trans_set_unlocked()
206 lock_release(&trans->dep_map, _THIS_IP_); in trans_set_unlocked()
207 trans->locked = false; in trans_set_unlocked()
208 trans->last_unlock_ip = _RET_IP_; in trans_set_unlocked()
210 if (!trans->pf_memalloc_nofs) in trans_set_unlocked()
215 static inline int __btree_node_lock_nopath(struct btree_trans *trans, in __btree_node_lock_nopath() argument
221 trans->lock_may_not_fail = lock_may_not_fail; in __btree_node_lock_nopath()
222 trans->lock_must_abort = false; in __btree_node_lock_nopath()
223 trans->locking = b; in __btree_node_lock_nopath()
225 int ret = six_lock_ip_waiter(&b->lock, type, &trans->locking_wait, in __btree_node_lock_nopath()
226 bch2_six_check_for_deadlock, trans, ip); in __btree_node_lock_nopath()
227 WRITE_ONCE(trans->locking, NULL); in __btree_node_lock_nopath()
228 WRITE_ONCE(trans->locking_wait.start_time, 0); in __btree_node_lock_nopath()
231 trace_btree_path_lock(trans, _THIS_IP_, b); in __btree_node_lock_nopath()
236 btree_node_lock_nopath(struct btree_trans *trans, in btree_node_lock_nopath() argument
241 return __btree_node_lock_nopath(trans, b, type, false, ip); in btree_node_lock_nopath()
244 static inline void btree_node_lock_nopath_nofail(struct btree_trans *trans, in btree_node_lock_nopath_nofail() argument
248 int ret = __btree_node_lock_nopath(trans, b, type, true, _THIS_IP_); in btree_node_lock_nopath_nofail()
257 static inline bool btree_node_lock_increment(struct btree_trans *trans, in btree_node_lock_increment() argument
265 trans_for_each_path(trans, path, i) in btree_node_lock_increment()
275 static inline int btree_node_lock(struct btree_trans *trans, in btree_node_lock() argument
285 bch2_trans_verify_not_unlocked(trans); in btree_node_lock()
288 btree_node_lock_increment(trans, b, level, (enum btree_node_locked_type) type) || in btree_node_lock()
289 !(ret = btree_node_lock_nopath(trans, b, type, btree_path_ip_allocated(path)))) { in btree_node_lock()
301 static inline int __btree_node_lock_write(struct btree_trans *trans, in __btree_node_lock_write() argument
319 : __bch2_btree_node_lock_write(trans, path, b, lock_may_not_fail); in __btree_node_lock_write()
323 bch2_btree_node_lock_write(struct btree_trans *trans, in bch2_btree_node_lock_write() argument
327 return __btree_node_lock_write(trans, path, b, false); in bch2_btree_node_lock_write()
340 static inline int bch2_btree_path_relock(struct btree_trans *trans, in bch2_btree_path_relock() argument
345 : __bch2_btree_path_relock(trans, path, trace_ip); in bch2_btree_path_relock()
350 static inline bool bch2_btree_node_relock(struct btree_trans *trans, in bch2_btree_node_relock() argument
359 __bch2_btree_node_relock(trans, path, level, true)); in bch2_btree_node_relock()
362 static inline bool bch2_btree_node_relock_notrace(struct btree_trans *trans, in bch2_btree_node_relock_notrace() argument
371 __bch2_btree_node_relock(trans, path, level, false)); in bch2_btree_node_relock_notrace()
384 static inline int bch2_btree_path_upgrade(struct btree_trans *trans, in bch2_btree_path_upgrade() argument
394 ? __bch2_btree_path_upgrade(trans, path, new_locks_want, &f) in bch2_btree_path_upgrade()
398 trace_and_count(trans->c, trans_restart_upgrade, trans, _THIS_IP_, path, in bch2_btree_path_upgrade()
400 return btree_trans_restart(trans, BCH_ERR_transaction_restart_upgrade); in bch2_btree_path_upgrade()
405 static inline void btree_path_set_should_be_locked(struct btree_trans *trans, struct btree_path *pa… in btree_path_set_should_be_locked() argument
411 trace_btree_path_should_be_locked(trans, path); in btree_path_set_should_be_locked()
414 static inline void __btree_path_set_level_up(struct btree_trans *trans, in __btree_path_set_level_up() argument
418 btree_node_unlock(trans, path, l); in __btree_path_set_level_up()
422 static inline void btree_path_set_level_up(struct btree_trans *trans, in btree_path_set_level_up() argument
425 __btree_path_set_level_up(trans, path, path->level++); in btree_path_set_level_up()
443 static inline void bch2_trans_verify_locks(struct btree_trans *trans) {} in bch2_trans_verify_locks() argument