From mboxrd@z Thu Jan 1 00:00:00 1970 From: He YunLei Subject: Re: [PATCH] f2fs: add default mount options to remount Date: Thu, 7 May 2015 17:32:10 +0800 Message-ID: <554B311A.4030707@huawei.com> References: <1430990435-3679-1-git-send-email-heyunlei@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YqIAj-0005Qw-Cq for linux-f2fs-devel@lists.sourceforge.net; Thu, 07 May 2015 09:32:49 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YqIAc-0002XP-BQ for linux-f2fs-devel@lists.sourceforge.net; Thu, 07 May 2015 09:32:49 +0000 In-Reply-To: <1430990435-3679-1-git-send-email-heyunlei@huawei.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Yunlei He Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net On 2015/5/7 17:20, Yunlei He wrote: > I use f2fs filesystem with /data partition on my Android phone > by the default mount options. When I remount /data in order to > adding discard option to run some benchmarks, I find the default > options such as background_gc, user_xattr and acl turned off. > > So I introduce a function named default_options in super.c. It do > some default setting, and both mount and remount operations will > call this function to complete default setting. > > Signed-off-by: Yunlei He > --- > fs/f2fs/super.c | 32 ++++++++++++++++++-------------- > 1 file changed, 18 insertions(+), 14 deletions(-) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 138fa93..1f9f18a 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -658,6 +658,22 @@ static const struct file_operations f2fs_seq_segment_info_fops = { > .release = single_release, > }; > > +static void default_options(struct f2fs_sb_info *sbi) > +{ > + /* init some FS parameters */ > + sbi->active_logs = NR_CURSEG_TYPE; > + > + set_opt(sbi, BG_GC); > + set_opt(sbi, INLINE_DATA); > + > +#ifdef CONFIG_F2FS_FS_XATTR > + set_opt(sbi, XATTR_USER); > +#endif > +#ifdef CONFIG_F2FS_FS_POSIX_ACL > + set_opt(sbi, POSIX_ACL); > +#endif > +} > + > static int f2fs_remount(struct super_block *sb, int *flags, char *data) > { > struct f2fs_sb_info *sbi = F2FS_SB(sb); > @@ -675,8 +691,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) > org_mount_opt = sbi->mount_opt; > active_logs = sbi->active_logs; > > - sbi->mount_opt.opt = 0; I am very sorry that this line is deleted by mistake, I'll send a version. > - sbi->active_logs = NR_CURSEG_TYPE; > + default_options(sbi); > > /* parse mount options */ > err = parse_options(sb, data); > @@ -1018,18 +1033,7 @@ try_onemore: > goto free_sbi; > > sb->s_fs_info = sbi; > - /* init some FS parameters */ > - sbi->active_logs = NR_CURSEG_TYPE; > - > - set_opt(sbi, BG_GC); > - set_opt(sbi, INLINE_DATA); > - > -#ifdef CONFIG_F2FS_FS_XATTR > - set_opt(sbi, XATTR_USER); > -#endif > -#ifdef CONFIG_F2FS_FS_POSIX_ACL > - set_opt(sbi, POSIX_ACL); > -#endif > + default_options(sbi); > /* parse mount options */ > options = kstrdup((const char *)data, GFP_KERNEL); > if (data && !options) { > ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y