aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2011-01-20 21:52:56 -0500
committerJan Kara <jack@suse.cz>2011-02-24 05:42:45 -0500
commit4b44dd300d5bfd500f170bae13f95f589de0b28f (patch)
tree2add4705a56c0fc665029baa122e466359c56eb2 /fs/ext3
parent7a39de1510a3fd07a77530440292735d305fe510 (diff)
ext3: Adjust trim start with first_data_block.
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 <jack@suse.cz> Cc: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/balloc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 045995c8ce5a..5b8344fab79d 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -2090,7 +2090,8 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2090 ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count); 2090 ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count);
2091 int ret = 0; 2091 int ret = 0;
2092 2092
2093 start = range->start >> sb->s_blocksize_bits; 2093 start = (range->start >> sb->s_blocksize_bits) +
2094 le32_to_cpu(es->s_first_data_block);
2094 len = range->len >> sb->s_blocksize_bits; 2095 len = range->len >> sb->s_blocksize_bits;
2095 minlen = range->minlen >> sb->s_blocksize_bits; 2096 minlen = range->minlen >> sb->s_blocksize_bits;
2096 trimmed = 0; 2097 trimmed = 0;
@@ -2099,10 +2100,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
2099 return -EINVAL; 2100 return -EINVAL;
2100 if (start >= max_blks) 2101 if (start >= max_blks)
2101 goto out; 2102 goto out;
2102 if (start < le32_to_cpu(es->s_first_data_block)) {
2103 len -= le32_to_cpu(es->s_first_data_block) - start;
2104 start = le32_to_cpu(es->s_first_data_block);
2105 }
2106 if (start + len > max_blks) 2103 if (start + len > max_blks)
2107 len = max_blks - start; 2104 len = max_blks - start;
2108 2105