linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Tao Ma <tm@tao.ma>
Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Lukas Czerner <lczerner@redhat.com>
Subject: Re: [PATCH v2] ext3: Adjust trim start with first_data_block.
Date: Fri, 21 Jan 2011 16:00:01 +0100	[thread overview]
Message-ID: <20110121150001.GD5302@quack.suse.cz> (raw)
In-Reply-To: <1295578376-3914-1-git-send-email-tm@tao.ma>

On Fri 21-01-11 10:52:56, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> As we have make the consense in the e-mail[1], the trim start should
> be added with first_data_block. So this patch fulfill it and remove
> the check for start < first_data_block.
> 
> [1] http://www.spinics.net/lists/linux-ext4/msg22737.html
  Thanks. Merged.

								Honza
> 
> Cc: Jan Kara <jack@suse.cz>
> Cc: Lukas Czerner <lczerner@redhat.com>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> ---
>  fs/ext3/balloc.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
> index 971e1bd..13bfebe 100644
> --- a/fs/ext3/balloc.c
> +++ b/fs/ext3/balloc.c
> @@ -2091,7 +2091,8 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
>  	ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count);
>  	int ret = 0;
>  
> -	start = range->start >> sb->s_blocksize_bits;
> +	start = (range->start >> sb->s_blocksize_bits) +
> +		le32_to_cpu(es->s_first_data_block);
>  	len = range->len >> sb->s_blocksize_bits;
>  	minlen = range->minlen >> sb->s_blocksize_bits;
>  	trimmed = 0;
> @@ -2100,10 +2101,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
>  		return -EINVAL;
>  	if (start >= max_blks)
>  		goto out;
> -	if (start < le32_to_cpu(es->s_first_data_block)) {
> -		len -= le32_to_cpu(es->s_first_data_block) - start;
> -		start = le32_to_cpu(es->s_first_data_block);
> -	}
>  	if (start + len > max_blks)
>  		len = max_blks - start;
>  
> -- 
> 1.6.3.GIT
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  parent reply	other threads:[~2011-01-21 15:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19  9:49 [PATCH] ext3: fix trim length underflow with small trim length Tao Ma
2011-01-19 10:42 ` Lukas Czerner
2011-01-19 11:39   ` Jan Kara
2011-01-21  2:52     ` [PATCH v2] ext3: Adjust trim start with first_data_block Tao Ma
2011-01-21 10:36       ` Lukas Czerner
2011-01-21 13:59         ` Tao Ma
2011-01-21 15:00       ` Jan Kara [this message]
2011-01-19 13:50   ` [PATCH] ext3: fix trim length underflow with small trim length Tao Ma

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=20110121150001.GD5302@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tm@tao.ma \
    /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).