Dear Professor Zhao,
This is Ming Chen, a PhD student at Stony Brook University. I am developing a device mapper target as part of a course project. I have learnt a lot from dm-cache. Thank you for your wonderful work on dm-cache.
I have two questions about locking design of dm-cache.
In cache_lookup, there is no locking when cache state is examined. For example, line 910 does not hold a lock. However, in cache_hit, the lock is held for the same operation (line 1014). I am sorry that I am a little confused. Can you enlighten me of the design concern of this?
Moreover, for _job_lock, the irqsave/restore version of spinlock is used, whereas for cache[cache_block].lock, the simplest version is used. I know we can use simple spin_lock and spin_unlock when the critical section will not be called by an interrupt handle. However, I cannot see this here.
The version I am referring to is 3.0, and please kindly let me know if I have any misunderstanding. Thank you very much!
Best,
Ming