diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-07-16 16:39:10 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-07-17 13:32:55 -0400 |
commit | 597d92891b8859b4b4949fd08e25e60fc80ddaaf (patch) | |
tree | c379c890a62a36b36b443cf23f81daa1605901b0 | |
parent | 6bbb4ae8ffc4eef825c8742eff1fefae69a82e41 (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>
-rw-r--r-- | fs/nfs/dir.c | 43 | ||||
-rw-r--r-- | fs/nfs/file.c | 6 | ||||
-rw-r--r-- | fs/nfs/internal.h | 9 | ||||
-rw-r--r-- | fs/nfs/proc.c | 21 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 2 |
5 files changed, 39 insertions, 42 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 @@ | |||
46 | static int nfs_opendir(struct inode *, struct file *); | 46 | static int nfs_opendir(struct inode *, struct file *); |
47 | static int nfs_closedir(struct inode *, struct file *); | 47 | static int nfs_closedir(struct inode *, struct file *); |
48 | static int nfs_readdir(struct file *, void *, filldir_t); | 48 | static int nfs_readdir(struct file *, void *, filldir_t); |
49 | static struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); | ||
50 | static int nfs_create(struct inode *, struct dentry *, umode_t, bool); | ||
51 | static int nfs_mkdir(struct inode *, struct dentry *, umode_t); | ||
52 | static int nfs_rmdir(struct inode *, struct dentry *); | ||
53 | static int nfs_unlink(struct inode *, struct dentry *); | ||
54 | static int nfs_symlink(struct inode *, struct dentry *, const char *); | ||
55 | static int nfs_link(struct dentry *, struct inode *, struct dentry *); | ||
56 | static int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); | ||
57 | static int nfs_rename(struct inode *, struct dentry *, | ||
58 | struct inode *, struct dentry *); | ||
59 | static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); | 49 | static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); |
60 | static loff_t nfs_llseek_dir(struct file *, loff_t, int); | 50 | static loff_t nfs_llseek_dir(struct file *, loff_t, int); |
61 | static void nfs_readdir_clear_array(struct page*); | 51 | static 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 | ||
72 | const 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 | |||
87 | const struct address_space_operations nfs_dir_aops = { | 62 | const 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 | ||
1273 | static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) | 1248 | struct 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 | */ |
1591 | static int nfs_create(struct inode *dir, struct dentry *dentry, | 1566 | int 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 | */ |
1616 | static int | 1591 | int |
1617 | nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) | 1592 | nfs_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 | */ |
1643 | static int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 1618 | int 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 | ||
1669 | static int nfs_rmdir(struct inode *dir, struct dentry *dentry) | 1644 | int 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 | */ |
1728 | static int nfs_unlink(struct inode *dir, struct dentry *dentry) | 1703 | int 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 | */ |
1772 | static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | 1747 | int 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 | ||
1827 | static int | 1802 | int |
1828 | nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 1803 | nfs_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 | */ |
1872 | static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 1847 | int 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; |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 57a22a1533e2..7da8745e22ac 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -41,12 +41,6 @@ | |||
41 | 41 | ||
42 | static const struct vm_operations_struct nfs_file_vm_ops; | 42 | static const struct vm_operations_struct nfs_file_vm_ops; |
43 | 43 | ||
44 | const struct inode_operations nfs_file_inode_operations = { | ||
45 | .permission = nfs_permission, | ||
46 | .getattr = nfs_getattr, | ||
47 | .setattr = nfs_setattr, | ||
48 | }; | ||
49 | |||
50 | #ifdef CONFIG_NFS_V3 | 44 | #ifdef CONFIG_NFS_V3 |
51 | const struct inode_operations nfs3_file_inode_operations = { | 45 | const struct inode_operations nfs3_file_inode_operations = { |
52 | .permission = nfs_permission, | 46 | .permission = nfs_permission, |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 7edc172c371e..35a8ffec69f6 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -247,6 +247,15 @@ extern struct nfs_client *nfs_init_client(struct nfs_client *clp, | |||
247 | /* dir.c */ | 247 | /* dir.c */ |
248 | extern int nfs_access_cache_shrinker(struct shrinker *shrink, | 248 | extern int nfs_access_cache_shrinker(struct shrinker *shrink, |
249 | struct shrink_control *sc); | 249 | struct shrink_control *sc); |
250 | struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); | ||
251 | int nfs_create(struct inode *, struct dentry *, umode_t, bool); | ||
252 | int nfs_mkdir(struct inode *, struct dentry *, umode_t); | ||
253 | int nfs_rmdir(struct inode *, struct dentry *); | ||
254 | int nfs_unlink(struct inode *, struct dentry *); | ||
255 | int nfs_symlink(struct inode *, struct dentry *, const char *); | ||
256 | int nfs_link(struct dentry *, struct inode *, struct dentry *); | ||
257 | int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); | ||
258 | int nfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | ||
250 | 259 | ||
251 | /* inode.c */ | 260 | /* inode.c */ |
252 | extern struct workqueue_struct *nfsiod_workqueue; | 261 | extern struct workqueue_struct *nfsiod_workqueue; |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index c5ed1c0a8ab7..4d3356af3309 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -745,6 +745,27 @@ static int nfs_return_delegation(struct inode *inode) | |||
745 | return 0; | 745 | return 0; |
746 | } | 746 | } |
747 | 747 | ||
748 | static const struct inode_operations nfs_dir_inode_operations = { | ||
749 | .create = nfs_create, | ||
750 | .lookup = nfs_lookup, | ||
751 | .link = nfs_link, | ||
752 | .unlink = nfs_unlink, | ||
753 | .symlink = nfs_symlink, | ||
754 | .mkdir = nfs_mkdir, | ||
755 | .rmdir = nfs_rmdir, | ||
756 | .mknod = nfs_mknod, | ||
757 | .rename = nfs_rename, | ||
758 | .permission = nfs_permission, | ||
759 | .getattr = nfs_getattr, | ||
760 | .setattr = nfs_setattr, | ||
761 | }; | ||
762 | |||
763 | static const struct inode_operations nfs_file_inode_operations = { | ||
764 | .permission = nfs_permission, | ||
765 | .getattr = nfs_getattr, | ||
766 | .setattr = nfs_setattr, | ||
767 | }; | ||
768 | |||
748 | const struct nfs_rpc_ops nfs_v2_clientops = { | 769 | const struct nfs_rpc_ops nfs_v2_clientops = { |
749 | .version = 2, /* protocol version */ | 770 | .version = 2, /* protocol version */ |
750 | .dentry_ops = &nfs_dentry_operations, | 771 | .dentry_ops = &nfs_dentry_operations, |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index b23cfc120edb..6c38bc9c0081 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -427,7 +427,6 @@ extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | |||
427 | /* | 427 | /* |
428 | * linux/fs/nfs/file.c | 428 | * linux/fs/nfs/file.c |
429 | */ | 429 | */ |
430 | extern const struct inode_operations nfs_file_inode_operations; | ||
431 | #ifdef CONFIG_NFS_V3 | 430 | #ifdef CONFIG_NFS_V3 |
432 | extern const struct inode_operations nfs3_file_inode_operations; | 431 | extern const struct inode_operations nfs3_file_inode_operations; |
433 | #endif /* CONFIG_NFS_V3 */ | 432 | #endif /* CONFIG_NFS_V3 */ |
@@ -485,7 +484,6 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb, | |||
485 | /* | 484 | /* |
486 | * linux/fs/nfs/dir.c | 485 | * linux/fs/nfs/dir.c |
487 | */ | 486 | */ |
488 | extern const struct inode_operations nfs_dir_inode_operations; | ||
489 | #ifdef CONFIG_NFS_V3 | 487 | #ifdef CONFIG_NFS_V3 |
490 | extern const struct inode_operations nfs3_dir_inode_operations; | 488 | extern const struct inode_operations nfs3_dir_inode_operations; |
491 | #endif /* CONFIG_NFS_V3 */ | 489 | #endif /* CONFIG_NFS_V3 */ |