mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
GFS2: Use lockref for glocks
Currently glocks have an atomic reference count and also a spinlock which covers various internal fields, such as the state. This intent of this patch is to replace the spinlock and the atomic reference count with a lockref structure. This contains a spinlock which we can continue to use as before, and a reference counter which is used in conjuction with the spinlock to replace the previous atomic counter. As a result of this there are some new rules for reference counting on glocks. We need to distinguish between reference count changes under gl_spin (which are now just increment or decrement of the new counter, provided the count cannot hit zero) and those which are outside of gl_spin, but which now take gl_spin internally. The conversion is relatively straight forward. There is probably some further clean up which can be done, but the priority at this stage is to make the change in as simple a manner as possible. A consequence of this change is that the reference count is being decoupled from the lru list processing. This should allow future adoption of the lru_list code with glocks in due course. The reason for using the "dead" state and not just relying on 0 being the "invalid state" is so that in due course 0 ref counts can be allowable. The intent is to eventually be able to remove the ref count changes which are currently hidden away in state_change(). Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
e46c772dba
commit
e66cf16109
6 changed files with 52 additions and 49 deletions
|
@ -36,4 +36,10 @@ extern int lockref_put_or_lock(struct lockref *);
|
|||
extern void lockref_mark_dead(struct lockref *);
|
||||
extern int lockref_get_not_dead(struct lockref *);
|
||||
|
||||
/* Must be called under spinlock for reliable results */
|
||||
static inline int __lockref_is_dead(const struct lockref *l)
|
||||
{
|
||||
return ((int)l->count < 0);
|
||||
}
|
||||
|
||||
#endif /* __LINUX_LOCKREF_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue