Commit 7448cc37 authored by Jeff Layton's avatar Jeff Layton Committed by Jeff Layton

locks: clean up the lm_change prototype

Now that we use standard list_heads for tracking leases, we can have
lm_change take a pointer to the lease to be modified instead of a
double pointer.
Signed-off-by: default avatarJeff Layton <jlayton@primarydata.com>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
parent 6109c850
...@@ -1309,9 +1309,8 @@ static void lease_clear_pending(struct file_lock *fl, int arg) ...@@ -1309,9 +1309,8 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
} }
/* We already had a lease on this file; just change its type */ /* We already had a lease on this file; just change its type */
int lease_modify(struct file_lock **before, int arg, struct list_head *dispose) int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose)
{ {
struct file_lock *fl = *before;
int error = assign_type(fl, arg); int error = assign_type(fl, arg);
if (error) if (error)
...@@ -1352,9 +1351,9 @@ static void time_out_leases(struct inode *inode, struct list_head *dispose) ...@@ -1352,9 +1351,9 @@ static void time_out_leases(struct inode *inode, struct list_head *dispose)
list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) { list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) {
trace_time_out_leases(inode, fl); trace_time_out_leases(inode, fl);
if (past_time(fl->fl_downgrade_time)) if (past_time(fl->fl_downgrade_time))
lease_modify(&fl, F_RDLCK, dispose); lease_modify(fl, F_RDLCK, dispose);
if (past_time(fl->fl_break_time)) if (past_time(fl->fl_break_time))
lease_modify(&fl, F_UNLCK, dispose); lease_modify(fl, F_UNLCK, dispose);
} }
} }
...@@ -1669,7 +1668,7 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr ...@@ -1669,7 +1668,7 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr
} }
if (my_fl != NULL) { if (my_fl != NULL) {
error = lease->fl_lmops->lm_change(&my_fl, arg, &dispose); error = lease->fl_lmops->lm_change(my_fl, arg, &dispose);
if (error) if (error)
goto out; goto out;
goto out_setup; goto out_setup;
...@@ -1732,7 +1731,7 @@ static int generic_delete_lease(struct file *filp) ...@@ -1732,7 +1731,7 @@ static int generic_delete_lease(struct file *filp)
} }
trace_generic_delete_lease(inode, fl); trace_generic_delete_lease(inode, fl);
if (victim) if (victim)
error = fl->fl_lmops->lm_change(&victim, F_UNLCK, &dispose); error = fl->fl_lmops->lm_change(victim, F_UNLCK, &dispose);
spin_unlock(&ctx->flc_lock); spin_unlock(&ctx->flc_lock);
locks_dispose_list(&dispose); locks_dispose_list(&dispose);
return error; return error;
...@@ -2426,7 +2425,7 @@ locks_remove_lease(struct file *filp) ...@@ -2426,7 +2425,7 @@ locks_remove_lease(struct file *filp)
spin_lock(&ctx->flc_lock); spin_lock(&ctx->flc_lock);
list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list)
lease_modify(&fl, F_UNLCK, &dispose); lease_modify(fl, F_UNLCK, &dispose);
spin_unlock(&ctx->flc_lock); spin_unlock(&ctx->flc_lock);
locks_dispose_list(&dispose); locks_dispose_list(&dispose);
} }
......
...@@ -3477,7 +3477,8 @@ nfsd_break_deleg_cb(struct file_lock *fl) ...@@ -3477,7 +3477,8 @@ nfsd_break_deleg_cb(struct file_lock *fl)
} }
static int static int
nfsd_change_deleg_cb(struct file_lock **onlist, int arg, struct list_head *dispose) nfsd_change_deleg_cb(struct file_lock *onlist, int arg,
struct list_head *dispose)
{ {
if (arg & F_UNLCK) if (arg & F_UNLCK)
return lease_modify(onlist, arg, dispose); return lease_modify(onlist, arg, dispose);
......
...@@ -900,7 +900,7 @@ struct lock_manager_operations { ...@@ -900,7 +900,7 @@ struct lock_manager_operations {
void (*lm_notify)(struct file_lock *); /* unblock callback */ void (*lm_notify)(struct file_lock *); /* unblock callback */
int (*lm_grant)(struct file_lock *, int); int (*lm_grant)(struct file_lock *, int);
bool (*lm_break)(struct file_lock *); bool (*lm_break)(struct file_lock *);
int (*lm_change)(struct file_lock **, int, struct list_head *); int (*lm_change)(struct file_lock *, int, struct list_head *);
void (*lm_setup)(struct file_lock *, void **); void (*lm_setup)(struct file_lock *, void **);
}; };
...@@ -1021,7 +1021,7 @@ extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int t ...@@ -1021,7 +1021,7 @@ extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int t
extern void lease_get_mtime(struct inode *, struct timespec *time); extern void lease_get_mtime(struct inode *, struct timespec *time);
extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
extern int vfs_setlease(struct file *, long, struct file_lock **, void **); extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
extern int lease_modify(struct file_lock **, int, struct list_head *); extern int lease_modify(struct file_lock *, int, struct list_head *);
#else /* !CONFIG_FILE_LOCKING */ #else /* !CONFIG_FILE_LOCKING */
static inline int fcntl_getlk(struct file *file, unsigned int cmd, static inline int fcntl_getlk(struct file *file, unsigned int cmd,
struct flock __user *user) struct flock __user *user)
...@@ -1153,7 +1153,7 @@ static inline int vfs_setlease(struct file *filp, long arg, ...@@ -1153,7 +1153,7 @@ static inline int vfs_setlease(struct file *filp, long arg,
return -EINVAL; return -EINVAL;
} }
static inline int lease_modify(struct file_lock **before, int arg, static inline int lease_modify(struct file_lock *fl, int arg,
struct list_head *dispose) struct list_head *dispose)
{ {
return -EINVAL; return -EINVAL;
......
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