Lines Matching refs:lh

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