* [PATCH] mkfs.f2fs: introduce zone align for main area
@ 2016-01-06 7:54 Yunlei He
2016-01-07 23:29 ` Jaegeuk Kim
0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2016-01-06 7:54 UTC (permalink / raw)
To: jaegeuk, chao2.yu, linux-f2fs-devel
This patch calculate main area begin from a new zone,
avoid misalign if segments per zone is not 1.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
---
mkfs/f2fs_format.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 66d7342..fe45322 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -126,7 +126,8 @@ static int f2fs_prepare_super_block(void)
u_int32_t sit_segments;
u_int32_t blocks_for_sit, blocks_for_nat, blocks_for_ssa;
u_int32_t total_valid_blks_available;
- u_int64_t zone_align_start_offset, diff, total_meta_segments;
+ u_int64_t zone_align_start_offset, diff;
+ u_int64_t total_meta_zones, total_meta_segments;
u_int32_t sit_bitmap_size, max_sit_bitmap_size;
u_int32_t max_nat_bitmap_size, max_nat_segments;
u_int32_t total_zones;
@@ -259,16 +260,17 @@ static int f2fs_prepare_super_block(void)
set_sb(segment_count_ssa, get_sb(segment_count_ssa) +
(config.segs_per_zone - diff));
- set_sb(main_blkaddr, get_sb(ssa_blkaddr) + get_sb(segment_count_ssa) *
- config.blks_per_seg);
+ total_meta_zones = ZONE_ALIGN(total_meta_segments *
+ config.blks_per_seg);
- set_sb(segment_count_main, get_sb(segment_count) -
- (get_sb(segment_count_ckpt) +
- get_sb(segment_count_sit) +
- get_sb(segment_count_nat) +
- get_sb(segment_count_ssa)));
+ set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones *
+ config.segs_per_zone * config.blks_per_seg);
+
+ total_zones = get_sb(segment_count) / (config.segs_per_zone) -
+ total_meta_zones;
- set_sb(section_count, get_sb(segment_count_main) / config.segs_per_sec);
+ set_sb(section_count, total_zones * config.secs_per_zone);
set_sb(segment_count_main, get_sb(section_count) * config.segs_per_sec);
@@ -297,7 +299,6 @@ static int f2fs_prepare_super_block(void)
set_sb(meta_ino, 2);
set_sb(root_ino, 3);
- total_zones = get_sb(segment_count_main) / (config.segs_per_zone);
if (total_zones <= 6) {
MSG(1, "\tError: %d zones: Need more zones \
by shrinking zone size\n", total_zones);
--
1.9.1
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mkfs.f2fs: introduce zone align for main area
2016-01-06 7:54 [PATCH] mkfs.f2fs: introduce zone align for main area Yunlei He
@ 2016-01-07 23:29 ` Jaegeuk Kim
2016-01-08 2:28 ` He YunLei
0 siblings, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2016-01-07 23:29 UTC (permalink / raw)
To: Yunlei He; +Cc: linux-f2fs-devel
Hi Yunlei,
Could you rebase the patch based on f2fs-tools.git?
I can't merge this.
Thanks,
On Wed, Jan 06, 2016 at 03:54:37PM +0800, Yunlei He wrote:
> This patch calculate main area begin from a new zone,
> avoid misalign if segments per zone is not 1.
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
> ---
> mkfs/f2fs_format.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
> index 66d7342..fe45322 100644
> --- a/mkfs/f2fs_format.c
> +++ b/mkfs/f2fs_format.c
> @@ -126,7 +126,8 @@ static int f2fs_prepare_super_block(void)
> u_int32_t sit_segments;
> u_int32_t blocks_for_sit, blocks_for_nat, blocks_for_ssa;
> u_int32_t total_valid_blks_available;
> - u_int64_t zone_align_start_offset, diff, total_meta_segments;
> + u_int64_t zone_align_start_offset, diff;
> + u_int64_t total_meta_zones, total_meta_segments;
> u_int32_t sit_bitmap_size, max_sit_bitmap_size;
> u_int32_t max_nat_bitmap_size, max_nat_segments;
> u_int32_t total_zones;
> @@ -259,16 +260,17 @@ static int f2fs_prepare_super_block(void)
> set_sb(segment_count_ssa, get_sb(segment_count_ssa) +
> (config.segs_per_zone - diff));
>
> - set_sb(main_blkaddr, get_sb(ssa_blkaddr) + get_sb(segment_count_ssa) *
> - config.blks_per_seg);
> + total_meta_zones = ZONE_ALIGN(total_meta_segments *
> + config.blks_per_seg);
>
> - set_sb(segment_count_main, get_sb(segment_count) -
> - (get_sb(segment_count_ckpt) +
> - get_sb(segment_count_sit) +
> - get_sb(segment_count_nat) +
> - get_sb(segment_count_ssa)));
> + set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones *
> + config.segs_per_zone * config.blks_per_seg);
> +
> + total_zones = get_sb(segment_count) / (config.segs_per_zone) -
> + total_meta_zones;
>
> - set_sb(section_count, get_sb(segment_count_main) / config.segs_per_sec);
> + set_sb(section_count, total_zones * config.secs_per_zone);
>
> set_sb(segment_count_main, get_sb(section_count) * config.segs_per_sec);
>
> @@ -297,7 +299,6 @@ static int f2fs_prepare_super_block(void)
> set_sb(meta_ino, 2);
> set_sb(root_ino, 3);
>
> - total_zones = get_sb(segment_count_main) / (config.segs_per_zone);
> if (total_zones <= 6) {
> MSG(1, "\tError: %d zones: Need more zones \
> by shrinking zone size\n", total_zones);
> --
> 1.9.1
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mkfs.f2fs: introduce zone align for main area
2016-01-07 23:29 ` Jaegeuk Kim
@ 2016-01-08 2:28 ` He YunLei
0 siblings, 0 replies; 4+ messages in thread
From: He YunLei @ 2016-01-08 2:28 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On 2016/1/8 7:29, Jaegeuk Kim wrote:
> Hi Yunlei,
>
> Could you rebase the patch based on f2fs-tools.git?
> I can't merge this.
>
> Thanks,
Hi Kim,
I am sorry that, I have sent a new one.
Thanks,
>
> On Wed, Jan 06, 2016 at 03:54:37PM +0800, Yunlei He wrote:
>> This patch calculate main area begin from a new zone,
>> avoid misalign if segments per zone is not 1.
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
>> ---
>> mkfs/f2fs_format.c | 21 +++++++++++----------
>> 1 file changed, 11 insertions(+), 10 deletions(-)
>>
>> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
>> index 66d7342..fe45322 100644
>> --- a/mkfs/f2fs_format.c
>> +++ b/mkfs/f2fs_format.c
>> @@ -126,7 +126,8 @@ static int f2fs_prepare_super_block(void)
>> u_int32_t sit_segments;
>> u_int32_t blocks_for_sit, blocks_for_nat, blocks_for_ssa;
>> u_int32_t total_valid_blks_available;
>> - u_int64_t zone_align_start_offset, diff, total_meta_segments;
>> + u_int64_t zone_align_start_offset, diff;
>> + u_int64_t total_meta_zones, total_meta_segments;
>> u_int32_t sit_bitmap_size, max_sit_bitmap_size;
>> u_int32_t max_nat_bitmap_size, max_nat_segments;
>> u_int32_t total_zones;
>> @@ -259,16 +260,17 @@ static int f2fs_prepare_super_block(void)
>> set_sb(segment_count_ssa, get_sb(segment_count_ssa) +
>> (config.segs_per_zone - diff));
>>
>> - set_sb(main_blkaddr, get_sb(ssa_blkaddr) + get_sb(segment_count_ssa) *
>> - config.blks_per_seg);
>> + total_meta_zones = ZONE_ALIGN(total_meta_segments *
>> + config.blks_per_seg);
>>
>> - set_sb(segment_count_main, get_sb(segment_count) -
>> - (get_sb(segment_count_ckpt) +
>> - get_sb(segment_count_sit) +
>> - get_sb(segment_count_nat) +
>> - get_sb(segment_count_ssa)));
>> + set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones *
>> + config.segs_per_zone * config.blks_per_seg);
>> +
>> + total_zones = get_sb(segment_count) / (config.segs_per_zone) -
>> + total_meta_zones;
>>
>> - set_sb(section_count, get_sb(segment_count_main) / config.segs_per_sec);
>> + set_sb(section_count, total_zones * config.secs_per_zone);
>>
>> set_sb(segment_count_main, get_sb(section_count) * config.segs_per_sec);
>>
>> @@ -297,7 +299,6 @@ static int f2fs_prepare_super_block(void)
>> set_sb(meta_ino, 2);
>> set_sb(root_ino, 3);
>>
>> - total_zones = get_sb(segment_count_main) / (config.segs_per_zone);
>> if (total_zones <= 6) {
>> MSG(1, "\tError: %d zones: Need more zones \
>> by shrinking zone size\n", total_zones);
>> --
>> 1.9.1
>
> .
>
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mkfs.f2fs: introduce zone align for main area
@ 2016-01-08 2:25 Yunlei He
0 siblings, 0 replies; 4+ messages in thread
From: Yunlei He @ 2016-01-08 2:25 UTC (permalink / raw)
To: linux-f2fs-devel, jaegeuk, chao2.yu
This patch calculate main area begin from a new zone,
avoid misalign if segments per zone is not 1.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
---
mkfs/f2fs_format.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 66d7342..00c4b64 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -126,7 +126,8 @@ static int f2fs_prepare_super_block(void)
u_int32_t sit_segments;
u_int32_t blocks_for_sit, blocks_for_nat, blocks_for_ssa;
u_int32_t total_valid_blks_available;
- u_int64_t zone_align_start_offset, diff, total_meta_segments;
+ u_int64_t zone_align_start_offset, diff;
+ u_int64_t total_meta_zones, total_meta_segments;
u_int32_t sit_bitmap_size, max_sit_bitmap_size;
u_int32_t max_nat_bitmap_size, max_nat_segments;
u_int32_t total_zones;
@@ -259,16 +260,16 @@ static int f2fs_prepare_super_block(void)
set_sb(segment_count_ssa, get_sb(segment_count_ssa) +
(config.segs_per_zone - diff));
- set_sb(main_blkaddr, get_sb(ssa_blkaddr) + get_sb(segment_count_ssa) *
- config.blks_per_seg);
+ total_meta_zones = ZONE_ALIGN(total_meta_segments *
+ config.blks_per_seg);
- set_sb(segment_count_main, get_sb(segment_count) -
- (get_sb(segment_count_ckpt) +
- get_sb(segment_count_sit) +
- get_sb(segment_count_nat) +
- get_sb(segment_count_ssa)));
+ set_sb(main_blkaddr, get_sb(segment0_blkaddr) + total_meta_zones *
+ config.segs_per_zone * config.blks_per_seg);
+
+ total_zones = get_sb(segment_count) / (config.segs_per_zone) -
+ total_meta_zones;
- set_sb(section_count, get_sb(segment_count_main) / config.segs_per_sec);
+ set_sb(section_count, total_zones * config.secs_per_zone);
set_sb(segment_count_main, get_sb(section_count) * config.segs_per_sec);
@@ -297,7 +298,6 @@ static int f2fs_prepare_super_block(void)
set_sb(meta_ino, 2);
set_sb(root_ino, 3);
- total_zones = get_sb(segment_count_main) / (config.segs_per_zone);
if (total_zones <= 6) {
MSG(1, "\tError: %d zones: Need more zones \
by shrinking zone size\n", total_zones);
--
1.9.1
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-08 2:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 7:54 [PATCH] mkfs.f2fs: introduce zone align for main area Yunlei He
2016-01-07 23:29 ` Jaegeuk Kim
2016-01-08 2:28 ` He YunLei
2016-01-08 2:25 Yunlei He
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.