diff options
author | Omar Sandoval <osandov@fb.com> | 2024-02-15 09:27:53 +0100 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2024-02-15 12:56:43 +0100 |
commit | 35c3aa608b5b00492e6b99354fe0af52fabb266c (patch) | |
tree | de5ea1fdbd9554db801ff1513daee9d72d2d4ad9 | |
parent | 93b4decb38f19be0c804f4dbaab07bc7fbf56790 (diff) | |
download | xfsprogs-dev-35c3aa608b5b00492e6b99354fe0af52fabb266c.tar.gz |
xfs: invert the realtime summary cache
Source kernel commit: e23aaf450de733044a74bc95528f728478b61c2a
In commit 355e3532132b ("xfs: cache minimum realtime summary level"), I
added a cache of the minimum level of the realtime summary that has any
free extents. However, it turns out that the _maximum_ level is more
useful for upcoming optimizations, and basically equivalent for the
existing usage. So, let's change the meaning of the cache to be the
maximum level + 1, or 0 if there are no free extents.
For example, if the cache contains:
{0, 4}
then there are no free extents starting in realtime bitmap block 0, and
there are no free extents larger than or equal to 2^4 blocks starting in
realtime bitmap block 1. The cache is a loose upper bound, so there may
or may not be free extents smaller than 2^4 blocks in realtime bitmap
block 1.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | libxfs/xfs_rtbitmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c index f5d7e14abf..8f313339e9 100644 --- a/libxfs/xfs_rtbitmap.c +++ b/libxfs/xfs_rtbitmap.c @@ -493,10 +493,10 @@ xfs_rtmodify_summary_int( xfs_suminfo_t val = xfs_suminfo_add(args, infoword, delta); if (mp->m_rsum_cache) { - if (val == 0 && log == mp->m_rsum_cache[bbno]) - mp->m_rsum_cache[bbno]++; - if (val != 0 && log < mp->m_rsum_cache[bbno]) + if (val == 0 && log + 1 == mp->m_rsum_cache[bbno]) mp->m_rsum_cache[bbno] = log; + if (val != 0 && log >= mp->m_rsum_cache[bbno]) + mp->m_rsum_cache[bbno] = log + 1; } xfs_trans_log_rtsummary(args, infoword); if (sum) |