Lines Matching refs:lh

435 static void lh_init(struct lock_history *lh, struct dm_buffer_cache *cache, bool write)  in lh_init()  argument
437 lh->cache = cache; in lh_init()
438 lh->write = write; in lh_init()
439 lh->no_previous = cache->num_locks; in lh_init()
440 lh->previous = lh->no_previous; in lh_init()
443 static void __lh_lock(struct lock_history *lh, unsigned int index) in __lh_lock() argument
445 if (lh->write) in __lh_lock()
446 down_write(&lh->cache->trees[index].lock); in __lh_lock()
448 down_read(&lh->cache->trees[index].lock); in __lh_lock()
451 static void __lh_unlock(struct lock_history *lh, unsigned int index) in __lh_unlock() argument
453 if (lh->write) in __lh_unlock()
454 up_write(&lh->cache->trees[index].lock); in __lh_unlock()
456 up_read(&lh->cache->trees[index].lock); in __lh_unlock()
462 static void lh_exit(struct lock_history *lh) in lh_exit() argument
464 if (lh->previous != lh->no_previous) { in lh_exit()
465 __lh_unlock(lh, lh->previous); in lh_exit()
466 lh->previous = lh->no_previous; in lh_exit()
474 static void lh_next(struct lock_history *lh, sector_t b) in lh_next() argument
476 unsigned int index = cache_index(b, lh->no_previous); /* no_previous is num_locks */ in lh_next()
478 if (lh->previous != lh->no_previous) { in lh_next()
479 if (lh->previous != index) { in lh_next()
480 __lh_unlock(lh, lh->previous); in lh_next()
481 __lh_lock(lh, index); in lh_next()
482 lh->previous = index; in lh_next()
485 __lh_lock(lh, index); in lh_next()
486 lh->previous = index; in lh_next()
621 struct lock_history *lh; member
635 lh_next(w->lh, b->block); in __evict_pred()
645 struct lock_history *lh) in __cache_evict() argument
647 struct evict_wrapper w = {.lh = lh, .pred = pred, .context = context}; in __cache_evict()
666 struct lock_history lh; in cache_evict() local
668 lh_init(&lh, bc, true); in cache_evict()
669 b = __cache_evict(bc, list_mode, pred, context, &lh); in cache_evict()
670 lh_exit(&lh); in cache_evict()
698 b_predicate pred, void *context, struct lock_history *lh) in __cache_mark_many() argument
702 struct evict_wrapper w = {.lh = lh, .pred = pred, .context = context}; in __cache_mark_many()
718 struct lock_history lh; in cache_mark_many() local
720 lh_init(&lh, bc, true); in cache_mark_many()
721 __cache_mark_many(bc, old_mode, new_mode, pred, context, &lh); in cache_mark_many()
722 lh_exit(&lh); in cache_mark_many()
744 iter_fn fn, void *context, struct lock_history *lh)
756 lh_next(lh, b->block);
774 struct lock_history lh; in cache_iterate() local
776 lh_init(&lh, bc, false); in cache_iterate()
777 __cache_iterate(bc, list_mode, fn, context, &lh); in cache_iterate()
778 lh_exit(&lh); in cache_iterate()