mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
xfs: don't skip free extents of the longest length in a whole-AG FITRIM
Since commita66d636385("xfs: fix fstrim offset calculations"), the by-length walk of an AG in FITRIM starts with xfs_alloc_lookup_ge(cur, 0, pagf_longest) and walks down. The lookup lands on the longest free extent with the lowest block number. The other free extents of that length sort after it and are never discarded. Start every by-length batch with xfs_alloc_lookup_le() at restart_bno. Suggested-by: Dave Chinner <dgc@kernel.org> Link: https://lore.kernel.org/r/ZgiJWxVcVwag0fIP@dread.disaster.area Cc: stable@vger.kernel.org Fixes:a66d636385("xfs: fix fstrim offset calculations") Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
595e67d726
commit
5745f4f10a
|
|
@ -200,12 +200,12 @@ xfs_trim_gather_extents(
|
|||
error = xfs_alloc_lookup_le(cur, tcur->start, 0, &i);
|
||||
if (!error && !i)
|
||||
error = xfs_alloc_lookup_ge(cur, tcur->start, 0, &i);
|
||||
} else if (tcur->restart_bno == NULLAGBLOCK) {
|
||||
/* first time through a by-len starts with max length */
|
||||
cur = xfs_cntbt_init_cursor(mp, tp, agbp, pag);
|
||||
error = xfs_alloc_lookup_ge(cur, 0, tcur->count, &i);
|
||||
} else {
|
||||
/* nth time through a by-len starts where we left off */
|
||||
/*
|
||||
* A by-len walk starts at the last record of the longest
|
||||
* length (restart_bno is NULLAGBLOCK until the first batch
|
||||
* ends) and then where the previous batch stopped.
|
||||
*/
|
||||
cur = xfs_cntbt_init_cursor(mp, tp, agbp, pag);
|
||||
error = xfs_alloc_lookup_le(cur, tcur->restart_bno,
|
||||
tcur->count, &i);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user