linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Fan Li <fanofcode.li@samsung.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs-tools: set segment_count in super block correctly
Date: Mon, 1 Feb 2016 16:30:43 -0800	[thread overview]
Message-ID: <20160202003043.GB86978@jaegeuk.gateway> (raw)
In-Reply-To: <001101d15cd2$569ad410$03d07c30$@samsung.com>

Hi Fan,

On Mon, Feb 01, 2016 at 05:23:33PM +0800, Fan Li wrote:
> Now f2fs will check statistics recorded in super block in sanity_check_area_boundary()
> during mount,if number of segments per section is greater than 1, and disk space 
> isn't aligned with section, mount will fail due to following condition:
> 
> main_blkaddr + (segment_count_main << log_blocks_per_seg) !=
> 		segment0_blkaddr + (segment_count << log_blocks_per_seg)
> 
> this is because when the length of main area isn't aligned with section, mkfs didn't 
> add the number of excess segments to segment_count_main, but add it to 
> segment_count. 
> Here align segment_count with section size to prevent such problem.
> 
> Signed-off-by: Fan Li <fanofcode.li@samsung.com>
> ---
>  mkfs/f2fs_format.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
> index 66d7342..aab2491 100644
> --- a/mkfs/f2fs_format.c
> +++ b/mkfs/f2fs_format.c
> @@ -174,7 +174,8 @@ static int f2fs_prepare_super_block(void)
>  	}
>  
>  	set_sb(segment_count, (config.total_sectors * config.sector_size -
> -				zone_align_start_offset) / segment_size_bytes);
> +				zone_align_start_offset) / segment_size_bytes/
> +				config.segs_per_sec*config.segs_per_sec);

Please follow the coding style.

Thanks,

>  
>  	set_sb(segment0_blkaddr, zone_align_start_offset / blk_size_bytes);
>  	sb->cp_blkaddr = sb->segment0_blkaddr;
> -- 
> 1.7.9.5

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

      reply	other threads:[~2016-02-02  0:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01  9:23 [PATCH] f2fs-tools: set segment_count in super block correctly Fan Li
2016-02-02  0:30 ` Jaegeuk Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160202003043.GB86978@jaegeuk.gateway \
    --to=jaegeuk@kernel.org \
    --cc=fanofcode.li@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).