ext4: fix FITRIM in no journal mode

Submitted by Lukas Czerner on Sept. 25, 2013, 9:46 a.m.

Details

Message ID 1380102385-10475-1-git-send-email-lczerner@redhat.com
State Accepted, archived
Headers show

Commit Message

Lukas Czerner Sept. 25, 2013, 9:46 a.m.
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>
Reported-by: Jorge Fábregas <jorge.fabregas@gmail.com>
---
 fs/ext4/mballoc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Theodore Ts'o Oct. 30, 2013, 3:12 p.m.
On Wed, Sep 25, 2013 at 11:46:25AM +0200, Lukas Czerner wrote:
> 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>
> Reported-by: Jorge Fábregas <jorge.fabregas@gmail.com>

Applied, thanks.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index a41e3ba..4d113ef 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -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);