Lines Matching refs:lh
454 static void lh_init(struct lock_history *lh, struct dm_buffer_cache *cache, bool write) in lh_init() argument
456 lh->cache = cache; in lh_init()
457 lh->write = write; in lh_init()
458 lh->no_previous = cache->num_locks; in lh_init()
459 lh->previous = lh->no_previous; in lh_init()
462 static void __lh_lock(struct lock_history *lh, unsigned int index) in __lh_lock() argument
464 if (lh->write) { in __lh_lock()
465 if (static_branch_unlikely(&no_sleep_enabled) && lh->cache->no_sleep) in __lh_lock()
466 write_lock_bh(&lh->cache->trees[index].u.spinlock); in __lh_lock()
468 down_write(&lh->cache->trees[index].u.lock); in __lh_lock()
470 if (static_branch_unlikely(&no_sleep_enabled) && lh->cache->no_sleep) in __lh_lock()
471 read_lock_bh(&lh->cache->trees[index].u.spinlock); in __lh_lock()
473 down_read(&lh->cache->trees[index].u.lock); in __lh_lock()
477 static void __lh_unlock(struct lock_history *lh, unsigned int index) in __lh_unlock() argument
479 if (lh->write) { in __lh_unlock()
480 if (static_branch_unlikely(&no_sleep_enabled) && lh->cache->no_sleep) in __lh_unlock()
481 write_unlock_bh(&lh->cache->trees[index].u.spinlock); in __lh_unlock()
483 up_write(&lh->cache->trees[index].u.lock); in __lh_unlock()
485 if (static_branch_unlikely(&no_sleep_enabled) && lh->cache->no_sleep) in __lh_unlock()
486 read_unlock_bh(&lh->cache->trees[index].u.spinlock); in __lh_unlock()
488 up_read(&lh->cache->trees[index].u.lock); in __lh_unlock()
495 static void lh_exit(struct lock_history *lh) in lh_exit() argument
497 if (lh->previous != lh->no_previous) { in lh_exit()
498 __lh_unlock(lh, lh->previous); in lh_exit()
499 lh->previous = lh->no_previous; in lh_exit()
507 static void lh_next(struct lock_history *lh, sector_t b) in lh_next() argument
509 unsigned int index = cache_index(b, lh->no_previous); /* no_previous is num_locks */ in lh_next()
511 if (lh->previous != lh->no_previous) { in lh_next()
512 if (lh->previous != index) { in lh_next()
513 __lh_unlock(lh, lh->previous); in lh_next()
514 __lh_lock(lh, index); in lh_next()
515 lh->previous = index; in lh_next()
518 __lh_lock(lh, index); in lh_next()
519 lh->previous = index; in lh_next()
658 struct lock_history *lh; member
672 lh_next(w->lh, b->block); in __evict_pred()
682 struct lock_history *lh) in __cache_evict() argument
684 struct evict_wrapper w = {.lh = lh, .pred = pred, .context = context}; in __cache_evict()
703 struct lock_history lh; in cache_evict() local
705 lh_init(&lh, bc, true); in cache_evict()
706 b = __cache_evict(bc, list_mode, pred, context, &lh); in cache_evict()
707 lh_exit(&lh); in cache_evict()
735 b_predicate pred, void *context, struct lock_history *lh) in __cache_mark_many() argument
739 struct evict_wrapper w = {.lh = lh, .pred = pred, .context = context}; in __cache_mark_many()
755 struct lock_history lh; in cache_mark_many() local
757 lh_init(&lh, bc, true); in cache_mark_many()
758 __cache_mark_many(bc, old_mode, new_mode, pred, context, &lh); in cache_mark_many()
759 lh_exit(&lh); in cache_mark_many()
781 iter_fn fn, void *context, struct lock_history *lh)
793 lh_next(lh, b->block);
811 struct lock_history lh; in cache_iterate() local
813 lh_init(&lh, bc, false); in cache_iterate()
814 __cache_iterate(bc, list_mode, fn, context, &lh); in cache_iterate()
815 lh_exit(&lh); in cache_iterate()