public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH v2] ext4: fix wrong size computation in ext4_mb_normalize_request()
Date: Fri, 11 Jul 2014 11:04:52 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1407111104090.2165@localhost.localdomain> (raw)
In-Reply-To: <1405067660-728-1-git-send-email-wangxg.fnst@cn.fujitsu.com>

On Fri, 11 Jul 2014, Xiaoguang Wang wrote:

> Date: Fri, 11 Jul 2014 16:34:20 +0800
> From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> To: linux-ext4@vger.kernel.org
> Cc: tytso@mit.edu, lczerner@redhat.com,
>     Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> Subject: [PATCH v2] ext4: fix wrong size computation in
>     ext4_mb_normalize_request()
> 
> As the member fe_len defined in struct ext4_free_extent is expressed as
> number of clusters, the variable "size" computation is wrong, we need to
> first translate fe_len to block number, then to bytes.
> 
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  fs/ext4/mballoc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 7f72f50..975a35e 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3076,7 +3076,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
>  		size = 8 * 1024 * 1024;
>  	} else {
>  		start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits;
> -		size	  = ac->ac_o_ex.fe_len << bsbits;
> +		size	  = (loff_t)EXT4_C2B(EXT4_SB(ac->ac_sb),
> +				     ac->ac_o_ex.fe_len) << bsbits;

The indentation is wrong, otherwise it looks good.

Thanks!

Reviewed-by: Lukas Czerner <lczerner@redhat.com>


>  	}
>  	size = size >> bsbits;
>  	start = start_off >> bsbits;
> 

  reply	other threads:[~2014-07-11  9:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10  5:40 [PATCH] ext4: fix wrong size computation in ext4_mb_normalize_request() Xiaoguang Wang
2014-07-10  9:25 ` Lukáš Czerner
2014-07-11  3:41   ` Xiaoguang Wang
2014-07-11  7:07     ` Lukáš Czerner
2014-07-11  8:34       ` [PATCH v2] " Xiaoguang Wang
2014-07-11  9:04         ` Lukáš Czerner [this message]
2014-07-28  2:26         ` Theodore Ts'o

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=alpine.LFD.2.00.1407111104090.2165@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=wangxg.fnst@cn.fujitsu.com \
    /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