From: Lukas Czerner Date: Wed, 30 Oct 2013 15:10:52 +0000 (-0400) Subject: ext4: fix FITRIM in no journal mode X-Git-Tag: v3.12.7~97 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f4890293230a3259fefa673580c45a9b4012295;p=thirdparty%2Fkernel%2Fstable.git ext4: fix FITRIM in no journal mode commit 8f9ff189205a6817aee5a1f996f876541f86e07c upstream. When using FITRIM ioctl on a file system without journal it will only trim the block group once, no matter how many times you invoke FITRIM ioctl and how many block you release from the block group. It is because we only clear EXT4_GROUP_INFO_WAS_TRIMMED_BIT in journal callback. Fix this by clearing the bit in no journal mode as well. Signed-off-by: Lukas Czerner Signed-off-by: "Theodore Ts'o" Reported-by: Jorge Fábregas Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 24a4c3c0226aa..04a5c7504be9d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4799,8 +4799,8 @@ do_more: " group:%d block:%d count:%lu failed" " with %d", block_group, bit, count, err); - } - + } else + EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info); ext4_lock_group(sb, block_group); mb_clear_bits(bitmap_bh->b_data, bit, count_clusters);