summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_rtbitmap.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-09-21 09:50:02 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-10-14 14:17:08 -0700
commita29c734ba073e6b3bad5350bf5e8823b12c580e4 (patch)
tree5a8c58f4d1e1999a470e9036c5cbe8345c67beac /fs/xfs/libxfs/xfs_rtbitmap.c
parentac30d908265b4c284112cf1f812f8f3391d12163 (diff)
xfs: use accessor functions for summary info wordsrefactor-rtbitmap-macros_2022-10-14
Create get and set functions for rtsummary words so that we can redefine the ondisk format with a specific endianness. Note that this requires the definition of a distinct type for ondisk summary info words so that the compiler can perform proper typechecking. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_rtbitmap.c')
-rw-r--r--fs/xfs/libxfs/xfs_rtbitmap.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c
index be5c793da46c..b74261abd238 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.c
+++ b/fs/xfs/libxfs/xfs_rtbitmap.c
@@ -466,6 +466,23 @@ xfs_rtfind_forw(
return 0;
}
+inline xfs_suminfo_t
+xfs_suminfo_get(
+ struct xfs_mount *mp,
+ union xfs_suminfo_ondisk *infoptr)
+{
+ return infoptr->raw;
+}
+
+inline void
+xfs_suminfo_add(
+ struct xfs_mount *mp,
+ union xfs_suminfo_ondisk *infoptr,
+ int delta)
+{
+ infoptr->raw += delta;
+}
+
/*
* Read and/or modify the summary information for a given extent size,
* bitmap block combination.
@@ -490,7 +507,7 @@ xfs_rtmodify_summary_int(
int error; /* error value */
xfs_fileoff_t sb; /* summary fsblock */
xfs_rtsumoff_t so; /* index into the summary file */
- xfs_suminfo_t *sp; /* pointer to returned data */
+ union xfs_suminfo_ondisk *sp; /* pointer to returned data */
unsigned int infoword;
/*
@@ -533,17 +550,17 @@ xfs_rtmodify_summary_int(
if (delta) {
uint first = (uint)((char *)sp - (char *)bp->b_addr);
- *sp += delta;
+ xfs_suminfo_add(mp, sp, delta);
if (mp->m_rsum_cache) {
- if (*sp == 0 && log == mp->m_rsum_cache[bbno])
+ if (sp->raw == 0 && log == mp->m_rsum_cache[bbno])
mp->m_rsum_cache[bbno]++;
- if (*sp != 0 && log < mp->m_rsum_cache[bbno])
+ if (sp->raw != 0 && log < mp->m_rsum_cache[bbno])
mp->m_rsum_cache[bbno] = log;
}
xfs_trans_log_buf(tp, bp, first, first + sizeof(*sp) - 1);
}
if (sum)
- *sum = *sp;
+ *sum = xfs_suminfo_get(mp, sp);
return 0;
}