From: Trond Myklebust <trond.myklebust@fys.uio.no>

VFS: get rid of the fl_notify, fl_insert, fl_remove fields from struct
     file_lock.  They belong in the new lock_manager_operations structure.

Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/lockd/svclock.c |    3 +--
 25-akpm/fs/locks.c         |   27 ++++++---------------------
 25-akpm/include/linux/fs.h |    7 +++----
 3 files changed, 10 insertions(+), 27 deletions(-)

diff -puN fs/lockd/svclock.c~posix-locking-move-file-lock-fields fs/lockd/svclock.c
--- 25/fs/lockd/svclock.c~posix-locking-move-file-lock-fields	2004-08-15 17:10:45.505835080 -0700
+++ 25-akpm/fs/lockd/svclock.c	2004-08-15 17:10:45.512834016 -0700
@@ -42,7 +42,6 @@
 static void	nlmsvc_insert_block(struct nlm_block *block, unsigned long);
 static int	nlmsvc_remove_block(struct nlm_block *block);
 static void	nlmsvc_grant_callback(struct rpc_task *task);
-static void	nlmsvc_notify_blocked(struct file_lock *);
 
 /*
  * The list of blocked locks to retry
@@ -193,7 +192,6 @@ nlmsvc_create_block(struct svc_rqst *rqs
 		goto failed_free;
 
 	/* Set notifier function for VFS, and init args */
-	block->b_call.a_args.lock.fl.fl_notify = nlmsvc_notify_blocked;
 	block->b_call.a_args.lock.fl.fl_lmops = &nlmsvc_lock_operations;
 	block->b_call.a_args.cookie = *cookie;	/* see above */
 
@@ -487,6 +485,7 @@ static int nlmsvc_same_owner(struct file
 
 struct lock_manager_operations nlmsvc_lock_operations = {
 	.fl_compare_owner = nlmsvc_same_owner,
+	.fl_notify = nlmsvc_notify_blocked,
 };
 
 /*
diff -puN fs/locks.c~posix-locking-move-file-lock-fields fs/locks.c
--- 25/fs/locks.c~posix-locking-move-file-lock-fields	2004-08-15 17:10:45.506834928 -0700
+++ 25-akpm/fs/locks.c	2004-08-15 17:10:45.514833712 -0700
@@ -190,9 +190,6 @@ void locks_init_lock(struct file_lock *f
 	fl->fl_flags = 0;
 	fl->fl_type = 0;
 	fl->fl_start = fl->fl_end = 0;
-	fl->fl_notify = NULL;
-	fl->fl_insert = NULL;
-	fl->fl_remove = NULL;
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 }
@@ -226,9 +223,6 @@ void locks_copy_lock(struct file_lock *n
 	new->fl_type = fl->fl_type;
 	new->fl_start = fl->fl_start;
 	new->fl_end = fl->fl_end;
-	new->fl_notify = fl->fl_notify;
-	new->fl_insert = fl->fl_insert;
-	new->fl_remove = fl->fl_remove;
 	new->fl_ops = fl->fl_ops;
 	new->fl_lmops = fl->fl_lmops;
 	if (fl->fl_ops && fl->fl_ops->fl_copy_lock)
@@ -333,9 +327,6 @@ static int flock_to_posix_lock(struct fi
 	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
 	fl->fl_flags = FL_POSIX;
-	fl->fl_notify = NULL;
-	fl->fl_insert = NULL;
-	fl->fl_remove = NULL;
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 
@@ -375,9 +366,6 @@ static int flock64_to_posix_lock(struct 
 	fl->fl_pid = current->tgid;
 	fl->fl_file = filp;
 	fl->fl_flags = FL_POSIX;
-	fl->fl_notify = NULL;
-	fl->fl_insert = NULL;
-	fl->fl_remove = NULL;
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 
@@ -413,9 +401,6 @@ static int lease_alloc(struct file *filp
 	}
 	fl->fl_start = 0;
 	fl->fl_end = OFFSET_MAX;
-	fl->fl_notify = NULL;
-	fl->fl_insert = NULL;
-	fl->fl_remove = NULL;
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 
@@ -491,8 +476,8 @@ static void locks_wake_up_blocks(struct 
 		struct file_lock *waiter = list_entry(blocker->fl_block.next,
 				struct file_lock, fl_block);
 		__locks_delete_block(waiter);
-		if (waiter->fl_notify)
-			waiter->fl_notify(waiter);
+		if (waiter->fl_lmops && waiter->fl_lmops->fl_notify)
+			waiter->fl_lmops->fl_notify(waiter);
 		else
 			wake_up(&waiter->fl_wait);
 	}
@@ -509,8 +494,8 @@ static void locks_insert_lock(struct fil
 	fl->fl_next = *pos;
 	*pos = fl;
 
-	if (fl->fl_insert)
-		fl->fl_insert(fl);
+	if (fl->fl_ops && fl->fl_ops->fl_insert)
+		fl->fl_ops->fl_insert(fl);
 }
 
 /*
@@ -533,8 +518,8 @@ static void locks_delete_lock(struct fil
 		fl->fl_fasync = NULL;
 	}
 
-	if (fl->fl_remove)
-		fl->fl_remove(fl);
+	if (fl->fl_ops && fl->fl_ops->fl_remove)
+		fl->fl_ops->fl_remove(fl);
 
 	locks_wake_up_blocks(fl);
 	locks_free_lock(fl);
diff -puN include/linux/fs.h~posix-locking-move-file-lock-fields include/linux/fs.h
--- 25/include/linux/fs.h~posix-locking-move-file-lock-fields	2004-08-15 17:10:45.508834624 -0700
+++ 25-akpm/include/linux/fs.h	2004-08-15 17:10:45.516833408 -0700
@@ -629,12 +629,15 @@ extern void close_private_file(struct fi
 typedef struct files_struct *fl_owner_t;
 
 struct file_lock_operations {
+	void (*fl_insert)(struct file_lock *);	/* lock insertion callback */
+	void (*fl_remove)(struct file_lock *);	/* lock removal callback */
 	void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
 	void (*fl_release_private)(struct file_lock *);
 };
 
 struct lock_manager_operations {
 	int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
+	void (*fl_notify)(struct file_lock *);	/* unblock callback */
 };
 
 /* that will die - we need it for nfs_lock_info */
@@ -653,10 +656,6 @@ struct file_lock {
 	loff_t fl_start;
 	loff_t fl_end;
 
-	void (*fl_notify)(struct file_lock *);	/* unblock callback */
-	void (*fl_insert)(struct file_lock *);	/* lock insertion callback */
-	void (*fl_remove)(struct file_lock *);	/* lock removal callback */
-
 	struct fasync_struct *	fl_fasync; /* for lease break notifications */
 	unsigned long fl_break_time;	/* for nonblocking lease breaks */
 
_