]> git.hungrycats.org Git - linux/commitdiff
[PATCH] nfs4 lease: aeparate the lease initialization code
authorWilliam A. Adamson <andros@thnk.citi.umich.edu>
Wed, 20 Oct 2004 01:44:07 +0000 (18:44 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 20 Oct 2004 01:44:07 +0000 (18:44 -0700)
Separate the lease initialization code from lease_alloc().  set the default
lock manager ops.

Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/locks.c

index 70a3df0d930d9ba5706a75c11a75a06cc7256eb8..e05dffc2df7c440d69a9ed7136f24779b32c8e61 100644 (file)
@@ -401,13 +401,11 @@ struct lock_manager_operations lease_manager_ops = {
        .fl_break = lease_break_callback,
 };
 
-/* Allocate a file_lock initialised to this type of lease */
-static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
-{
-       struct file_lock *fl = locks_alloc_lock();
-       if (fl == NULL)
-               return -ENOMEM;
-
+/*
+ * Initialize a lease, use the default lock manager operations
+ */
+static int lease_init(struct file *filp, int type, struct file_lock *fl)
+ {
        fl->fl_owner = current->files;
        fl->fl_pid = current->tgid;
 
@@ -420,8 +418,22 @@ static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
        fl->fl_start = 0;
        fl->fl_end = OFFSET_MAX;
        fl->fl_ops = NULL;
-       fl->fl_lmops = NULL;
+       fl->fl_lmops = &lease_manager_ops;
+       return 0;
+}
 
+/* Allocate a file_lock initialised to this type of lease */
+static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
+{
+       struct file_lock *fl = locks_alloc_lock();
+       int error;
+
+       if (fl == NULL)
+               return -ENOMEM;
+
+       error = lease_init(filp, type, fl);
+       if (error)
+               return error;
        *flp = fl;
        return 0;
 }