Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b53e4b5 authored by Abhishek Kulkarni's avatar Abhishek Kulkarni Committed by Eric Van Hensbergen
Browse files

9p: remove unnecessary v9fses->options which duplicates the mount string



The mount options string is saved in sb->s_options. This patch removes
the redundant duplicating of the mount options. Also, since we are not
displaying anything special in show options, we replace v9fs_show_options
with generic_show_options for now.

Signed-off-by: default avatarAbhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 0aad37ef
Loading
Loading
Loading
Loading
+5 −16
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@ static const match_table_t tokens = {
 * Return 0 upon success, -ERRNO upon failure.
 * Return 0 upon success, -ERRNO upon failure.
 */
 */


static int v9fs_parse_options(struct v9fs_session_info *v9ses)
static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
{
{
	char *options;
	char *options;
	substring_t args[MAX_OPT_ARGS];
	substring_t args[MAX_OPT_ARGS];
@@ -90,10 +90,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses)
	v9ses->debug = 0;
	v9ses->debug = 0;
	v9ses->cache = 0;
	v9ses->cache = 0;


	if (!v9ses->options)
	if (!opts)
		return 0;
		return 0;


	options = kstrdup(v9ses->options, GFP_KERNEL);
	options = kstrdup(opts, GFP_KERNEL);
	if (!options) {
	if (!options) {
		P9_DPRINTK(P9_DEBUG_ERROR,
		P9_DPRINTK(P9_DEBUG_ERROR,
			   "failed to allocate copy of option string\n");
			   "failed to allocate copy of option string\n");
@@ -206,24 +206,14 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
	v9ses->uid = ~0;
	v9ses->uid = ~0;
	v9ses->dfltuid = V9FS_DEFUID;
	v9ses->dfltuid = V9FS_DEFUID;
	v9ses->dfltgid = V9FS_DEFGID;
	v9ses->dfltgid = V9FS_DEFGID;
	if (data) {
		v9ses->options = kstrdup(data, GFP_KERNEL);
		if (!v9ses->options) {
			P9_DPRINTK(P9_DEBUG_ERROR,
			   "failed to allocate copy of option string\n");
			retval = -ENOMEM;
			goto error;
		}
	}


	rc = v9fs_parse_options(v9ses);
	rc = v9fs_parse_options(v9ses, data);
	if (rc < 0) {
	if (rc < 0) {
		retval = rc;
		retval = rc;
		goto error;
		goto error;
	}
	}


	v9ses->clnt = p9_client_create(dev_name, v9ses->options);
	v9ses->clnt = p9_client_create(dev_name, data);

	if (IS_ERR(v9ses->clnt)) {
	if (IS_ERR(v9ses->clnt)) {
		retval = PTR_ERR(v9ses->clnt);
		retval = PTR_ERR(v9ses->clnt);
		v9ses->clnt = NULL;
		v9ses->clnt = NULL;
@@ -280,7 +270,6 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)


	__putname(v9ses->uname);
	__putname(v9ses->uname);
	__putname(v9ses->aname);
	__putname(v9ses->aname);
	kfree(v9ses->options);
}
}


/**
/**
+0 −1
Original line number Original line Diff line number Diff line
@@ -85,7 +85,6 @@ struct v9fs_session_info {
	unsigned int afid;
	unsigned int afid;
	unsigned int cache;
	unsigned int cache;


	char *options;		/* copy of mount options */
	char *uname;		/* user name to mount as */
	char *uname;		/* user name to mount as */
	char *aname;		/* name of remote hierarchy being mounted */
	char *aname;		/* name of remote hierarchy being mounted */
	unsigned int maxdata;	/* max data for client interface */
	unsigned int maxdata;	/* max data for client interface */
+5 −18
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ static int v9fs_set_super(struct super_block *s, void *data)


static void
static void
v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
		int flags)
		int flags, void *data)
{
{
	sb->s_maxbytes = MAX_LFS_FILESIZE;
	sb->s_maxbytes = MAX_LFS_FILESIZE;
	sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
	sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
@@ -91,6 +91,8 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,


	sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
	sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
	    MS_NOATIME;
	    MS_NOATIME;

	save_mount_options(sb, data);
}
}


/**
/**
@@ -139,7 +141,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
		retval = PTR_ERR(sb);
		retval = PTR_ERR(sb);
		goto free_stat;
		goto free_stat;
	}
	}
	v9fs_fill_super(sb, v9ses, flags);
	v9fs_fill_super(sb, v9ses, flags, data);


	inode = v9fs_get_inode(sb, S_IFDIR | mode);
	inode = v9fs_get_inode(sb, S_IFDIR | mode);
	if (IS_ERR(inode)) {
	if (IS_ERR(inode)) {
@@ -208,21 +210,6 @@ static void v9fs_kill_super(struct super_block *s)
	P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
	P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
}
}


/**
 * v9fs_show_options - Show mount options in /proc/mounts
 * @m: seq_file to write to
 * @mnt: mount descriptor
 *
 */

static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
{
	struct v9fs_session_info *v9ses = mnt->mnt_sb->s_fs_info;
	if (v9ses->options != NULL)
		seq_printf(m, ",%s", v9ses->options);
	return 0;
}

static void
static void
v9fs_umount_begin(struct super_block *sb)
v9fs_umount_begin(struct super_block *sb)
{
{
@@ -235,7 +222,7 @@ v9fs_umount_begin(struct super_block *sb)
static const struct super_operations v9fs_super_ops = {
static const struct super_operations v9fs_super_ops = {
	.statfs = simple_statfs,
	.statfs = simple_statfs,
	.clear_inode = v9fs_clear_inode,
	.clear_inode = v9fs_clear_inode,
	.show_options = v9fs_show_options,
	.show_options = generic_show_options,
	.umount_begin = v9fs_umount_begin,
	.umount_begin = v9fs_umount_begin,
};
};