Patchwork ext4: fix FITRIM in no journal mode

login
register
mail settings
Submitter Lukas Czerner
Date Sept. 25, 2013, 9:46 a.m.
Message ID <1380102385-10475-1-git-send-email-lczerner@redhat.com>
Download mbox | patch
Permalink /patch/277765/
State Awaiting Upstream
Headers show

Comments

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(-)
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

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);