linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Fan Li <fanofcode.li@samsung.com>, 'Jaegeuk Kim' <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: simplify the way of calulating next nat address
Date: Sat, 3 Jun 2017 09:38:46 +0800	[thread overview]
Message-ID: <b908d479-c1bb-466e-df2a-37ad42b835a9@kernel.org> (raw)
In-Reply-To: <003201d2db74$6be959f0$43bc0dd0$@samsung.com>

On 2017/6/2 15:45, Fan Li wrote:
> The index of segment which the next nat block is in has only one different
> bit than the current one, so to get the next nat address, we can simply
> alter that one bit.
> 
> Signed-off-by: Fan Li <fanofcode.li@samsung.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/node.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
> index 558048e..da0b21b 100644
> --- a/fs/f2fs/node.h
> +++ b/fs/f2fs/node.h
> @@ -224,10 +224,7 @@ static inline pgoff_t next_nat_addr(struct f2fs_sb_info *sbi,
>         struct f2fs_nm_info *nm_i = NM_I(sbi);
> 
>         block_addr -= nm_i->nat_blkaddr;
> -       if ((block_addr >> sbi->log_blocks_per_seg) % 2)
> -               block_addr -= sbi->blocks_per_seg;
> -       else
> -               block_addr += sbi->blocks_per_seg;
> +       block_addr ^= 1 << sbi->log_blocks_per_seg;
> 
>         return block_addr + nm_i->nat_blkaddr;
>  }
> --
> 2.7.4
> 
> 
> ------------------------------------------------------------------------------
> 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
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

      reply	other threads:[~2017-06-03  1:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170602074702epcas5p2afcfc8a3bb05e1916f6d93abe1958a5a@epcas5p2.samsung.com>
2017-06-02  7:45 ` [PATCH] f2fs: simplify the way of calulating next nat address Fan Li
2017-06-03  1:38   ` Chao Yu [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=b908d479-c1bb-466e-df2a-37ad42b835a9@kernel.org \
    --to=chao@kernel.org \
    --cc=fanofcode.li@samsung.com \
    --cc=jaegeuk@kernel.org \
    --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).