From b98bf57ee462519716296952f226c8a88fb308fe Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Tue, 11 Jan 2011 16:46:22 +0100 Subject: [PATCH] linux: add patch for failed fstrim command Signed-off-by: Stephan Raue --- .../patches/linux-2.6.37-071-fstrim-0.1.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/linux/patches/linux-2.6.37-071-fstrim-0.1.patch diff --git a/packages/linux/patches/linux-2.6.37-071-fstrim-0.1.patch b/packages/linux/patches/linux-2.6.37-071-fstrim-0.1.patch new file mode 100644 index 0000000000..f0f2259e80 --- /dev/null +++ b/packages/linux/patches/linux-2.6.37-071-fstrim-0.1.patch @@ -0,0 +1,23 @@ +diff -Naur linux-2.6.37/fs/ext4/mballoc.c linux-2.6.37.patch/fs/ext4/mballoc.c +--- linux-2.6.37/fs/ext4/mballoc.c 2011-01-05 01:50:19.000000000 +0100 ++++ linux-2.6.37.patch/fs/ext4/mballoc.c 2011-01-11 16:40:40.592434028 +0100 +@@ -4819,6 +4819,8 @@ + ext4_group_t group, ngroups = ext4_get_groups_count(sb); + ext4_grpblk_t cnt = 0, first_block, last_block; + uint64_t start, len, minlen, trimmed; ++ ext4_fsblk_t first_data_blk = ++ le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); + int ret = 0; + + start = range->start >> sb->s_blocksize_bits; +@@ -4828,6 +4830,10 @@ + + if (unlikely(minlen > EXT4_BLOCKS_PER_GROUP(sb))) + return -EINVAL; ++ if (start < first_data_blk) { ++ len -= first_data_blk - start; ++ start = first_data_blk; ++ } + + /* Determine first and last group to examine based on start and len */ + ext4_get_group_no_and_offset(sb, (ext4_fsblk_t) start,