public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: "'Jaegeuk Kim'" <jaegeuk@kernel.org>
Cc: "'Changman Lee'" <cm224.lee@samsung.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh
Date: Tue, 24 Mar 2015 13:02:04 +0800	[thread overview]
Message-ID: <003301d065ef$c78b03f0$56a10bd0$@samsung.com> (raw)
In-Reply-To: <20150324044211.GA35842@jaegeuk-mac02.hsd1.ca.comcast.net>

Hi Jaegeuk,

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, March 24, 2015 12:42 PM
> To: Chao Yu
> Cc: Changman Lee; linux-f2fs-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh
> 
> Hi Chao,
> 
> On Mon, Mar 23, 2015 at 10:28:00AM +0800, Chao Yu wrote:
> > Map bh over max size which caller defined is not needed, limit it in
> > f2fs_map_bh.
> >
> > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > ---
> >  fs/f2fs/data.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index f0a18a0..a99bc7f 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -255,15 +255,16 @@ static void f2fs_map_bh(struct super_block *sb, pgoff_t pgofs,
> >  			struct extent_info *ei, struct buffer_head *bh_result)
> >  {
> >  	unsigned int blkbits = sb->s_blocksize_bits;
> > +	unsigned int maxblocks = bh_result->b_size >> blkbits;
> >  	size_t count;
> >
> >  	clear_buffer_new(bh_result);
> >  	map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs);
> >  	count = ei->fofs + ei->len - pgofs;
> > -	if (count < (UINT_MAX >> blkbits))
> > -		bh_result->b_size = (count << blkbits);
> > +	if (count > maxblocks)
> > +		bh_result->b_size = maxblocks << blkbits;
> >  	else
> > -		bh_result->b_size = UINT_MAX;
> > +		bh_result->b_size = count << blkbits;
> 
> How about using min()?

Better, I will do it. :)

Thanks,

> 
> Thanks,
> 
> >  }
> >
> >  static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs,
> > --
> > 2.3.3


      reply	other threads:[~2015-03-24  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23  2:28 [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh Chao Yu
2015-03-24  4:42 ` Jaegeuk Kim
2015-03-24  5:02   ` 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='003301d065ef$c78b03f0$56a10bd0$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=cm224.lee@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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