* This is the representation of a blocked client lock.
*/
struct nlm_wait {
- struct nlm_wait * b_next; /* linked list */
+ struct list_head b_list; /* linked list */
wait_queue_head_t b_wait; /* where to wait on */
struct nlm_host * b_host;
struct file_lock * b_lock; /* local file lock */
u32 b_status; /* grant callback status */
};
-static struct nlm_wait * nlm_blocked;
+static LIST_HEAD(nlm_blocked);
/*
* Block on a lock
block.b_lock = fl;
init_waitqueue_head(&block.b_wait);
block.b_status = NLM_LCK_BLOCKED;
- block.b_next = nlm_blocked;
- nlm_blocked = █
+ list_add(&block.b_list, &nlm_blocked);
/* Remember pseudo nsm state */
pstate = host->h_state;
*/
sleep_on_timeout(&block.b_wait, 30*HZ);
- for (head = &nlm_blocked; *head; head = &(*head)->b_next) {
- if (*head == &block) {
- *head = block.b_next;
- break;
- }
- }
+ list_del(&block.b_list);
if (!signalled()) {
*statp = block.b_status;
* Look up blocked request based on arguments.
* Warning: must not use cookie to match it!
*/
- for (block = nlm_blocked; block; block = block->b_next) {
+ list_for_each_entry(block, &nlm_blocked, b_list) {
if (nlm_compare_locks(block->b_lock, &lock->fl))
break;
}
host->h_reclaiming = 0;
/* Now, wake up all processes that sleep on a blocked lock */
- for (block = nlm_blocked; block; block = block->b_next) {
+ list_for_each_entry(block, &nlm_blocked, b_list) {
if (block->b_host == host) {
block->b_status = NLM_LCK_DENIED_GRACE_PERIOD;
wake_up(&block->b_wait);