remove use global lock list from lockd
PATCH 1/1 remove use global lock list from lockd
Hello All
What anyone think about this patch?
this patch remove play with global lock list and use interlnal list nlm_blocked.
Signature · 1 line
Alex
Index: clntlock.c
===================================================================
RCS file: /home/cvs/kernel_26/fs/lockd/clntlock.c,v retrieving revision 1.1.1.1
clntlock.c +8 -20
@@ -137,24 +137,17 @@/* * Mark the locks for reclaiming. -* FIXME: In 2.5 we don't want to iterate through any global file_lock_list. -* Maintain NLM lock reclaiming lists in the nlm_host instead. */ static void nlmclnt_mark_reclaim (struct nlm_host *host) { +struct nlm_wait *head;struct file_lock *fl; -struct inode *inode; -struct list_head *tmp; -list_for_each (tmp, &file_lock_list) { - fl = list_entry(tmp, struct file_lock, fl_link); - - inode = fl->fl_file->f_dentry->d_inode; -if (inode->i_sb->s_magic !=NFS_SUPER_MAGIC ) -continue ; -if (fl->fl_u.nfs_fl.owner->host != host) +for (head = nlm_blocked; head; head = head->b_next) { +if (head->b_host != host)continue ; + fl = head->b_lock;if (!(fl->fl_u.nfs_fl.flags &NFS_LCK_GRANTED ))continue ; fl->fl_u.nfs_fl.flags |=NFS_LCK_RECLAIM ;
@@ -202,9 +195,8 @@ {struct nlm_host *host = (struct nlm_host *) ptr;struct nlm_wait *block; -struct list_head *tmp;struct file_lock *fl; -struct inode *inode; +struct nlm_wait *head;daemonize ("%s-reclaim" , host->h_name);allow_signal (SIGKILL );
@@ -216,14 +208,10 @@/* First, reclaim all locks that have been marked. */ restart: -list_for_each (tmp, &file_lock_list) { - fl = list_entry(tmp, struct file_lock, fl_link); - - inode = fl->fl_file->f_dentry->d_inode; -if (inode->i_sb->s_magic !=NFS_SUPER_MAGIC ) -continue ; -if (fl->fl_u.nfs_fl.owner->host != host) +for (head = nlm_blocked; head; head = head->b_next) { +if (head->b_host != host)continue ; + fl = head->b_lock;if (!(fl->fl_u.nfs_fl.flags &NFS_LCK_RECLAIM ))continue ;
Quoted 5 lines · Alex Lyashkov
Hello All
What anyone think about this patch?
this patch remove play with global lock list and use interlnal listnlm_blocked.
This patch looks cool to me, but doesn't seem to apply to current kernels where nlm_blocked is a list_head. (urgg, we also seem to have another local variable called nlm_blocked in svclock.c that's a nlm_block * ...)
Could you redo the patch for a current kernel?
Index: clntlock.c
===================================================================
RCS file: /home/cvs/kernel_26/fs/lockd/clntlock.c,v retrieving revision 1.1.1.1
clntlock.c +8 -20
@@ -137,24 +137,17 @@/* * Mark the locks for reclaiming. -* FIXME: In 2.5 we don't want to iterate through any global file_lock_list. -* Maintain NLM lock reclaiming lists in the nlm_host instead. */ static void nlmclnt_mark_reclaim (struct nlm_host *host) { +struct nlm_wait *head;struct file_lock *fl; -struct inode *inode; -struct list_head *tmp; -list_for_each (tmp, &file_lock_list) { - fl = list_entry(tmp, struct file_lock, fl_link); - - inode = fl->fl_file->f_dentry->d_inode; -if (inode->i_sb->s_magic !=NFS_SUPER_MAGIC ) -continue ; -if (fl->fl_u.nfs_fl.owner->host != host) +for (head = nlm_blocked; head; head = head->b_next) { +if (head->b_host != host)continue ; + fl = head->b_lock;if (!(fl->fl_u.nfs_fl.flags &NFS_LCK_GRANTED ))continue ; fl->fl_u.nfs_fl.flags |=NFS_LCK_RECLAIM ;
@@ -202,9 +195,8 @@ {struct nlm_host *host = (struct nlm_host *) ptr;struct nlm_wait *block; -struct list_head *tmp;struct file_lock *fl; -struct inode *inode; +struct nlm_wait *head;daemonize ("%s-reclaim" , host->h_name);allow_signal (SIGKILL );
@@ -216,14 +208,10 @@/* First, reclaim all locks that have been marked. */ restart: -list_for_each (tmp, &file_lock_list) { - fl = list_entry(tmp, struct file_lock, fl_link); - - inode = fl->fl_file->f_dentry->d_inode; -if (inode->i_sb->s_magic !=NFS_SUPER_MAGIC ) -continue ; -if (fl->fl_u.nfs_fl.owner->host != host) +for (head = nlm_blocked; head; head = head->b_next) { +if (head->b_host != host)continue ; + fl = head->b_lock;if (!(fl->fl_u.nfs_fl.flags &NFS_LCK_RECLAIM ))continue ;