Patch "ext4: clear EXT4_GROUP_INFO_WAS_TRIMMED_BIT even mount with discard" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ext4: clear EXT4_GROUP_INFO_WAS_TRIMMED_BIT even mount with discard

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ext4-clear-ext4_group_info_was_trimmed_bit-even-moun.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 802cbc2138a624c172579e4d70285c6dc74959c5
Author: yangerkun <yangerkun@xxxxxxxxxx>
Date:   Sat Aug 17 16:55:10 2024 +0800

    ext4: clear EXT4_GROUP_INFO_WAS_TRIMMED_BIT even mount with discard
    
    [ Upstream commit 20cee68f5b44fdc2942d20f3172a262ec247b117 ]
    
    Commit 3d56b8d2c74c ("ext4: Speed up FITRIM by recording flags in
    ext4_group_info") speed up fstrim by skipping trim trimmed group. We
    also has the chance to clear trimmed once there exists some block free
    for this group(mount without discard), and the next trim for this group
    will work well too.
    
    For mount with discard, we will issue dicard when we free blocks, so
    leave trimmed flag keep alive to skip useless trim trigger from
    userspace seems reasonable. But for some case like ext4 build on
    dm-thinpool(ext4 blocksize 4K, pool blocksize 128K), discard from ext4
    maybe unaligned for dm thinpool, and thinpool will just finish this
    discard(see process_discard_bio when begein equals to end) without
    actually process discard. For this case, trim from userspace can really
    help us to free some thinpool block.
    
    So convert to clear trimmed flag for all case no matter mounted with
    discard or not.
    
    Fixes: 3d56b8d2c74c ("ext4: Speed up FITRIM by recording flags in ext4_group_info")
    Signed-off-by: yangerkun <yangerkun@xxxxxxxxxx>
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Link: https://patch.msgid.link/20240817085510.2084444-1-yangerkun@xxxxxxxxxxxxxxx
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7cbbcee225ddd..990d8031bed6e 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3176,11 +3176,8 @@ static void ext4_free_data_in_buddy(struct super_block *sb,
 	/*
 	 * Clear the trimmed flag for the group so that the next
 	 * ext4_trim_fs can trim it.
-	 * If the volume is mounted with -o discard, online discard
-	 * is supported and the free blocks will be trimmed online.
 	 */
-	if (!test_opt(sb, DISCARD))
-		EXT4_MB_GRP_CLEAR_TRIMMED(db);
+	EXT4_MB_GRP_CLEAR_TRIMMED(db);
 
 	if (!db->bb_free_root.rb_node) {
 		/* No more items in the per group rb tree
@@ -5589,8 +5586,9 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
 					 " group:%u block:%d count:%lu failed"
 					 " with %d", block_group, bit, count,
 					 err);
-		} else
-			EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info);
+		}
+
+		EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info);
 
 		ext4_lock_group(sb, block_group);
 		mb_clear_bits(bitmap_bh->b_data, bit, count_clusters);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux