aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/clntproc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-03-20 13:44:40 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:40 -0500
commit26bcbf965f857c710adafd16cf424f043006b5dd (patch)
treefa3c1e4ba07ab3d1e4e61b27c7579c57fd2d5c65 /fs/lockd/clntproc.c
parent04266473ecf5cdca242201d9f1ed890afe070fb6 (diff)
lockd: stop abusing file_lock_list
Currently lockd directly access the file_lock_list from fs/locks.c. It does so to mark locks granted or reclaimable. This is very suboptimal, because a) lockd needs to poke into locks.c internals, and b) it needs to iterate over all locks in the system for marking locks granted or reclaimable. This patch adds lists for granted and reclaimable locks to the nlm_host structure instead, and adds locks to those. nlmclnt_lock: now adds the lock to h_granted instead of setting the NFS_LCK_GRANTED, still O(1) nlmclnt_mark_reclaim: goes away completely, replaced by a list_splice_init. Complexity reduced from O(locks in the system) to O(1) reclaimer: iterates over h_reclaim now, complexity reduced from O(locks in the system) to O(locks per nlm_host) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r--fs/lockd/clntproc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 80ae3127699f..cb469431bd1d 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -465,7 +465,6 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
465{ 465{
466 BUG_ON(fl->fl_ops != NULL); 466 BUG_ON(fl->fl_ops != NULL);
467 fl->fl_u.nfs_fl.state = 0; 467 fl->fl_u.nfs_fl.state = 0;
468 fl->fl_u.nfs_fl.flags = 0;
469 fl->fl_u.nfs_fl.owner = nlm_find_lockowner(host, fl->fl_owner); 468 fl->fl_u.nfs_fl.owner = nlm_find_lockowner(host, fl->fl_owner);
470 fl->fl_ops = &nlmclnt_lock_ops; 469 fl->fl_ops = &nlmclnt_lock_ops;
471} 470}
@@ -552,8 +551,8 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
552 551
553 if (resp->status == NLM_LCK_GRANTED) { 552 if (resp->status == NLM_LCK_GRANTED) {
554 fl->fl_u.nfs_fl.state = host->h_state; 553 fl->fl_u.nfs_fl.state = host->h_state;
555 fl->fl_u.nfs_fl.flags |= NFS_LCK_GRANTED;
556 fl->fl_flags |= FL_SLEEP; 554 fl->fl_flags |= FL_SLEEP;
555 list_add_tail(&fl->fl_u.nfs_fl.list, &host->h_granted);
557 do_vfs_lock(fl); 556 do_vfs_lock(fl);
558 } 557 }
559 status = nlm_stat_to_errno(resp->status); 558 status = nlm_stat_to_errno(resp->status);
@@ -619,9 +618,11 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
619 struct nlm_res *resp = &req->a_res; 618 struct nlm_res *resp = &req->a_res;
620 int status; 619 int status;
621 620
622 /* Clean the GRANTED flag now so the lock doesn't get 621 /*
623 * reclaimed while we're stuck in the unlock call. */ 622 * Remove from the granted list now so the lock doesn't get
624 fl->fl_u.nfs_fl.flags &= ~NFS_LCK_GRANTED; 623 * reclaimed while we're stuck in the unlock call.
624 */
625 list_del(&fl->fl_u.nfs_fl.list);
625 626
626 /* 627 /*
627 * Note: the server is supposed to either grant us the unlock 628 * Note: the server is supposed to either grant us the unlock