From: Shida Zhang <zhangshida@kylinos.cn>
Add two member to support the AF(alloction field) for each *mp*,
which means now we can have 3 AFs at most:
[ 0, AF[0] )
[ AF[0], AF[1] )
[ AF[1], m_sb.agcount )
where AF[N],
start agno of the AF[N] = mp->m_sb.agcount - mp->m_af[N]
On default,
[ 0, m_sb.agcount)
[ m_sb.agcount, m_sb.agcount )
[ m_sb.agcount, m_sb.agcount )
That means the entire filesystem can be deemed as a AF 0 extending
from 0 to m_sb.agcount.
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
fs/xfs/xfs_mount.h | 3 +++
fs/xfs/xfs_super.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 96496f39f551..38dff08b467d 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -260,6 +260,9 @@ typedef struct xfs_mount {
/* Hook to feed dirent updates to an active online repair. */
struct xfs_hooks m_dir_update_hooks;
+
+ /* Relative start agno of the AFs */
+ xfs_agnumber_t m_af[2];
} xfs_mount_t;
#define M_IGEO(mp) (&(mp)->m_ino_geo)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index fbb3a1594c0d..0975ad55557e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -2040,6 +2040,8 @@ static int xfs_init_fs_context(
mp->m_logbufs = -1;
mp->m_logbsize = -1;
mp->m_allocsize_log = 16; /* 64k */
+ mp->m_af[0] = 0;
+ mp->m_af[1] = 0;
xfs_hooks_init(&mp->m_dir_update_hooks);
--
2.33.0