From patchwork Wed Jul 29 19:59:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Kulkarni X-Patchwork-Id: 38220 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6TK0EUR021837 for ; Wed, 29 Jul 2009 20:00:14 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by h25xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MWFJV-0000wI-B3; Wed, 29 Jul 2009 19:59:49 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by h25xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MWFJU-0000vI-Du for v9fs-developer@lists.sourceforge.net; Wed, 29 Jul 2009 19:59:48 +0000 X-ACL-Warn: Received: from rv-out-0708.google.com ([209.85.198.244]) by 72vjzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1MWFJC-0002hs-M2 for v9fs-developer@lists.sourceforge.net; Wed, 29 Jul 2009 19:59:43 +0000 Received: by rv-out-0708.google.com with SMTP id b17so252791rvf.22 for ; Wed, 29 Jul 2009 12:59:24 -0700 (PDT) Received: by 10.140.202.21 with SMTP id z21mr176046rvf.25.1248897564423; Wed, 29 Jul 2009 12:59:24 -0700 (PDT) Received: from localhost.localdomain (y-130-55-115-47.lanl.gov [130.55.115.47]) by mx.google.com with ESMTPS id c20sm7462913rvf.51.2009.07.29.12.59.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Jul 2009 12:59:23 -0700 (PDT) From: Abhishek Kulkarni To: v9fs-developer@lists.sourceforge.net Date: Wed, 29 Jul 2009 13:59:08 -0600 Message-Id: <1248897550-16951-2-git-send-email-adkulkar@umail.iu.edu> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1248897550-16951-1-git-send-email-adkulkar@umail.iu.edu> References: <1248897550-16951-1-git-send-email-adkulkar@umail.iu.edu> X-Spam-Score: -0.3 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.3 AWL AWL: From: address is in the auto white-list X-Headers-End: 1MWFJC-0002hs-M2 Subject: [V9fs-developer] [9P-FSC 1/3] 9p: Remove unnecessary v9ses->options which duplicates the mount string. X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net 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: Abhishek Kulkarni --- :100644 100644 17b1e88... 2ae631a... M v9fs/v9fs.c :100644 100644 a7d5671... 38762bf... M v9fs/v9fs.h :100644 100644 95b521f... 8d81f85... M v9fs/vfs_super.c v9fs/v9fs.c | 21 +++++---------------- v9fs/v9fs.h | 1 - v9fs/vfs_super.c | 23 +++++------------------ 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/v9fs/v9fs.c b/v9fs/v9fs.c index 17b1e88..2ae631a 100644 --- a/v9fs/v9fs.c +++ b/v9fs/v9fs.c @@ -76,7 +76,7 @@ static const match_table_t tokens = { * 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; substring_t args[MAX_OPT_ARGS]; @@ -90,10 +90,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses) v9ses->debug = 0; v9ses->cache = 0; - if (!v9ses->options) + if (!opts) return 0; - options = kstrdup(v9ses->options, GFP_KERNEL); + options = kstrdup(opts, GFP_KERNEL); if (!options) { P9_DPRINTK(P9_DEBUG_ERROR, "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->dfltuid = V9FS_DEFUID; 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) { retval = rc; goto error; } - v9ses->clnt = p9_client_create(dev_name, v9ses->options); - + v9ses->clnt = p9_client_create(dev_name, data); if (IS_ERR(v9ses->clnt)) { retval = PTR_ERR(v9ses->clnt); v9ses->clnt = NULL; @@ -280,7 +270,6 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) __putname(v9ses->uname); __putname(v9ses->aname); - kfree(v9ses->options); } /** diff --git a/v9fs/v9fs.h b/v9fs/v9fs.h index a7d5671..38762bf 100644 --- a/v9fs/v9fs.h +++ b/v9fs/v9fs.h @@ -85,7 +85,6 @@ struct v9fs_session_info { unsigned int afid; unsigned int cache; - char *options; /* copy of mount options */ char *uname; /* user name to mount as */ char *aname; /* name of remote hierarchy being mounted */ unsigned int maxdata; /* max data for client interface */ diff --git a/v9fs/vfs_super.c b/v9fs/vfs_super.c index 95b521f..8d81f85 100644 --- a/v9fs/vfs_super.c +++ b/v9fs/vfs_super.c @@ -81,7 +81,7 @@ static int v9fs_set_super(struct super_block *s, void *data) static void 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_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 | 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); goto free_stat; } - v9fs_fill_super(sb, v9ses, flags); + v9fs_fill_super(sb, v9ses, flags, data); inode = v9fs_get_inode(sb, S_IFDIR | mode); if (IS_ERR(inode)) { @@ -207,21 +209,6 @@ static void v9fs_kill_super(struct super_block *s) 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 v9fs_umount_begin(struct super_block *sb) { @@ -234,7 +221,7 @@ v9fs_umount_begin(struct super_block *sb) static const struct super_operations v9fs_super_ops = { .statfs = simple_statfs, .clear_inode = v9fs_clear_inode, - .show_options = v9fs_show_options, + .show_options = generic_show_options, .umount_begin = v9fs_umount_begin, };