Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: remove locks_inode

locks_inode was turned into a wrapper around file_inode in de2a4a501e71
(Partially revert "locks: fix file locking on overlayfs"). Finish
replacing locks_inode invocations everywhere with file_inode.

Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>

+29 -31
+7 -7
fs/afs/flock.c
··· 451 451 */ 452 452 static int afs_do_setlk(struct file *file, struct file_lock *fl) 453 453 { 454 - struct inode *inode = locks_inode(file); 454 + struct inode *inode = file_inode(file); 455 455 struct afs_vnode *vnode = AFS_FS_I(inode); 456 456 enum afs_flock_mode mode = AFS_FS_S(inode->i_sb)->flock_mode; 457 457 afs_lock_type_t type; ··· 701 701 */ 702 702 static int afs_do_unlk(struct file *file, struct file_lock *fl) 703 703 { 704 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(file)); 704 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 705 705 int ret; 706 706 707 707 _enter("{%llx:%llu},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type); ··· 721 721 */ 722 722 static int afs_do_getlk(struct file *file, struct file_lock *fl) 723 723 { 724 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(file)); 724 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 725 725 struct key *key = afs_file_key(file); 726 726 int ret, lock_count; 727 727 ··· 763 763 */ 764 764 int afs_lock(struct file *file, int cmd, struct file_lock *fl) 765 765 { 766 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(file)); 766 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 767 767 enum afs_flock_operation op; 768 768 int ret; 769 769 ··· 798 798 */ 799 799 int afs_flock(struct file *file, int cmd, struct file_lock *fl) 800 800 { 801 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(file)); 801 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 802 802 enum afs_flock_operation op; 803 803 int ret; 804 804 ··· 843 843 */ 844 844 static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl) 845 845 { 846 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(fl->fl_file)); 846 + struct afs_vnode *vnode = AFS_FS_I(file_inode(fl->fl_file)); 847 847 848 848 _enter(""); 849 849 ··· 861 861 */ 862 862 static void afs_fl_release_private(struct file_lock *fl) 863 863 { 864 - struct afs_vnode *vnode = AFS_FS_I(locks_inode(fl->fl_file)); 864 + struct afs_vnode *vnode = AFS_FS_I(file_inode(fl->fl_file)); 865 865 866 866 _enter(""); 867 867
+1 -1
fs/lockd/clntlock.c
··· 188 188 continue; 189 189 if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) 190 190 continue; 191 - if (nfs_compare_fh(NFS_FH(locks_inode(fl_blocked->fl_file)), fh) != 0) 191 + if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->fl_file)), fh) != 0) 192 192 continue; 193 193 /* Alright, we found a lock. Set the return status 194 194 * and wake up the caller
+1 -1
fs/lockd/clntproc.c
··· 131 131 char *nodename = req->a_host->h_rpcclnt->cl_nodename; 132 132 133 133 nlmclnt_next_cookie(&argp->cookie); 134 - memcpy(&lock->fh, NFS_FH(locks_inode(fl->fl_file)), sizeof(struct nfs_fh)); 134 + memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); 135 135 lock->caller = nodename; 136 136 lock->oh.data = req->a_owner; 137 137 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s",
+14 -14
fs/locks.c
··· 234 234 char *list_type) 235 235 { 236 236 struct file_lock *fl; 237 - struct inode *inode = locks_inode(filp); 237 + struct inode *inode = file_inode(filp); 238 238 239 239 list_for_each_entry(fl, list, fl_list) 240 240 if (fl->fl_file == filp) ··· 888 888 { 889 889 struct file_lock *cfl; 890 890 struct file_lock_context *ctx; 891 - struct inode *inode = locks_inode(filp); 891 + struct inode *inode = file_inode(filp); 892 892 void *owner; 893 893 void (*func)(void); 894 894 ··· 1331 1331 int posix_lock_file(struct file *filp, struct file_lock *fl, 1332 1332 struct file_lock *conflock) 1333 1333 { 1334 - return posix_lock_inode(locks_inode(filp), fl, conflock); 1334 + return posix_lock_inode(file_inode(filp), fl, conflock); 1335 1335 } 1336 1336 EXPORT_SYMBOL(posix_lock_file); 1337 1337 ··· 1630 1630 int fcntl_getlease(struct file *filp) 1631 1631 { 1632 1632 struct file_lock *fl; 1633 - struct inode *inode = locks_inode(filp); 1633 + struct inode *inode = file_inode(filp); 1634 1634 struct file_lock_context *ctx; 1635 1635 int type = F_UNLCK; 1636 1636 LIST_HEAD(dispose); ··· 1668 1668 static int 1669 1669 check_conflicting_open(struct file *filp, const long arg, int flags) 1670 1670 { 1671 - struct inode *inode = locks_inode(filp); 1671 + struct inode *inode = file_inode(filp); 1672 1672 int self_wcount = 0, self_rcount = 0; 1673 1673 1674 1674 if (flags & FL_LAYOUT) ··· 1704 1704 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) 1705 1705 { 1706 1706 struct file_lock *fl, *my_fl = NULL, *lease; 1707 - struct inode *inode = locks_inode(filp); 1707 + struct inode *inode = file_inode(filp); 1708 1708 struct file_lock_context *ctx; 1709 1709 bool is_deleg = (*flp)->fl_flags & FL_DELEG; 1710 1710 int error; ··· 1820 1820 { 1821 1821 int error = -EAGAIN; 1822 1822 struct file_lock *fl, *victim = NULL; 1823 - struct inode *inode = locks_inode(filp); 1823 + struct inode *inode = file_inode(filp); 1824 1824 struct file_lock_context *ctx; 1825 1825 LIST_HEAD(dispose); 1826 1826 ··· 1862 1862 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, 1863 1863 void **priv) 1864 1864 { 1865 - struct inode *inode = locks_inode(filp); 1865 + struct inode *inode = file_inode(filp); 1866 1866 int error; 1867 1867 1868 1868 if ((!uid_eq(current_fsuid(), inode->i_uid)) && !capable(CAP_LEASE)) ··· 2351 2351 struct flock *flock) 2352 2352 { 2353 2353 struct file_lock *file_lock = locks_alloc_lock(); 2354 - struct inode *inode = locks_inode(filp); 2354 + struct inode *inode = file_inode(filp); 2355 2355 struct file *f; 2356 2356 int error; 2357 2357 ··· 2555 2555 void locks_remove_posix(struct file *filp, fl_owner_t owner) 2556 2556 { 2557 2557 int error; 2558 - struct inode *inode = locks_inode(filp); 2558 + struct inode *inode = file_inode(filp); 2559 2559 struct file_lock lock; 2560 2560 struct file_lock_context *ctx; 2561 2561 ··· 2592 2592 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) 2593 2593 { 2594 2594 struct file_lock fl; 2595 - struct inode *inode = locks_inode(filp); 2595 + struct inode *inode = file_inode(filp); 2596 2596 2597 2597 if (list_empty(&flctx->flc_flock)) 2598 2598 return; ··· 2637 2637 { 2638 2638 struct file_lock_context *ctx; 2639 2639 2640 - ctx = locks_inode_context(locks_inode(filp)); 2640 + ctx = locks_inode_context(file_inode(filp)); 2641 2641 if (!ctx) 2642 2642 return; 2643 2643 ··· 2721 2721 */ 2722 2722 2723 2723 if (fl->fl_file != NULL) 2724 - inode = locks_inode(fl->fl_file); 2724 + inode = file_inode(fl->fl_file); 2725 2725 2726 2726 seq_printf(f, "%lld: ", id); 2727 2727 ··· 2862 2862 void show_fd_locks(struct seq_file *f, 2863 2863 struct file *filp, struct files_struct *files) 2864 2864 { 2865 - struct inode *inode = locks_inode(filp); 2865 + struct inode *inode = file_inode(filp); 2866 2866 struct file_lock_context *ctx; 2867 2867 int id = 0; 2868 2868
+2 -2
fs/nfsd/nfs4state.c
··· 5374 5374 { 5375 5375 struct nfs4_ol_stateid *st; 5376 5376 struct file *f = fp->fi_deleg_file->nf_file; 5377 - struct inode *ino = locks_inode(f); 5377 + struct inode *ino = file_inode(f); 5378 5378 int writes; 5379 5379 5380 5380 writes = atomic_read(&ino->i_writecount); ··· 7828 7828 return status; 7829 7829 } 7830 7830 7831 - inode = locks_inode(nf->nf_file); 7831 + inode = file_inode(nf->nf_file); 7832 7832 flctx = locks_inode_context(inode); 7833 7833 7834 7834 if (flctx && !list_empty_careful(&flctx->flc_posix)) {
+1 -1
fs/open.c
··· 871 871 if (error) 872 872 goto cleanup_all; 873 873 874 - error = break_lease(locks_inode(f), f->f_flags); 874 + error = break_lease(file_inode(f), f->f_flags); 875 875 if (error) 876 876 goto cleanup_all; 877 877
+1 -3
include/linux/filelock.h
··· 133 133 struct list_head flc_lease; 134 134 }; 135 135 136 - #define locks_inode(f) file_inode(f) 137 - 138 136 #ifdef CONFIG_FILE_LOCKING 139 137 int fcntl_getlk(struct file *, unsigned int, struct flock *); 140 138 int fcntl_setlk(unsigned int, struct file *, unsigned int, ··· 343 345 344 346 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) 345 347 { 346 - return locks_lock_inode_wait(locks_inode(filp), fl); 348 + return locks_lock_inode_wait(file_inode(filp), fl); 347 349 } 348 350 349 351 #ifdef CONFIG_FILE_LOCKING
+2 -2
include/linux/lockd/lockd.h
··· 312 312 313 313 static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 314 314 { 315 - return locks_inode(nlmsvc_file_file(file)); 315 + return file_inode(nlmsvc_file_file(file)); 316 316 } 317 317 318 318 static inline int __nlm_privileged_request4(const struct sockaddr *sap) ··· 372 372 static inline int nlm_compare_locks(const struct file_lock *fl1, 373 373 const struct file_lock *fl2) 374 374 { 375 - return locks_inode(fl1->fl_file) == locks_inode(fl2->fl_file) 375 + return file_inode(fl1->fl_file) == file_inode(fl2->fl_file) 376 376 && fl1->fl_pid == fl2->fl_pid 377 377 && fl1->fl_owner == fl2->fl_owner 378 378 && fl1->fl_start == fl2->fl_start