mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-12 21:41:07 +00:00
The move to dlmglue necessitating removing the old lru code. That's fine, it didn't work anyway. We can't drop locks in the shrinker directly, so instead we have the shrinker put them on a workqueue where they are dropped. The rules for the LRU are simple. Locks get a users count. Any process that holds the lock or is in the process of acquiring the lock increments this count. When unlock is called, the count is decremented. We can use the value of this count to manage the LRU - scoutfs_unlock puts locks on the LRU when the count reaches zero, lock_name_keys() always takes them off. If the lock is selected for reclaim, callers wanting to use the lock will need to wait. We acheive this with a pair of flags. SCOUTFS_LOCK_RECLAIM is used to indicate the the lock is now queued for reclaim. Once the is ready to be destroyed, we set SCOUTFS_LOCK_DROPPED flag, telling callers to put the lock and retry their rbtree search. Signed-off-by: Mark Fasheh <mfasheh@versity.com>