Re: [f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-07 Thread Chao Yu
On 2018/4/8 10:15, Sheng Yong wrote:
> This patch introduces a new option -V to show the version of mkfs.f2fs
> and exit after that.

BTW, should we add -V for other misc tools?

> 
> Signed-off-by: Sheng Yong 

Reviewed-by: Chao Yu 

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] [PATCH] resize.f2fs: clear CP_COMPACT_SUM_FLAG when rebuilding checkpoint

2018-04-07 Thread Chao Yu
On 2018/4/8 10:14, Sheng Yong wrote:
> Resize rebuilds checkpoint with 6 summary blocks, so if
> CP_COMPACT_SUM_FLAG is set in the old checkpoint, clear it.
> 
> Signed-off-by: Sheng Yong 

Reviewed-by: Chao Yu 

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


[f2fs-dev] [PATCH v3] mkfs.f2fs: support multiple features with one "-O"

2018-04-07 Thread Junling Zheng
Now one "-O" option can support multiple features separated
by a comma or blank, such as:
feature1,feature2,... or "feature1 feature2 ..."

Signed-off-by: Junling Zheng 
Reviewed-by: Chao Yu 
---
Changes from v1:
 - free buf to fix memory leak.
Changes from v2:
 - modify usage and man page to show this feature.
 man/mkfs.f2fs.8 |  3 ++-
 mkfs/f2fs_format_main.c | 33 +
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/man/mkfs.f2fs.8 b/man/mkfs.f2fs.8
index 442c0ea..29dd68f 100644
--- a/man/mkfs.f2fs.8
+++ b/man/mkfs.f2fs.8
@@ -112,7 +112,8 @@ is hidden to users, and utilized by F2FS cleaner. If not 
specified, the best
 number will be assigned automatically accoring to the partition size.
 .TP
 .BI \-O " feature-list"
-Specify a feature list in order f2fs filesystem will supports.
+Specify a feature list like feature1[feature2,feature3,...] in order f2fs
+filesystem will supports.
 e.g "encrypt" and so on.
 .TP
 .BI \-q
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 449a0ed..a6e4474 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -51,7 +51,7 @@ static void mkfs_usage()
MSG(0, "  -l label\n");
MSG(0, "  -m support zoned block device [default:0]\n");
MSG(0, "  -o overprovision ratio [default:5]\n");
-   MSG(0, "  -O [feature list] e.g. \"encrypt\"\n");
+   MSG(0, "  -O feature1[feature2,feature3,...] e.g. \"encrypt\"\n");
MSG(0, "  -q quiet mode\n");
MSG(0, "  -s # of segments per section [default:1]\n");
MSG(0, "  -S sparse mode\n");
@@ -81,10 +81,8 @@ static void f2fs_show_info()
MSG(0, "Info: Trim is %s\n", c.trim ? "enabled": "disabled");
 }
 
-static void parse_feature(const char *features)
+static void set_feature_bits(char *features)
 {
-   while (*features == ' ')
-   features++;
if (!strcmp(features, "encrypt")) {
c.feature |= cpu_to_le32(F2FS_FEATURE_ENCRYPT);
} else if (!strcmp(features, "verity")) {
@@ -109,6 +107,33 @@ static void parse_feature(const char *features)
}
 }
 
+static void parse_feature(const char *features)
+{
+   char *buf, *sub, *next;
+
+   buf = calloc(strlen(features) + 1, sizeof(char));
+   ASSERT(buf);
+   strncpy(buf, features, strlen(features) + 1);
+
+   for (sub = buf; sub && *sub; sub = next ? next + 1 : NULL) {
+   /* Skip the beginning blanks */
+   while (*sub && *sub == ' ')
+   sub++;
+   next = sub;
+   /* Skip a feature word */
+   while (*next && *next != ' ' && *next != ',')
+   next++;
+
+   if (*next == 0)
+   next = NULL;
+   else
+   *next = 0;
+
+   set_feature_bits(sub);
+   }
+   free(buf);
+}
+
 static void f2fs_parse_options(int argc, char *argv[])
 {
static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:";
-- 
2.16.2


--
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] [PATCH v2] f2fs: remove nested usage of plug list

2018-04-07 Thread Chao Yu
On 2018/4/8 10:59, Yunlei He wrote:
> -f2fs_file_write_iter
>   -blk_start_plug
> -__generic_file_write_iter
>   ...
> -do_blockdev_direct_IO
>   -blk_start_plug
>   ...
>   -blk_finish_plug
>   ...
>   -blk_finish_plug
> 
> which may conduct performance decrease in our platform

Have sent this before, let me integrate your description into mine and add
signed-off, anyway, well cleanup job! ;)

Thanks,

> 
> Signed-off-by: Yunlei He 
> ---
>  fs/f2fs/file.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 6b94f19..977c800 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2894,7 +2894,6 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
> struct iov_iter *from)
>  {
>   struct file *file = iocb->ki_filp;
>   struct inode *inode = file_inode(file);
> - struct blk_plug plug;
>   ssize_t ret;
>  
>   if (unlikely(f2fs_cp_error(F2FS_I_SB(inode
> @@ -2939,9 +2938,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
> struct iov_iter *from)
>   return err;
>   }
>   }
> - blk_start_plug(&plug);
>   ret = __generic_file_write_iter(iocb, from);
> - blk_finish_plug(&plug);
>   clear_inode_flag(inode, FI_NO_PREALLOC);
>  
>   /* if we couldn't write data, we should deallocate blocks. */
> 


--
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


[f2fs-dev] [PATCH] f2fs: remove redundant block plug

2018-04-07 Thread Chao Yu
For buffered IO, we don't need to use block plug to cache bio,
for direct IO, generic f2fs_direct_IO has already added block
plug, so let's remove redundant one in .write_iter.

As Yunlei described in his patch:

-f2fs_file_write_iter
  -blk_start_plug
-__generic_file_write_iter
...
  -do_blockdev_direct_IO
-blk_start_plug
...
-blk_finish_plug
...
  -blk_finish_plug

which may conduct performance decrease in our platform

Signed-off-by: Yunlei He 
Signed-off-by: Chao Yu 
---
 fs/f2fs/file.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7b8fb31086c3..cb315d23c56f 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2886,7 +2886,6 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
 {
struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file);
-   struct blk_plug plug;
ssize_t ret;
 
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode
@@ -2931,9 +2930,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
return err;
}
}
-   blk_start_plug(&plug);
ret = __generic_file_write_iter(iocb, from);
-   blk_finish_plug(&plug);
clear_inode_flag(inode, FI_NO_PREALLOC);
 
/* if we couldn't write data, we should deallocate blocks. */
-- 
2.15.0.55.gc2ece9dc4de6


--
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


[f2fs-dev] [PATCH] f2fs: fix to show missing bits in FS_IOC_GETFLAGS

2018-04-07 Thread Chao Yu
This patch fixes to show missing encrypt/inline_data flag in
FS_IOC_GETFLAGS like ext4 does.

Signed-off-by: Chao Yu 
---
 fs/f2fs/file.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 3fd485395f9d..79cfaad21705 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1584,8 +1584,15 @@ static int f2fs_ioc_getflags(struct file *filp, unsigned 
long arg)
 {
struct inode *inode = file_inode(filp);
struct f2fs_inode_info *fi = F2FS_I(inode);
-   unsigned int flags = fi->i_flags &
-   (F2FS_FL_USER_VISIBLE | F2FS_PROJINHERIT_FL);
+   unsigned int flags = fi->i_flags;
+
+   if (file_is_encrypt(inode))
+   flags |= F2FS_ENCRYPT_FL;
+   if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode))
+   flags |= F2FS_INLINE_DATA_FL;
+
+   flags &= F2FS_FL_USER_VISIBLE;
+
return put_user(flags, (int __user *)arg);
 }
 
-- 
2.15.0.55.gc2ece9dc4de6


--
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


[f2fs-dev] [PATCH] f2fs: remove unneeded F2FS_PROJINHERIT_FL

2018-04-07 Thread Chao Yu
Now F2FS_FL_USER_VISIBLE and F2FS_FL_USER_MODIFIABLE has included
F2FS_PROJINHERIT_FL, so remove unneeded F2FS_PROJINHERIT_FL when
using visible/modifiable flag macro.

Signed-off-by: Chao Yu 
---
 fs/f2fs/file.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 82a01f0aaa33..3fd485395f9d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -686,7 +686,7 @@ int f2fs_getattr(const struct path *path, struct kstat 
*stat,
stat->btime.tv_nsec = fi->i_crtime.tv_nsec;
}
 
-   flags = fi->i_flags & (F2FS_FL_USER_VISIBLE | F2FS_PROJINHERIT_FL);
+   flags = fi->i_flags & F2FS_FL_USER_VISIBLE;
if (flags & F2FS_APPEND_FL)
stat->attributes |= STATX_ATTR_APPEND;
if (flags & F2FS_COMPR_FL)
@@ -1606,8 +1606,8 @@ static int __f2fs_ioc_setflags(struct inode *inode, 
unsigned int flags)
if (!capable(CAP_LINUX_IMMUTABLE))
return -EPERM;
 
-   flags = flags & (F2FS_FL_USER_MODIFIABLE | F2FS_PROJINHERIT_FL);
-   flags |= oldflags & ~(F2FS_FL_USER_MODIFIABLE | F2FS_PROJINHERIT_FL);
+   flags = flags & F2FS_FL_USER_MODIFIABLE;
+   flags |= oldflags & ~F2FS_FL_USER_MODIFIABLE;
fi->i_flags = flags;
 
if (fi->i_flags & F2FS_PROJINHERIT_FL)
@@ -2649,7 +2649,7 @@ static int f2fs_ioc_fsgetxattr(struct file *filp, 
unsigned long arg)
 
memset(&fa, 0, sizeof(struct fsxattr));
fa.fsx_xflags = f2fs_iflags_to_xflags(fi->i_flags &
-   (F2FS_FL_USER_VISIBLE | F2FS_PROJINHERIT_FL));
+   F2FS_FL_USER_VISIBLE);
 
if (f2fs_sb_has_project_quota(inode->i_sb))
fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
-- 
2.15.0.55.gc2ece9dc4de6


--
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


[f2fs-dev] [PATCH v2] f2fs: remove nested usage of plug list

2018-04-07 Thread Yunlei He
-f2fs_file_write_iter
  -blk_start_plug
-__generic_file_write_iter
...
  -do_blockdev_direct_IO
-blk_start_plug
...
-blk_finish_plug
...
  -blk_finish_plug

which may conduct performance decrease in our platform

Signed-off-by: Yunlei He 
---
 fs/f2fs/file.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6b94f19..977c800 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2894,7 +2894,6 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
 {
struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file);
-   struct blk_plug plug;
ssize_t ret;
 
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode
@@ -2939,9 +2938,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
return err;
}
}
-   blk_start_plug(&plug);
ret = __generic_file_write_iter(iocb, from);
-   blk_finish_plug(&plug);
clear_inode_flag(inode, FI_NO_PREALLOC);
 
/* if we couldn't write data, we should deallocate blocks. */
-- 
1.9.1


--
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


[f2fs-dev] [PATCH] f2fs: remove nested usage of plug list

2018-04-07 Thread Yunlei He
-f2fs_file_write_iter
  -blk_start_plug
-__generic_file_write_iter
...
  -do_blockdev_direct_IO
-blk_start_plug
...
-blk_finish_plug
...
  -blk_finish_plug

which may conduct performance decrease in our platform

Signed-off-by: Yunlei He 
---
 fs/f2fs/file.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6b94f19..6ce27ab 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2939,9 +2939,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
return err;
}
}
-   blk_start_plug(&plug);
ret = __generic_file_write_iter(iocb, from);
-   blk_finish_plug(&plug);
clear_inode_flag(inode, FI_NO_PREALLOC);
 
/* if we couldn't write data, we should deallocate blocks. */
-- 
1.9.1


--
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


[f2fs-dev] [PATCH] mkfs.f2fs: introduce new option V to show version

2018-04-07 Thread Sheng Yong
This patch introduces a new option -V to show the version of mkfs.f2fs
and exit after that.

Signed-off-by: Sheng Yong 
---
 mkfs/f2fs_format_main.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 3c70513..3520882 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -58,6 +58,7 @@ static void mkfs_usage()
MSG(0, "  -t 0: nodiscard, 1: discard [default:1]\n");
MSG(0, "  -w wanted sector size\n");
MSG(0, "  -z # of sections per zone [default:1]\n");
+   MSG(0, "  -V print the version number and exit\n");
MSG(0, "sectors: number of sectors. [default: determined by device 
size]\n");
exit(1);
 }
@@ -136,7 +137,7 @@ static void parse_feature(const char *features)
 
 static void f2fs_parse_options(int argc, char *argv[])
 {
-   static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:";
+   static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:V";
int32_t option=0;
 
while ((option = getopt(argc,argv,option_string)) != EOF) {
@@ -209,6 +210,10 @@ static void f2fs_parse_options(int argc, char *argv[])
case 'w':
c.wanted_sector_size = atoi(optarg);
break;
+   case 'V':
+   MSG(0, "mkfs.f2fs %s (%s)\n",
+   F2FS_TOOLS_VERSION, F2FS_TOOLS_DATE);
+   exit(0);
default:
MSG(0, "\tError: Unknown option %c\n",option);
mkfs_usage();
-- 
2.14.1


--
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


[f2fs-dev] [PATCH] resize.f2fs: clear CP_COMPACT_SUM_FLAG when rebuilding checkpoint

2018-04-07 Thread Sheng Yong
Resize rebuilds checkpoint with 6 summary blocks, so if
CP_COMPACT_SUM_FLAG is set in the old checkpoint, clear it.

Signed-off-by: Sheng Yong 
---
 fsck/resize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fsck/resize.c b/fsck/resize.c
index 7643511..019da71 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -504,6 +504,8 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
 
/* update nat_bits flag */
flags = update_nat_bits_flags(new_sb, cp, get_cp(ckpt_flags));
+   if (flags & CP_COMPACT_SUM_FLAG)
+   flags &= ~CP_COMPACT_SUM_FLAG;
set_cp(ckpt_flags, flags);
 
memcpy(new_cp, cp, (unsigned char *)cp->sit_nat_version_bitmap -
-- 
2.14.1


--
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] [RESEND PATCH] f2fs: no need to take the address of the array of sb->s_uuid

2018-04-07 Thread Chao Yu
On 2018/4/5 11:58, Gao Xiang wrote:
> Keep in line with the common case since it is some weird
> to take the address of an array again.
> 
> Signed-off-by: Gao Xiang 

Reviewed-by: Chao Yu 

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] [PATCH] f2fs: enlarge block plug coverage

2018-04-07 Thread Chao Yu
On 2018/4/5 11:51, Jaegeuk Kim wrote:
> On 04/04, Chao Yu wrote:
>> This patch enlarges block plug coverage in __issue_discard_cmd, in
>> order to collect more pending bios before issuing them, to avoid
>> being disturbed by previous discard I/O in IO aware discard mode.
> 
> Hmm, then we need to wait for huge discard IO for over 10 secs, which

We found that total discard latency is rely on total discard number we issued
last time instead of range or length discard covered. IMO, if we don't change
.max_requests value, we will not suffer longer latency.

> will affect following read/write IOs accordingly. In order to avoid that,
> we actually need to limit the discard size.

If you are worry about I/O interference in between discard and rw, I suggest to
decrease .max_requests value.

Thanks,

> 
> Thanks,
> 
>>
>> Signed-off-by: Chao Yu 
>> ---
>>  fs/f2fs/segment.c | 7 +--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 8f0b5ba46315..4287e208c040 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -1208,10 +1208,12 @@ static int __issue_discard_cmd(struct f2fs_sb_info 
>> *sbi,
>>  pend_list = &dcc->pend_list[i];
>>  
>>  mutex_lock(&dcc->cmd_lock);
>> +
>> +blk_start_plug(&plug);
>> +
>>  if (list_empty(pend_list))
>>  goto next;
>>  f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
>> -blk_start_plug(&plug);
>>  list_for_each_entry_safe(dc, tmp, pend_list, list) {
>>  f2fs_bug_on(sbi, dc->state != D_PREP);
>>  
>> @@ -1227,8 +1229,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info 
>> *sbi,
>>  if (++iter >= dpolicy->max_requests)
>>  break;
>>  }
>> -blk_finish_plug(&plug);
>>  next:
>> +blk_finish_plug(&plug);
>> +
>>  mutex_unlock(&dcc->cmd_lock);
>>  
>>  if (iter >= dpolicy->max_requests)
>> -- 
>> 2.15.0.55.gc2ece9dc4de6
> 
> .
> 


--
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] [PATCH] mkfs.f2fs: fix incorrect cold data location

2018-04-07 Thread Chao Yu
On 2018/4/5 11:47, Jaegeuk Kim wrote:
> On 04/04, Chao Yu wrote:
>> If last_zone((total_zones >> 2)) is equal or less than
>> next_zone(CURSEG_COLD_NODE), cold data area will be located in the
>> same position with hot data, fixes it.
> 
> verify_cur_segs() will rearrage this?

Yes, finally, verify_cur_segs() will make sure there is no redundant segment
used by different log headers. But we'd better ensure log initial position is
correct at the first time, otherwise, verify_cur_segs() will use sequential
allocating to initialize log position, which is not match to our original 
design.

Thanks,

> 
> 
>>
>> Signed-off-by: Chao Yu 
>> ---
>>  mkfs/f2fs_format.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
>> index 65692bbe083a..8885f632371d 100644
>> --- a/mkfs/f2fs_format.c
>> +++ b/mkfs/f2fs_format.c
>> @@ -471,7 +471,7 @@ static int f2fs_prepare_super_block(void)
>>  c.cur_seg[CURSEG_HOT_DATA] = next_zone(CURSEG_COLD_NODE);
>>  c.cur_seg[CURSEG_COLD_DATA] =
>>  max(last_zone((total_zones >> 2)),
>> -next_zone(CURSEG_COLD_NODE));
>> +next_zone(CURSEG_HOT_DATA));
>>  c.cur_seg[CURSEG_WARM_DATA] =
>>  max(last_zone((total_zones >> 1)),
>>  next_zone(CURSEG_COLD_DATA));
>> -- 
>> 2.15.0.55.gc2ece9dc4de6
> 
> .
> 


--
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] [PATCH] f2fs: fix to show encrypt flag in FS_IOC_GETFLAGS

2018-04-07 Thread Chao Yu
On 2018/4/5 11:46, Jaegeuk Kim wrote:
> On 04/03, Chao Yu wrote:
>> On 2018/4/3 4:21, Jaegeuk Kim wrote:
>>> On 04/02, Chao Yu wrote:
 This patch fixes to show encrypt flag in FS_IOC_GETFLAGS like ext4 does.
>>>
>>> Actually, we have to show internal flags owned by f2fs, not generic ones.
>>> We may need to define all of them separately?
>>
>> Agreed, I wrote a patch, could check that? and in that patch, do we need to
>> delete flag definition f2fs don't use?
> 
> IMO, we'd better keep the flags. I merged it and could you add encryption part

Agreed.

> on top of it?

No problem. ;)

Thanks,

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

 Signed-off-by: Chao Yu 
 ---
  fs/f2fs/file.c | 9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)

 diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
 index 8068b015ece5..271fadadaa36 100644
 --- a/fs/f2fs/file.c
 +++ b/fs/f2fs/file.c
 @@ -1584,8 +1584,13 @@ static int f2fs_ioc_getflags(struct file *filp, 
 unsigned long arg)
  {
struct inode *inode = file_inode(filp);
struct f2fs_inode_info *fi = F2FS_I(inode);
 -  unsigned int flags = fi->i_flags &
 -  (FS_FL_USER_VISIBLE | FS_PROJINHERIT_FL);
 +  unsigned int flags = fi->i_flags;
 +
 +  if (file_is_encrypt(inode))
 +  flags |= FS_ENCRYPT_FL;
 +
 +  flags &= FS_FL_USER_VISIBLE | FS_PROJINHERIT_FL;
 +
return put_user(flags, (int __user *)arg);
  }
  
 -- 
 2.15.0.55.gc2ece9dc4de6
>>>
>>> .
>>>
> 
> .
> 


--
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] [PATCH] common/config: support f2fs-tools v1.9 and later

2018-04-07 Thread Eryu Guan
On Thu, Apr 05, 2018 at 03:19:01PM -0700, Eric Biggers wrote:
> Pass the -f option to mkfs.f2fs when it appears to support it.  This is
> required by f2fs-tools v1.9 and later in order to format the filesystem
> even when an existing filesystem is detected.  But earlier versions did
> not accept this option.
> 
> Signed-off-by: Eric Biggers 

Looks fine to me, but I'd like an ACK from f2fs developers.

> ---
>  common/config | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/common/config b/common/config
> index 20f0e5f3..7c046a78 100644
> --- a/common/config
> +++ b/common/config
> @@ -94,10 +94,11 @@ set_prog_path()
>   type -P $1
>  }
>  
> -# Handle mkfs.btrfs which does (or does not) require -f to overwrite
> -set_btrfs_mkfs_prog_path_with_opts()
> +# Handle mkfs.$fstyp which does (or does not) require -f to overwrite
> +set_mkfs_prog_path_with_opts()
>  {
> - p=`set_prog_path mkfs.btrfs`
> + local fstyp=$1
> + local p=`set_prog_path mkfs.$fstyp`
>   if [ "$p" != "" ] && grep -q 'force overwrite' $p; then

Also grep the "$p -h" output instead of the binary file?

Thanks,
Eryu

>   echo "$p -f"
>   else
> @@ -223,8 +224,8 @@ case "$HOSTOS" in
>  export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
>  export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
>  export MKFS_UDF_PROG="`set_prog_path mkudffs`"
> -export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
> -export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
> +export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
> +export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"
>  export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
>  export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
>  export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
> -- 
> 2.17.0.484.g0c8726318c-goog
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
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