aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-16 16:39:10 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-17 13:32:55 -0400
commit597d92891b8859b4b4949fd08e25e60fc80ddaaf (patch)
treec379c890a62a36b36b443cf23f81daa1605901b0 /fs/nfs/dir.c
parent6bbb4ae8ffc4eef825c8742eff1fefae69a82e41 (diff)
NFS: Split out NFS v2 inode operations
This patch moves the NFS v2 file and directory inode functions into files that are only compiled whet CONFIG_NFS_V2 is enabled. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b7136853ca9c..9ae329d62340 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -46,16 +46,6 @@
46static int nfs_opendir(struct inode *, struct file *); 46static int nfs_opendir(struct inode *, struct file *);
47static int nfs_closedir(struct inode *, struct file *); 47static int nfs_closedir(struct inode *, struct file *);
48static int nfs_readdir(struct file *, void *, filldir_t); 48static int nfs_readdir(struct file *, void *, filldir_t);
49static struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int);
50static int nfs_create(struct inode *, struct dentry *, umode_t, bool);
51static int nfs_mkdir(struct inode *, struct dentry *, umode_t);
52static int nfs_rmdir(struct inode *, struct dentry *);
53static int nfs_unlink(struct inode *, struct dentry *);
54static int nfs_symlink(struct inode *, struct dentry *, const char *);
55static int nfs_link(struct dentry *, struct inode *, struct dentry *);
56static int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
57static int nfs_rename(struct inode *, struct dentry *,
58 struct inode *, struct dentry *);
59static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); 49static int nfs_fsync_dir(struct file *, loff_t, loff_t, int);
60static loff_t nfs_llseek_dir(struct file *, loff_t, int); 50static loff_t nfs_llseek_dir(struct file *, loff_t, int);
61static void nfs_readdir_clear_array(struct page*); 51static void nfs_readdir_clear_array(struct page*);
@@ -69,21 +59,6 @@ const struct file_operations nfs_dir_operations = {
69 .fsync = nfs_fsync_dir, 59 .fsync = nfs_fsync_dir,
70}; 60};
71 61
72const struct inode_operations nfs_dir_inode_operations = {
73 .create = nfs_create,
74 .lookup = nfs_lookup,
75 .link = nfs_link,
76 .unlink = nfs_unlink,
77 .symlink = nfs_symlink,
78 .mkdir = nfs_mkdir,
79 .rmdir = nfs_rmdir,
80 .mknod = nfs_mknod,
81 .rename = nfs_rename,
82 .permission = nfs_permission,
83 .getattr = nfs_getattr,
84 .setattr = nfs_setattr,
85};
86
87const struct address_space_operations nfs_dir_aops = { 62const struct address_space_operations nfs_dir_aops = {
88 .freepage = nfs_readdir_clear_array, 63 .freepage = nfs_readdir_clear_array,
89}; 64};
@@ -1270,7 +1245,7 @@ const struct dentry_operations nfs_dentry_operations = {
1270 .d_release = nfs_d_release, 1245 .d_release = nfs_d_release,
1271}; 1246};
1272 1247
1273static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) 1248struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
1274{ 1249{
1275 struct dentry *res; 1250 struct dentry *res;
1276 struct dentry *parent; 1251 struct dentry *parent;
@@ -1588,7 +1563,7 @@ out_error:
1588 * that the operation succeeded on the server, but an error in the 1563 * that the operation succeeded on the server, but an error in the
1589 * reply path made it appear to have failed. 1564 * reply path made it appear to have failed.
1590 */ 1565 */
1591static int nfs_create(struct inode *dir, struct dentry *dentry, 1566int nfs_create(struct inode *dir, struct dentry *dentry,
1592 umode_t mode, bool excl) 1567 umode_t mode, bool excl)
1593{ 1568{
1594 struct iattr attr; 1569 struct iattr attr;
@@ -1613,7 +1588,7 @@ out_err:
1613/* 1588/*
1614 * See comments for nfs_proc_create regarding failed operations. 1589 * See comments for nfs_proc_create regarding failed operations.
1615 */ 1590 */
1616static int 1591int
1617nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) 1592nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev)
1618{ 1593{
1619 struct iattr attr; 1594 struct iattr attr;
@@ -1640,7 +1615,7 @@ out_err:
1640/* 1615/*
1641 * See comments for nfs_proc_create regarding failed operations. 1616 * See comments for nfs_proc_create regarding failed operations.
1642 */ 1617 */
1643static int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 1618int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1644{ 1619{
1645 struct iattr attr; 1620 struct iattr attr;
1646 int error; 1621 int error;
@@ -1666,7 +1641,7 @@ static void nfs_dentry_handle_enoent(struct dentry *dentry)
1666 d_delete(dentry); 1641 d_delete(dentry);
1667} 1642}
1668 1643
1669static int nfs_rmdir(struct inode *dir, struct dentry *dentry) 1644int nfs_rmdir(struct inode *dir, struct dentry *dentry)
1670{ 1645{
1671 int error; 1646 int error;
1672 1647
@@ -1725,7 +1700,7 @@ out:
1725 * 1700 *
1726 * If sillyrename() returns 0, we do nothing, otherwise we unlink. 1701 * If sillyrename() returns 0, we do nothing, otherwise we unlink.
1727 */ 1702 */
1728static int nfs_unlink(struct inode *dir, struct dentry *dentry) 1703int nfs_unlink(struct inode *dir, struct dentry *dentry)
1729{ 1704{
1730 int error; 1705 int error;
1731 int need_rehash = 0; 1706 int need_rehash = 0;
@@ -1769,7 +1744,7 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry)
1769 * now have a new file handle and can instantiate an in-core NFS inode 1744 * now have a new file handle and can instantiate an in-core NFS inode
1770 * and move the raw page into its mapping. 1745 * and move the raw page into its mapping.
1771 */ 1746 */
1772static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) 1747int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1773{ 1748{
1774 struct pagevec lru_pvec; 1749 struct pagevec lru_pvec;
1775 struct page *page; 1750 struct page *page;
@@ -1824,7 +1799,7 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
1824 return 0; 1799 return 0;
1825} 1800}
1826 1801
1827static int 1802int
1828nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 1803nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1829{ 1804{
1830 struct inode *inode = old_dentry->d_inode; 1805 struct inode *inode = old_dentry->d_inode;
@@ -1869,7 +1844,7 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1869 * If these conditions are met, we can drop the dentries before doing 1844 * If these conditions are met, we can drop the dentries before doing
1870 * the rename. 1845 * the rename.
1871 */ 1846 */
1872static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, 1847int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1873 struct inode *new_dir, struct dentry *new_dentry) 1848 struct inode *new_dir, struct dentry *new_dentry)
1874{ 1849{
1875 struct inode *old_inode = old_dentry->d_inode; 1850 struct inode *old_inode = old_dentry->d_inode;