Commit 8e9d64d9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (3/4) smarter nfs_get_sb()

Switch NFS to separate allocation of private part of superblock,
uss explicit sget() instead of get_sb_nodev()
parent 594ece65
...@@ -262,7 +262,6 @@ int nfs_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -262,7 +262,6 @@ int nfs_fill_super(struct super_block *sb, void *raw_data, int silent)
/* We probably want something more informative here */ /* We probably want something more informative here */
snprintf(sb->s_id, sizeof(sb->s_id), "%x:%x", major(sb->s_dev), minor(sb->s_dev)); snprintf(sb->s_id, sizeof(sb->s_id), "%x:%x", major(sb->s_dev), minor(sb->s_dev));
memset(NFS_SB(sb), 0, sizeof(struct nfs_sb_info));
if (!data) if (!data)
goto out_miss_args; goto out_miss_args;
...@@ -1145,17 +1144,56 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) ...@@ -1145,17 +1144,56 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
* question being, when two NFS mounts are the same? Identical IP * question being, when two NFS mounts are the same? Identical IP
* of server + identical root fhandle? Trond? * of server + identical root fhandle? Trond?
*/ */
static int nfs_set_super(struct super_block *s, void *data)
{
s->u.generic_sbp = data;
return set_anon_super(s, data);
}
static struct super_block *nfs_get_sb(struct file_system_type *fs_type, static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data) int flags, char *dev_name, void *data)
{ {
return get_sb_nodev(fs_type, flags, data, nfs_fill_super); int error;
struct nfs_server *server;
struct super_block *s;
server = kmalloc(sizeof(struct nfs_server), GFP_KERNEL);
if (!server)
return ERR_PTR(-ENOMEM);
memset(server, 0, sizeof(struct nfs_server));
s = sget(fs_type, NULL, nfs_set_super, server);
if (IS_ERR(s) || s->s_root) { /* the latter will be needed */
kfree(server);
return s;
}
s->s_flags = flags;
error = nfs_fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
if (error) {
up_write(&s->s_umount);
deactivate_super(s);
return ERR_PTR(error);
}
s->s_flags |= MS_ACTIVE;
return s;
}
static void nfs_kill_super(struct super_block *s)
{
struct nfs_server *server = NFS_SB(s);
kill_anon_super(s);
kfree(server);
} }
static struct file_system_type nfs_fs_type = { static struct file_system_type nfs_fs_type = {
owner: THIS_MODULE, owner: THIS_MODULE,
name: "nfs", name: "nfs",
get_sb: nfs_get_sb, get_sb: nfs_get_sb,
kill_sb: kill_anon_super, kill_sb: nfs_kill_super,
fs_flags: FS_ODD_RENAME, fs_flags: FS_ODD_RENAME,
}; };
......
...@@ -653,7 +653,6 @@ struct quota_mount_options ...@@ -653,7 +653,6 @@ struct quota_mount_options
#include <linux/ntfs_fs_sb.h> #include <linux/ntfs_fs_sb.h>
#include <linux/msdos_fs_sb.h> #include <linux/msdos_fs_sb.h>
#include <linux/iso_fs_sb.h> #include <linux/iso_fs_sb.h>
#include <linux/nfs_fs_sb.h>
#include <linux/sysv_fs_sb.h> #include <linux/sysv_fs_sb.h>
#include <linux/affs_fs_sb.h> #include <linux/affs_fs_sb.h>
#include <linux/ufs_fs_sb.h> #include <linux/ufs_fs_sb.h>
...@@ -707,7 +706,6 @@ struct super_block { ...@@ -707,7 +706,6 @@ struct super_block {
struct ntfs_sb_info ntfs_sb; struct ntfs_sb_info ntfs_sb;
struct msdos_sb_info msdos_sb; struct msdos_sb_info msdos_sb;
struct isofs_sb_info isofs_sb; struct isofs_sb_info isofs_sb;
struct nfs_sb_info nfs_sb;
struct sysv_sb_info sysv_sb; struct sysv_sb_info sysv_sb;
struct affs_sb_info affs_sb; struct affs_sb_info affs_sb;
struct ufs_sb_info ufs_sb; struct ufs_sb_info ufs_sb;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/nfs_fs_sb.h>
#include <linux/sunrpc/debug.h> #include <linux/sunrpc/debug.h>
#include <linux/sunrpc/auth.h> #include <linux/sunrpc/auth.h>
#include <linux/sunrpc/clnt.h> #include <linux/sunrpc/clnt.h>
...@@ -174,7 +176,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) ...@@ -174,7 +176,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
{ {
return list_entry(inode, struct nfs_inode, vfs_inode); return list_entry(inode, struct nfs_inode, vfs_inode);
} }
#define NFS_SB(s) (&s->u.nfs_sb.s_server) #define NFS_SB(s) ((struct nfs_server *)(s->u.generic_sbp))
#define NFS_FH(inode) (&NFS_I(inode)->fh) #define NFS_FH(inode) (&NFS_I(inode)->fh)
#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) #define NFS_SERVER(inode) (NFS_SB(inode->i_sb))
......
...@@ -29,11 +29,4 @@ struct nfs_server { ...@@ -29,11 +29,4 @@ struct nfs_server {
lru_busy; lru_busy;
}; };
/*
* nfs super-block data in memory
*/
struct nfs_sb_info {
struct nfs_server s_server;
};
#endif #endif
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/nfs_fs_sb.h>
#include <linux/sunrpc/auth.h> #include <linux/sunrpc/auth.h>
#include <linux/nfs_xdr.h> #include <linux/nfs_xdr.h>
......
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