From patchwork Fri Jan 21 02:52:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ma X-Patchwork-Id: 79787 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 34617B6F1E for ; Fri, 21 Jan 2011 13:53:26 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104Ab1AUCxY (ORCPT ); Thu, 20 Jan 2011 21:53:24 -0500 Received: from oproxy3-pub.bluehost.com ([69.89.21.8]:51678 "HELO oproxy3-pub.bluehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752057Ab1AUCxY (ORCPT ); Thu, 20 Jan 2011 21:53:24 -0500 Received: (qmail 24260 invoked by uid 0); 21 Jan 2011 02:53:23 -0000 Received: from unknown (HELO box585.bluehost.com) (66.147.242.185) by oproxy3.bluehost.com with SMTP; 21 Jan 2011 02:53:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=tao.ma; h=Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:X-Identified-User; b=rlS6LOCZUTpZO8ybHWshpvy9RdKiAdKNgxgxJABU7Hy/2Dzvv66x0FVGPHK9soa7mxAF9jKZr57Q8x6NG35aOHAyrKGTJWOa2xR9YzYnGSpFE4+XYwO+r8FzKKdCIpsn; Received: from [114.251.86.0] (helo=taoma-linux.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Pg77q-0003EZ-VR; Thu, 20 Jan 2011 19:53:23 -0700 From: Tao Ma To: linux-ext4@vger.kernel.org Cc: Jan Kara , Lukas Czerner Subject: [PATCH v2] ext3: Adjust trim start with first_data_block. Date: Fri, 21 Jan 2011 10:52:56 +0800 Message-Id: <1295578376-3914-1-git-send-email-tm@tao.ma> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20110119113921.GA4246@quack.suse.cz> References: <20110119113921.GA4246@quack.suse.cz> X-Identified-User: {1390:box585.bluehost.com:colyli:tao.ma} {sentby:smtp auth 114.251.86.0 authed with tm@tao.ma} Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Tao Ma 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 Cc: Jan Kara Cc: Lukas Czerner Signed-off-by: Tao Ma --- 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;