Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-05-07 Thread Chao Yu
On 2018/5/5 3:06, Jaegeuk Kim wrote:
> On 05/02, Chao Yu wrote:
>> On 2018/4/28 10:49, Jaegeuk Kim wrote:
>>> On 04/27, Chao Yu wrote:
 On 2018/4/27 0:13, Jaegeuk Kim wrote:
> On 04/26, Junling Zheng wrote:
>> Ping...
>>
>> On 2018/4/23 15:32, Junling Zheng wrote:
>>> Introduce tune.f2fs tool to change the f2fs parameters.
>>> Currently this tool only supports adding or removing encrypt
>>> feature bit in superblock.
>
> What is the purpose of this empty tune.f2fs? How can we say we have this
> tool to users? You have to design what kind of things to support first.

 I checked very initial tune2fs.c, it only supports very few parameters 
 tuning
 functionality, but, can not say that is a bad start to introduce the misc 
 tool.

 +   fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e 
 errors-behavior] "
 +"[-i interval[d|m]]\n"
 +"\t[-l] [-m reserved-blocks-percent] device\n", 
 program_name);
>>>
>>> I don't think We have to follow that.
>>>

 Maybe tuning 1. extension list, 2. multi device name later? just guess.
>>>
>>> First of all, does it make sense to unset feature bits? I don't think so.
>>
>> Some features can be turned off in a initial image? like encrypted, 
>> extra_attr,
>> checksum...?
> 
> Any reason to do thtat? And, we need to find all the files whether there is

Not very sure, just checked tune2fs, and found them in manual, guessing that
there came demand from user who want to disable some feature in a formatted
partition?

> any encrypted file.
> 
>>
>>>
>>> Agreed to your suggestion where:
>>> 1. feature set
>>>   - enable system quota
>>> 2. extension list
>>> 3. multi device name -- which may be really big trial
>>
>> So what's our plan now? fill those features into fsck when we need them?
> 
> No. If you want to add tune.f2fs, I'd like to see some demand, or very useful
> features like this. I just want to avoid introducing an (almost) empty tool.

Yeah, I see.

Maybe we can support below options except feature/extension_list/device_name.
-Q quota-optionsset,clear user/group/prjquota sysfile inode.
-U UUID set,clear uuid
-L volume-label set,clear volume name

Thanks,

> 
> Thanks,
> 
>>
>> Thanks,
>>
>>>

 Using fsck.f2fs to tune parameter, IMO, maybe a little confuse for user to
 understand the tool's functionality.

 Thanks,
>>>
>>> .
>>>
> 
> .
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-05-04 Thread Jaegeuk Kim
On 05/02, Chao Yu wrote:
> On 2018/4/28 10:49, Jaegeuk Kim wrote:
> > On 04/27, Chao Yu wrote:
> >> On 2018/4/27 0:13, Jaegeuk Kim wrote:
> >>> On 04/26, Junling Zheng wrote:
>  Ping...
> 
>  On 2018/4/23 15:32, Junling Zheng wrote:
> > Introduce tune.f2fs tool to change the f2fs parameters.
> > Currently this tool only supports adding or removing encrypt
> > feature bit in superblock.
> >>>
> >>> What is the purpose of this empty tune.f2fs? How can we say we have this
> >>> tool to users? You have to design what kind of things to support first.
> >>
> >> I checked very initial tune2fs.c, it only supports very few parameters 
> >> tuning
> >> functionality, but, can not say that is a bad start to introduce the misc 
> >> tool.
> >>
> >> +   fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e 
> >> errors-behavior] "
> >> +"[-i interval[d|m]]\n"
> >> +"\t[-l] [-m reserved-blocks-percent] device\n", 
> >> program_name);
> > 
> > I don't think We have to follow that.
> > 
> >>
> >> Maybe tuning 1. extension list, 2. multi device name later? just guess.
> > 
> > First of all, does it make sense to unset feature bits? I don't think so.
> 
> Some features can be turned off in a initial image? like encrypted, 
> extra_attr,
> checksum...?

Any reason to do thtat? And, we need to find all the files whether there is
any encrypted file.

> 
> > 
> > Agreed to your suggestion where:
> > 1. feature set
> >   - enable system quota
> > 2. extension list
> > 3. multi device name -- which may be really big trial
> 
> So what's our plan now? fill those features into fsck when we need them?

No. If you want to add tune.f2fs, I'd like to see some demand, or very useful
features like this. I just want to avoid introducing an (almost) empty tool.

Thanks,

> 
> Thanks,
> 
> > 
> >>
> >> Using fsck.f2fs to tune parameter, IMO, maybe a little confuse for user to
> >> understand the tool's functionality.
> >>
> >> Thanks,
> > 
> > .
> > 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-05-01 Thread Chao Yu
On 2018/4/28 10:49, Jaegeuk Kim wrote:
> On 04/27, Chao Yu wrote:
>> On 2018/4/27 0:13, Jaegeuk Kim wrote:
>>> On 04/26, Junling Zheng wrote:
 Ping...

 On 2018/4/23 15:32, Junling Zheng wrote:
> Introduce tune.f2fs tool to change the f2fs parameters.
> Currently this tool only supports adding or removing encrypt
> feature bit in superblock.
>>>
>>> What is the purpose of this empty tune.f2fs? How can we say we have this
>>> tool to users? You have to design what kind of things to support first.
>>
>> I checked very initial tune2fs.c, it only supports very few parameters tuning
>> functionality, but, can not say that is a bad start to introduce the misc 
>> tool.
>>
>> +   fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e 
>> errors-behavior] "
>> +"[-i interval[d|m]]\n"
>> +"\t[-l] [-m reserved-blocks-percent] device\n", 
>> program_name);
> 
> I don't think We have to follow that.
> 
>>
>> Maybe tuning 1. extension list, 2. multi device name later? just guess.
> 
> First of all, does it make sense to unset feature bits? I don't think so.

Some features can be turned off in a initial image? like encrypted, extra_attr,
checksum...?

> 
> Agreed to your suggestion where:
> 1. feature set
>   - enable system quota
> 2. extension list
> 3. multi device name -- which may be really big trial

So what's our plan now? fill those features into fsck when we need them?

Thanks,

> 
>>
>> Using fsck.f2fs to tune parameter, IMO, maybe a little confuse for user to
>> understand the tool's functionality.
>>
>> Thanks,
> 
> .
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-04-27 Thread Jaegeuk Kim
On 04/27, Chao Yu wrote:
> On 2018/4/27 0:13, Jaegeuk Kim wrote:
> > On 04/26, Junling Zheng wrote:
> >> Ping...
> >>
> >> On 2018/4/23 15:32, Junling Zheng wrote:
> >>> Introduce tune.f2fs tool to change the f2fs parameters.
> >>> Currently this tool only supports adding or removing encrypt
> >>> feature bit in superblock.
> > 
> > What is the purpose of this empty tune.f2fs? How can we say we have this
> > tool to users? You have to design what kind of things to support first.
> 
> I checked very initial tune2fs.c, it only supports very few parameters tuning
> functionality, but, can not say that is a bad start to introduce the misc 
> tool.
> 
> +   fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e 
> errors-behavior] "
> +"[-i interval[d|m]]\n"
> +"\t[-l] [-m reserved-blocks-percent] device\n", 
> program_name);

I don't think We have to follow that.

> 
> Maybe tuning 1. extension list, 2. multi device name later? just guess.

First of all, does it make sense to unset feature bits? I don't think so.

Agreed to your suggestion where:
1. feature set
  - enable system quota
2. extension list
3. multi device name -- which may be really big trial

> 
> Using fsck.f2fs to tune parameter, IMO, maybe a little confuse for user to
> understand the tool's functionality.
> 
> Thanks,

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-04-26 Thread Chao Yu
On 2018/4/27 0:13, Jaegeuk Kim wrote:
> On 04/26, Junling Zheng wrote:
>> Ping...
>>
>> On 2018/4/23 15:32, Junling Zheng wrote:
>>> Introduce tune.f2fs tool to change the f2fs parameters.
>>> Currently this tool only supports adding or removing encrypt
>>> feature bit in superblock.
> 
> What is the purpose of this empty tune.f2fs? How can we say we have this
> tool to users? You have to design what kind of things to support first.

I checked very initial tune2fs.c, it only supports very few parameters tuning
functionality, but, can not say that is a bad start to introduce the misc tool.

+   fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] "
+"[-i interval[d|m]]\n"
+"\t[-l] [-m reserved-blocks-percent] device\n", program_name);

Maybe tuning 1. extension list, 2. multi device name later? just guess.

Using fsck.f2fs to tune parameter, IMO, maybe a little confuse for user to
understand the tool's functionality.

Thanks,


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-04-26 Thread Jaegeuk Kim
On 04/26, Junling Zheng wrote:
> Ping...
> 
> On 2018/4/23 15:32, Junling Zheng wrote:
> > Introduce tune.f2fs tool to change the f2fs parameters.
> > Currently this tool only supports adding or removing encrypt
> > feature bit in superblock.

What is the purpose of this empty tune.f2fs? How can we say we have this
tool to users? You have to design what kind of things to support first.

Thanks,

> > 
> > Signed-off-by: Junling Zheng 
> > ---
> >  fsck/Makefile.am  |  3 ++-
> >  fsck/fsck.h   |  5 +
> >  fsck/main.c   | 60 
> > ++
> >  fsck/tune.c   | 46 +
> >  include/f2fs_fs.h | 61 
> > +++
> >  man/Makefile.am   |  2 +-
> >  man/tune.f2fs.8   | 50 +
> >  7 files changed, 207 insertions(+), 20 deletions(-)
> >  create mode 100644 fsck/tune.c
> >  create mode 100644 man/tune.f2fs.8
> > 
> > diff --git a/fsck/Makefile.am b/fsck/Makefile.am
> > index 1fc7310..3efacfd 100644
> > --- a/fsck/Makefile.am
> > +++ b/fsck/Makefile.am
> > @@ -5,7 +5,7 @@ AM_CFLAGS = -Wall
> >  sbin_PROGRAMS = fsck.f2fs
> >  noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h 
> > quotaio_tree.h quotaio_v2.h xattr.h
> >  include_HEADERS = $(top_srcdir)/include/quota.h
> > -fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c \
> > +fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c tune.c \
> > node.c segment.c dir.c sload.c xattr.c \
> > dict.c mkquota.c quotaio.c quotaio_tree.c quotaio_v2.c
> >  fsck_f2fs_LDADD = ${libselinux_LIBS} ${libuuid_LIBS} 
> > $(top_builddir)/lib/libf2fs.la
> > @@ -15,3 +15,4 @@ install-data-hook:
> > ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/defrag.f2fs
> > ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/resize.f2fs
> > ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/sload.f2fs
> > +   ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/tune.f2fs
> > diff --git a/fsck/fsck.h b/fsck/fsck.h
> > index 3e13fc6..39d6ed4 100644
> > --- a/fsck/fsck.h
> > +++ b/fsck/fsck.h
> > @@ -180,6 +180,8 @@ extern void write_superblock(struct f2fs_super_block *);
> >  extern void update_data_blkaddr(struct f2fs_sb_info *, nid_t, u16, 
> > block_t);
> >  extern void update_nat_blkaddr(struct f2fs_sb_info *, nid_t, nid_t, 
> > block_t);
> >  
> > +extern int validate_super_block(struct f2fs_sb_info *, int);
> > +extern void print_sb_state(struct f2fs_super_block *);
> >  extern void print_raw_sb_info(struct f2fs_super_block *);
> >  
> >  extern u32 get_free_segments(struct f2fs_sb_info *);
> > @@ -220,6 +222,9 @@ int f2fs_resize(struct f2fs_sb_info *);
> >  /* sload.c */
> >  int f2fs_sload(struct f2fs_sb_info *);
> >  
> > +/* tune.c */
> > +int f2fs_tune(struct f2fs_sb_info *);
> > +
> >  /* segment.c */
> >  void reserve_new_block(struct f2fs_sb_info *, block_t *,
> > struct f2fs_summary *, int);
> > diff --git a/fsck/main.c b/fsck/main.c
> > index c4dd8b1..b8e1aee 100644
> > --- a/fsck/main.c
> > +++ b/fsck/main.c
> > @@ -29,6 +29,7 @@ extern struct sparse_file *f2fs_sparse_file;
> >  #endif
> >  
> >  INIT_FEATURE_TABLE;
> > +INIT_TUNE_FEATURE_TABLE;
> >  
> >  static char *absolute_path(const char *file)
> >  {
> > @@ -123,6 +124,15 @@ void sload_usage()
> > exit(1);
> >  }
> >  
> > +void tune_usage()
> > +{
> > +   MSG(0, "\nUsage: tune.f2fs [options] device\n");
> > +   MSG(0, "[options]:\n");
> > +   MSG(0, "  -d debug level [default:0]\n");
> > +   MSG(0, "  -O [^]feature[,...]\n");
> > +   exit(1);
> > +}
> > +
> >  static int is_digits(char *optarg)
> >  {
> > unsigned int i;
> > @@ -145,6 +155,8 @@ static void error_out(char *prog)
> > resize_usage();
> > else if (!strcmp("sload.f2fs", prog))
> > sload_usage();
> > +   else if (!strcmp("tune.f2fs", prog))
> > +   tune_usage();
> > else
> > MSG(0, "\nWrong program.\n");
> >  }
> > @@ -528,6 +540,32 @@ void f2fs_parse_options(int argc, char *argv[])
> > if (err != NOERROR)
> > break;
> > }
> > +   } else if (!strcmp("tune.f2fs", prog)) {
> > +   const char *option_string = "d:O:";
> > +
> > +   c.func = TUNE;
> > +   while ((option = getopt(argc, argv, option_string)) != EOF) {
> > +   switch (option) {
> > +   case 'd':
> > +   if (!is_digits(optarg)) {
> > +   err = EWRONG_OPT;
> > +   break;
> > +   }
> > +   c.dbg_lv = atoi(optarg);
> > +   MSG(0, "Info: Debug level = %d\n",
> > +   c.dbg_lv);
> > +   break;
> > +   case 'O':
> 

Re: [f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-04-25 Thread Junling Zheng
Ping...

On 2018/4/23 15:32, Junling Zheng wrote:
> Introduce tune.f2fs tool to change the f2fs parameters.
> Currently this tool only supports adding or removing encrypt
> feature bit in superblock.
> 
> Signed-off-by: Junling Zheng 
> ---
>  fsck/Makefile.am  |  3 ++-
>  fsck/fsck.h   |  5 +
>  fsck/main.c   | 60 ++
>  fsck/tune.c   | 46 +
>  include/f2fs_fs.h | 61 
> +++
>  man/Makefile.am   |  2 +-
>  man/tune.f2fs.8   | 50 +
>  7 files changed, 207 insertions(+), 20 deletions(-)
>  create mode 100644 fsck/tune.c
>  create mode 100644 man/tune.f2fs.8
> 
> diff --git a/fsck/Makefile.am b/fsck/Makefile.am
> index 1fc7310..3efacfd 100644
> --- a/fsck/Makefile.am
> +++ b/fsck/Makefile.am
> @@ -5,7 +5,7 @@ AM_CFLAGS = -Wall
>  sbin_PROGRAMS = fsck.f2fs
>  noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h 
> quotaio_tree.h quotaio_v2.h xattr.h
>  include_HEADERS = $(top_srcdir)/include/quota.h
> -fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c \
> +fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c tune.c \
>   node.c segment.c dir.c sload.c xattr.c \
>   dict.c mkquota.c quotaio.c quotaio_tree.c quotaio_v2.c
>  fsck_f2fs_LDADD = ${libselinux_LIBS} ${libuuid_LIBS} 
> $(top_builddir)/lib/libf2fs.la
> @@ -15,3 +15,4 @@ install-data-hook:
>   ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/defrag.f2fs
>   ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/resize.f2fs
>   ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/sload.f2fs
> + ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/tune.f2fs
> diff --git a/fsck/fsck.h b/fsck/fsck.h
> index 3e13fc6..39d6ed4 100644
> --- a/fsck/fsck.h
> +++ b/fsck/fsck.h
> @@ -180,6 +180,8 @@ extern void write_superblock(struct f2fs_super_block *);
>  extern void update_data_blkaddr(struct f2fs_sb_info *, nid_t, u16, block_t);
>  extern void update_nat_blkaddr(struct f2fs_sb_info *, nid_t, nid_t, block_t);
>  
> +extern int validate_super_block(struct f2fs_sb_info *, int);
> +extern void print_sb_state(struct f2fs_super_block *);
>  extern void print_raw_sb_info(struct f2fs_super_block *);
>  
>  extern u32 get_free_segments(struct f2fs_sb_info *);
> @@ -220,6 +222,9 @@ int f2fs_resize(struct f2fs_sb_info *);
>  /* sload.c */
>  int f2fs_sload(struct f2fs_sb_info *);
>  
> +/* tune.c */
> +int f2fs_tune(struct f2fs_sb_info *);
> +
>  /* segment.c */
>  void reserve_new_block(struct f2fs_sb_info *, block_t *,
>   struct f2fs_summary *, int);
> diff --git a/fsck/main.c b/fsck/main.c
> index c4dd8b1..b8e1aee 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -29,6 +29,7 @@ extern struct sparse_file *f2fs_sparse_file;
>  #endif
>  
>  INIT_FEATURE_TABLE;
> +INIT_TUNE_FEATURE_TABLE;
>  
>  static char *absolute_path(const char *file)
>  {
> @@ -123,6 +124,15 @@ void sload_usage()
>   exit(1);
>  }
>  
> +void tune_usage()
> +{
> + MSG(0, "\nUsage: tune.f2fs [options] device\n");
> + MSG(0, "[options]:\n");
> + MSG(0, "  -d debug level [default:0]\n");
> + MSG(0, "  -O [^]feature[,...]\n");
> + exit(1);
> +}
> +
>  static int is_digits(char *optarg)
>  {
>   unsigned int i;
> @@ -145,6 +155,8 @@ static void error_out(char *prog)
>   resize_usage();
>   else if (!strcmp("sload.f2fs", prog))
>   sload_usage();
> + else if (!strcmp("tune.f2fs", prog))
> + tune_usage();
>   else
>   MSG(0, "\nWrong program.\n");
>  }
> @@ -528,6 +540,32 @@ void f2fs_parse_options(int argc, char *argv[])
>   if (err != NOERROR)
>   break;
>   }
> + } else if (!strcmp("tune.f2fs", prog)) {
> + const char *option_string = "d:O:";
> +
> + c.func = TUNE;
> + while ((option = getopt(argc, argv, option_string)) != EOF) {
> + switch (option) {
> + case 'd':
> + if (!is_digits(optarg)) {
> + err = EWRONG_OPT;
> + break;
> + }
> + c.dbg_lv = atoi(optarg);
> + MSG(0, "Info: Debug level = %d\n",
> + c.dbg_lv);
> + break;
> + case 'O':
> + if (parse_feature(tune_feature_table, optarg))
> + tune_usage();
> + break;
> + default:
> + err = EUNKNOWN_OPT;
> + break;
> + }
> + if (err != NOERROR)
> 

[f2fs-dev] [RFC PATCH] f2fs-tools: introduce tune.f2fs

2018-04-23 Thread Junling Zheng
Introduce tune.f2fs tool to change the f2fs parameters.
Currently this tool only supports adding or removing encrypt
feature bit in superblock.

Signed-off-by: Junling Zheng 
---
 fsck/Makefile.am  |  3 ++-
 fsck/fsck.h   |  5 +
 fsck/main.c   | 60 ++
 fsck/tune.c   | 46 +
 include/f2fs_fs.h | 61 +++
 man/Makefile.am   |  2 +-
 man/tune.f2fs.8   | 50 +
 7 files changed, 207 insertions(+), 20 deletions(-)
 create mode 100644 fsck/tune.c
 create mode 100644 man/tune.f2fs.8

diff --git a/fsck/Makefile.am b/fsck/Makefile.am
index 1fc7310..3efacfd 100644
--- a/fsck/Makefile.am
+++ b/fsck/Makefile.am
@@ -5,7 +5,7 @@ AM_CFLAGS = -Wall
 sbin_PROGRAMS = fsck.f2fs
 noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h 
quotaio_tree.h quotaio_v2.h xattr.h
 include_HEADERS = $(top_srcdir)/include/quota.h
-fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c \
+fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c tune.c \
node.c segment.c dir.c sload.c xattr.c \
dict.c mkquota.c quotaio.c quotaio_tree.c quotaio_v2.c
 fsck_f2fs_LDADD = ${libselinux_LIBS} ${libuuid_LIBS} 
$(top_builddir)/lib/libf2fs.la
@@ -15,3 +15,4 @@ install-data-hook:
ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/defrag.f2fs
ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/resize.f2fs
ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/sload.f2fs
+   ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/tune.f2fs
diff --git a/fsck/fsck.h b/fsck/fsck.h
index 3e13fc6..39d6ed4 100644
--- a/fsck/fsck.h
+++ b/fsck/fsck.h
@@ -180,6 +180,8 @@ extern void write_superblock(struct f2fs_super_block *);
 extern void update_data_blkaddr(struct f2fs_sb_info *, nid_t, u16, block_t);
 extern void update_nat_blkaddr(struct f2fs_sb_info *, nid_t, nid_t, block_t);
 
+extern int validate_super_block(struct f2fs_sb_info *, int);
+extern void print_sb_state(struct f2fs_super_block *);
 extern void print_raw_sb_info(struct f2fs_super_block *);
 
 extern u32 get_free_segments(struct f2fs_sb_info *);
@@ -220,6 +222,9 @@ int f2fs_resize(struct f2fs_sb_info *);
 /* sload.c */
 int f2fs_sload(struct f2fs_sb_info *);
 
+/* tune.c */
+int f2fs_tune(struct f2fs_sb_info *);
+
 /* segment.c */
 void reserve_new_block(struct f2fs_sb_info *, block_t *,
struct f2fs_summary *, int);
diff --git a/fsck/main.c b/fsck/main.c
index c4dd8b1..b8e1aee 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -29,6 +29,7 @@ extern struct sparse_file *f2fs_sparse_file;
 #endif
 
 INIT_FEATURE_TABLE;
+INIT_TUNE_FEATURE_TABLE;
 
 static char *absolute_path(const char *file)
 {
@@ -123,6 +124,15 @@ void sload_usage()
exit(1);
 }
 
+void tune_usage()
+{
+   MSG(0, "\nUsage: tune.f2fs [options] device\n");
+   MSG(0, "[options]:\n");
+   MSG(0, "  -d debug level [default:0]\n");
+   MSG(0, "  -O [^]feature[,...]\n");
+   exit(1);
+}
+
 static int is_digits(char *optarg)
 {
unsigned int i;
@@ -145,6 +155,8 @@ static void error_out(char *prog)
resize_usage();
else if (!strcmp("sload.f2fs", prog))
sload_usage();
+   else if (!strcmp("tune.f2fs", prog))
+   tune_usage();
else
MSG(0, "\nWrong program.\n");
 }
@@ -528,6 +540,32 @@ void f2fs_parse_options(int argc, char *argv[])
if (err != NOERROR)
break;
}
+   } else if (!strcmp("tune.f2fs", prog)) {
+   const char *option_string = "d:O:";
+
+   c.func = TUNE;
+   while ((option = getopt(argc, argv, option_string)) != EOF) {
+   switch (option) {
+   case 'd':
+   if (!is_digits(optarg)) {
+   err = EWRONG_OPT;
+   break;
+   }
+   c.dbg_lv = atoi(optarg);
+   MSG(0, "Info: Debug level = %d\n",
+   c.dbg_lv);
+   break;
+   case 'O':
+   if (parse_feature(tune_feature_table, optarg))
+   tune_usage();
+   break;
+   default:
+   err = EUNKNOWN_OPT;
+   break;
+   }
+   if (err != NOERROR)
+   break;
+   }
}
 
add_default_options();
@@ -736,6 +774,13 @@ static int do_sload(struct f2fs_sb_info *sbi)
return f2fs_sload(sbi);
 }
 
+static