Commit 1cda707d52e51a6cafac0aef12d2bd7052d572e6

Authored by Trond Myklebust
1 parent 5cf95214cc

NFS: Remove requirement for inode->i_mutex from nfs_invalidate_mapping

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 4 changed files with 3 additions and 43 deletions Side-by-side Diff

... ... @@ -560,7 +560,7 @@
560 560 desc->entry = &my_entry;
561 561  
562 562 nfs_block_sillyrename(dentry);
563   - res = nfs_revalidate_mapping_nolock(inode, filp->f_mapping);
  563 + res = nfs_revalidate_mapping(inode, filp->f_mapping);
564 564 if (res < 0)
565 565 goto out;
566 566  
... ... @@ -754,7 +754,7 @@
754 754 return __nfs_revalidate_inode(server, inode);
755 755 }
756 756  
757   -static int nfs_invalidate_mapping_nolock(struct inode *inode, struct address_space *mapping)
  757 +static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
758 758 {
759 759 struct nfs_inode *nfsi = NFS_I(inode);
760 760  
761 761  
762 762  
... ... @@ -775,49 +775,10 @@
775 775 return 0;
776 776 }
777 777  
778   -static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
779   -{
780   - int ret = 0;
781   -
782   - mutex_lock(&inode->i_mutex);
783   - if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_DATA) {
784   - ret = nfs_sync_mapping(mapping);
785   - if (ret == 0)
786   - ret = nfs_invalidate_mapping_nolock(inode, mapping);
787   - }
788   - mutex_unlock(&inode->i_mutex);
789   - return ret;
790   -}
791   -
792 778 /**
793   - * nfs_revalidate_mapping_nolock - Revalidate the pagecache
794   - * @inode - pointer to host inode
795   - * @mapping - pointer to mapping
796   - */
797   -int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping)
798   -{
799   - struct nfs_inode *nfsi = NFS_I(inode);
800   - int ret = 0;
801   -
802   - if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
803   - || nfs_attribute_timeout(inode) || NFS_STALE(inode)) {
804   - ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
805   - if (ret < 0)
806   - goto out;
807   - }
808   - if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
809   - ret = nfs_invalidate_mapping_nolock(inode, mapping);
810   -out:
811   - return ret;
812   -}
813   -
814   -/**
815 779 * nfs_revalidate_mapping - Revalidate the pagecache
816 780 * @inode - pointer to host inode
817 781 * @mapping - pointer to mapping
818   - *
819   - * This version of the function will take the inode->i_mutex and attempt to
820   - * flush out all dirty data if it needs to invalidate the page cache.
821 782 */
822 783 int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
823 784 {
... ... @@ -50,7 +50,7 @@
50 50 struct page *page;
51 51 void *err;
52 52  
53   - err = ERR_PTR(nfs_revalidate_mapping_nolock(inode, inode->i_mapping));
  53 + err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
54 54 if (err)
55 55 goto read_failed;
56 56 page = read_cache_page(&inode->i_data, 0,
include/linux/nfs_fs.h
... ... @@ -347,7 +347,6 @@
347 347 extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
348 348 extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
349 349 extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
350   -extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
351 350 extern int nfs_setattr(struct dentry *, struct iattr *);
352 351 extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
353 352 extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);