ext4: fix FITRIM in no journal mode
authorLukas Czerner <lczerner@redhat.com>
Wed, 30 Oct 2013 15:10:52 +0000 (11:10 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 30 Oct 2013 15:10:52 +0000 (11:10 -0400)
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 <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Jorge Fábregas <jorge.fabregas@gmail.com>
fs/ext4/mballoc.c

index a41e3ba8cfaa416b50f639e8e7b184f0439ab1fb..4d113efa024c8439f4000a0fa59ed643f2489166 100644 (file)
@@ -4794,8 +4794,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);