Commit d0f8f3f9 authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

[PATCH] Fix posix file locking (6/9)

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: default avatarTrond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ab77ca16
......@@ -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 *rqstp, struct nlm_file *file,
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_lock *fl1, struct file_lock *fl2)
struct lock_manager_operations nlmsvc_lock_operations = {
.fl_compare_owner = nlmsvc_same_owner,
.fl_notify = nlmsvc_notify_blocked,
};
/*
......
......@@ -190,9 +190,6 @@ void locks_init_lock(struct file_lock *fl)
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 *new, struct file_lock *fl)
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 file *filp, struct file_lock *fl,
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 file *filp, struct file_lock *fl,
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, int type, struct file_lock **flp)
}
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 file_lock *blocker)
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 file_lock **pos, struct file_lock *fl)
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 file_lock **thisfl_p)
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);
......
......@@ -623,12 +623,15 @@ extern spinlock_t files_lock;
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 */
......@@ -647,10 +650,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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment