Patch "Revert "f2fs: do not issue small discard commands during checkpoint"" has been added to the 6.5-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

    Revert "f2fs: do not issue small discard commands during checkpoint"

to the 6.5-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:
     revert-f2fs-do-not-issue-small-discard-commands-duri.patch
and it can be found in the queue-6.5 subdirectory.

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



commit 2406e1d22510c3d24cdd20a4331c0fdcf4b05fe7
Author: Chao Yu <chao@xxxxxxxxxx>
Date:   Sun Jul 30 22:25:52 2023 +0800

    Revert "f2fs: do not issue small discard commands during checkpoint"
    
    [ Upstream commit 005abf9e5e0d4dcfce318ae5dbcac32b7bf6b647 ]
    
    Previously, we have two mechanisms to cache & submit small discards:
    
    a) set max small discard number in /sys/fs/f2fs/vdb/max_small_discards,
    and checkpoint will cache small discard candidates w/ configured maximum
    number.
    
    b) call FITRIM ioctl, also, checkpoint in f2fs_trim_fs() will cache small
    discard candidates w/ configured discard granularity, but w/o limitation
    of number. FSTRIM interface is asynchronized, so it won't submit discard
    directly.
    
    Finally, discard thread will submit them in background periodically.
    
    However, after commit 9ac00e7cef10 ("f2fs: do not issue small discard
    commands during checkpoint"), the mechanism a) is broken, since no matter
    how we configure the sysfs entry /sys/fs/f2fs/vdb/max_small_discards,
    checkpoint will not cache small discard candidates any more.
    
    echo 0 > /sys/fs/f2fs/vdb/max_small_discards
    xfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync"
    xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
    sync
    cat /proc/fs/f2fs/vdb/discard_plist_info |head -2
    
    echo 100 > /sys/fs/f2fs/vdb/max_small_discards
    rm /mnt/f2fs/file
    xfs_io -f /mnt/f2fs/file -c "pwrite 0 2m" -c "fsync"
    xfs_io /mnt/f2fs/file -c "fpunch 0 4k"
    sync
    cat /proc/fs/f2fs/vdb/discard_plist_info |head -2
    
    Before the patch:
    Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
      0         .       .       .       .       .       .       .       .
    Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
      0         3       1       .       .       .       .       .       .
    
    After the patch:
    Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
      0         .       .       .       .       .       .       .       .
    Discard pend list(Show diacrd_cmd count on each entry, .:not exist):
      0         .       .       .       .       .       .       .       .
    
    This patch reverts commit 9ac00e7cef10 ("f2fs: do not issue small discard
    commands during checkpoint") in order to fix this issue.
    
    Fixes: 9ac00e7cef10 ("f2fs: do not issue small discard commands during checkpoint")
    Signed-off-by: Chao Yu <chao@xxxxxxxxxx>
    Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index a31a47b066d1d..be08be6f4bfd6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2211,7 +2211,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
 			len = next_pos - cur_pos;
 
 			if (f2fs_sb_has_blkzoned(sbi) ||
-					!force || len < cpc->trim_minlen)
+			    (force && len < cpc->trim_minlen))
 				goto skip;
 
 			f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,



[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