From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: djwong@kernel.org, sandeen@sandeen.net
Subject: [RFC 2/4] xfs: transaction support for sb_agblocks updates
Date: Tue, 8 Oct 2024 09:13:46 -0400 [thread overview]
Message-ID: <20241008131348.81013-3-bfoster@redhat.com> (raw)
In-Reply-To: <20241008131348.81013-1-bfoster@redhat.com>
Support transactional changes to superblock agblocks and related
fields.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/libxfs/xfs_shared.h | 1 +
fs/xfs/xfs_trans.c | 15 +++++++++++++++
fs/xfs/xfs_trans.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
index 33b84a3a83ff..b8e80827a010 100644
--- a/fs/xfs/libxfs/xfs_shared.h
+++ b/fs/xfs/libxfs/xfs_shared.h
@@ -157,6 +157,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp,
#define XFS_TRANS_SB_RBLOCKS 0x00000800
#define XFS_TRANS_SB_REXTENTS 0x00001000
#define XFS_TRANS_SB_REXTSLOG 0x00002000
+#define XFS_TRANS_SB_AGBLOCKS 0x00004000
/*
* Here we centralize the specification of XFS meta-data buffer reference count
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index bdf3704dc301..34a9896ec398 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -433,6 +433,9 @@ xfs_trans_mod_sb(
case XFS_TRANS_SB_DBLOCKS:
tp->t_dblocks_delta += delta;
break;
+ case XFS_TRANS_SB_AGBLOCKS:
+ tp->t_agblocks_delta += delta;
+ break;
case XFS_TRANS_SB_AGCOUNT:
ASSERT(delta > 0);
tp->t_agcount_delta += delta;
@@ -526,6 +529,16 @@ xfs_trans_apply_sb_deltas(
be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta);
whole = 1;
}
+ if (tp->t_agblocks_delta) {
+ xfs_agblock_t agblocks;
+
+ agblocks = be32_to_cpu(sbp->sb_agblocks);
+ agblocks += tp->t_agblocks_delta;
+
+ sbp->sb_agblocks = cpu_to_be32(agblocks);
+ sbp->sb_agblklog = ilog2(roundup_pow_of_two(agblocks));
+ whole = 1;
+ }
if (tp->t_agcount_delta) {
be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta);
whole = 1;
@@ -657,6 +670,8 @@ xfs_trans_unreserve_and_mod_sb(
* incore reservations.
*/
mp->m_sb.sb_dblocks += tp->t_dblocks_delta;
+ mp->m_sb.sb_agblocks += tp->t_agblocks_delta;
+ mp->m_sb.sb_agblklog = ilog2(roundup_pow_of_two(mp->m_sb.sb_agblocks));
mp->m_sb.sb_agcount += tp->t_agcount_delta;
mp->m_sb.sb_imax_pct += tp->t_imaxpct_delta;
mp->m_sb.sb_rextsize += tp->t_rextsize_delta;
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index f06cc0f41665..11462406988d 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -141,6 +141,7 @@ typedef struct xfs_trans {
int64_t t_frextents_delta;/* superblock freextents chg*/
int64_t t_res_frextents_delta; /* on-disk only chg */
int64_t t_dblocks_delta;/* superblock dblocks change */
+ int64_t t_agblocks_delta;/* superblock agblocks change */
int64_t t_agcount_delta;/* superblock agcount change */
int64_t t_imaxpct_delta;/* superblock imaxpct change */
int64_t t_rextsize_delta;/* superblock rextsize chg */
--
2.46.2
next prev parent reply other threads:[~2024-10-08 13:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 13:13 [RFC 0/4] xfs: prototype dynamic AG size grow for image mode Brian Foster
2024-10-08 13:13 ` [RFC 1/4] xfs: factor out sb_agblocks usage in growfs Brian Foster
2024-10-08 13:13 ` Brian Foster [this message]
2024-10-09 8:05 ` [RFC 2/4] xfs: transaction support for sb_agblocks updates Christoph Hellwig
2024-10-09 12:38 ` Brian Foster
2024-10-09 12:44 ` Christoph Hellwig
2024-10-08 13:13 ` [RFC 3/4] xfs: factor out a helper to calculate post-growfs agcount Brian Foster
2024-10-08 13:13 ` [RFC 4/4] xfs: support dynamic AG size growing on single AG filesystems Brian Foster
2024-10-08 13:25 ` [PATCH] xfsprogs/mkfs: prototype XFS image mode format for scalable AG growth Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241008131348.81013-3-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.