* [patch v1 0/2] Misc refactoring in XFS
@ 2026-02-06 15:37 Nirjhar Roy (IBM)
2026-02-06 15:38 ` [patch v1 1/2] xfs: Refactoring the nagcount and delta calculation Nirjhar Roy (IBM)
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Nirjhar Roy (IBM) @ 2026-02-06 15:37 UTC (permalink / raw)
To: djwong, hch, cem; +Cc: linux-xfs, ritesh.list, ojaswin, nirjhar.roy.lists
This patchset contains 2 refactorings. Details are in the patches.
Please note that the RB for patch 1 was given in [1].
[1] https://lore.kernel.org/all/20250729202428.GE2672049@frogsfrogsfrogs/
Nirjhar Roy (IBM) (2):
xfs: Refactoring the nagcount and delta calculation
xfs: Use rtg_group() wrapper in xfs_zone_gc.c
fs/xfs/libxfs/xfs_ag.c | 28 ++++++++++++++++++++++++++++
fs/xfs/libxfs/xfs_ag.h | 3 +++
fs/xfs/xfs_fsops.c | 17 ++---------------
fs/xfs/xfs_zone_gc.c | 4 ++--
4 files changed, 35 insertions(+), 17 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch v1 1/2] xfs: Refactoring the nagcount and delta calculation
2026-02-06 15:37 [patch v1 0/2] Misc refactoring in XFS Nirjhar Roy (IBM)
@ 2026-02-06 15:38 ` Nirjhar Roy (IBM)
2026-02-10 9:01 ` [patch v1 0/2] Misc refactoring in XFS Carlos Maiolino
2026-02-10 12:35 ` Nirjhar Roy (IBM)
2 siblings, 0 replies; 5+ messages in thread
From: Nirjhar Roy (IBM) @ 2026-02-06 15:38 UTC (permalink / raw)
To: djwong, hch, cem; +Cc: linux-xfs, ritesh.list, ojaswin, nirjhar.roy.lists
Introduce xfs_growfs_compute_delta() to calculate the nagcount
and delta blocks and refactor the code from xfs_growfs_data_private().
No functional changes.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
fs/xfs/libxfs/xfs_ag.c | 28 ++++++++++++++++++++++++++++
fs/xfs/libxfs/xfs_ag.h | 3 +++
fs/xfs/xfs_fsops.c | 17 ++---------------
3 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index e6ba914f6d06..f2b35d59d51e 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -872,6 +872,34 @@ xfs_ag_shrink_space(
return err2;
}
+void
+xfs_growfs_compute_deltas(
+ struct xfs_mount *mp,
+ xfs_rfsblock_t nb,
+ int64_t *deltap,
+ xfs_agnumber_t *nagcountp)
+{
+ xfs_rfsblock_t nb_div, nb_mod;
+ int64_t delta;
+ xfs_agnumber_t nagcount;
+
+ nb_div = nb;
+ nb_mod = do_div(nb_div, mp->m_sb.sb_agblocks);
+ if (nb_mod && nb_mod >= XFS_MIN_AG_BLOCKS)
+ nb_div++;
+ else if (nb_mod)
+ nb = nb_div * mp->m_sb.sb_agblocks;
+
+ if (nb_div > XFS_MAX_AGNUMBER + 1) {
+ nb_div = XFS_MAX_AGNUMBER + 1;
+ nb = nb_div * mp->m_sb.sb_agblocks;
+ }
+ nagcount = nb_div;
+ delta = nb - mp->m_sb.sb_dblocks;
+ *deltap = delta;
+ *nagcountp = nagcount;
+}
+
/*
* Extent the AG indicated by the @id by the length passed in
*/
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
index 1f24cfa27321..f7b56d486468 100644
--- a/fs/xfs/libxfs/xfs_ag.h
+++ b/fs/xfs/libxfs/xfs_ag.h
@@ -331,6 +331,9 @@ struct aghdr_init_data {
int xfs_ag_init_headers(struct xfs_mount *mp, struct aghdr_init_data *id);
int xfs_ag_shrink_space(struct xfs_perag *pag, struct xfs_trans **tpp,
xfs_extlen_t delta);
+void
+xfs_growfs_compute_deltas(struct xfs_mount *mp, xfs_rfsblock_t nb,
+ int64_t *deltap, xfs_agnumber_t *nagcountp);
int xfs_ag_extend_space(struct xfs_perag *pag, struct xfs_trans *tp,
xfs_extlen_t len);
int xfs_ag_get_geometry(struct xfs_perag *pag, struct xfs_ag_geometry *ageo);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 0ada73569394..8353e2f186f6 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -92,18 +92,17 @@ xfs_growfs_data_private(
struct xfs_growfs_data *in) /* growfs data input struct */
{
xfs_agnumber_t oagcount = mp->m_sb.sb_agcount;
+ xfs_rfsblock_t nb = in->newblocks;
struct xfs_buf *bp;
int error;
xfs_agnumber_t nagcount;
xfs_agnumber_t nagimax = 0;
- xfs_rfsblock_t nb, nb_div, nb_mod;
int64_t delta;
bool lastag_extended = false;
struct xfs_trans *tp;
struct aghdr_init_data id = {};
struct xfs_perag *last_pag;
- nb = in->newblocks;
error = xfs_sb_validate_fsb_count(&mp->m_sb, nb);
if (error)
return error;
@@ -122,20 +121,8 @@ xfs_growfs_data_private(
mp->m_sb.sb_rextsize);
if (error)
return error;
+ xfs_growfs_compute_deltas(mp, nb, &delta, &nagcount);
- nb_div = nb;
- nb_mod = do_div(nb_div, mp->m_sb.sb_agblocks);
- if (nb_mod && nb_mod >= XFS_MIN_AG_BLOCKS)
- nb_div++;
- else if (nb_mod)
- nb = nb_div * mp->m_sb.sb_agblocks;
-
- if (nb_div > XFS_MAX_AGNUMBER + 1) {
- nb_div = XFS_MAX_AGNUMBER + 1;
- nb = nb_div * mp->m_sb.sb_agblocks;
- }
- nagcount = nb_div;
- delta = nb - mp->m_sb.sb_dblocks;
/*
* Reject filesystems with a single AG because they are not
* supported, and reject a shrink operation that would cause a
--
2.43.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch v1 0/2] Misc refactoring in XFS
2026-02-06 15:37 [patch v1 0/2] Misc refactoring in XFS Nirjhar Roy (IBM)
2026-02-06 15:38 ` [patch v1 1/2] xfs: Refactoring the nagcount and delta calculation Nirjhar Roy (IBM)
@ 2026-02-10 9:01 ` Carlos Maiolino
2026-02-10 10:01 ` Nirjhar Roy (IBM)
2026-02-10 12:35 ` Nirjhar Roy (IBM)
2 siblings, 1 reply; 5+ messages in thread
From: Carlos Maiolino @ 2026-02-10 9:01 UTC (permalink / raw)
To: Nirjhar Roy (IBM); +Cc: djwong, hch, linux-xfs, ritesh.list, ojaswin
On Fri, Feb 06, 2026 at 09:07:59PM +0530, Nirjhar Roy (IBM) wrote:
> This patchset contains 2 refactorings. Details are in the patches.
> Please note that the RB for patch 1 was given in [1].
>
> [1] https://lore.kernel.org/all/20250729202428.GE2672049@frogsfrogsfrogs/
>
> Nirjhar Roy (IBM) (2):
> xfs: Refactoring the nagcount and delta calculation
> xfs: Use rtg_group() wrapper in xfs_zone_gc.c
I can only see a single patch in this series, same in lore.kernel. I'm
assuming you made some mistake when sending it.
>
> fs/xfs/libxfs/xfs_ag.c | 28 ++++++++++++++++++++++++++++
> fs/xfs/libxfs/xfs_ag.h | 3 +++
> fs/xfs/xfs_fsops.c | 17 ++---------------
> fs/xfs/xfs_zone_gc.c | 4 ++--
> 4 files changed, 35 insertions(+), 17 deletions(-)
>
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch v1 0/2] Misc refactoring in XFS
2026-02-10 9:01 ` [patch v1 0/2] Misc refactoring in XFS Carlos Maiolino
@ 2026-02-10 10:01 ` Nirjhar Roy (IBM)
0 siblings, 0 replies; 5+ messages in thread
From: Nirjhar Roy (IBM) @ 2026-02-10 10:01 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: djwong, hch, linux-xfs, ritesh.list, ojaswin
On 2/10/26 14:31, Carlos Maiolino wrote:
> On Fri, Feb 06, 2026 at 09:07:59PM +0530, Nirjhar Roy (IBM) wrote:
>> This patchset contains 2 refactorings. Details are in the patches.
>> Please note that the RB for patch 1 was given in [1].
>>
>> [1] https://lore.kernel.org/all/20250729202428.GE2672049@frogsfrogsfrogs/
>>
>> Nirjhar Roy (IBM) (2):
>> xfs: Refactoring the nagcount and delta calculation
>> xfs: Use rtg_group() wrapper in xfs_zone_gc.c
> I can only see a single patch in this series, same in lore.kernel. I'm
> assuming you made some mistake when sending it.
No, not a mistake really. After patch 0/2 and 1/2 was sent, gmail for
some reason blocked patch 2/2 - since then I have tried multiple times
to send it, but it is repeatedly getting blocked. I am still in the
process of figuring this out. The 2 patches are independent, so if you
want, you can look at patch 1/2 for now. I am checking as to why is the
second patch getting blocked by gmail. Also, if you have any idea as to
why some specific patch/patch-file can getting blocked, maybe can you
please shed some light (I have verfied that I am able to send other
patches/patch-files, only the patch 2/2 is getting blocked).
--NR
>
>> fs/xfs/libxfs/xfs_ag.c | 28 ++++++++++++++++++++++++++++
>> fs/xfs/libxfs/xfs_ag.h | 3 +++
>> fs/xfs/xfs_fsops.c | 17 ++---------------
>> fs/xfs/xfs_zone_gc.c | 4 ++--
>> 4 files changed, 35 insertions(+), 17 deletions(-)
>>
>> --
>> 2.43.5
>>
--
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch v1 0/2] Misc refactoring in XFS
2026-02-06 15:37 [patch v1 0/2] Misc refactoring in XFS Nirjhar Roy (IBM)
2026-02-06 15:38 ` [patch v1 1/2] xfs: Refactoring the nagcount and delta calculation Nirjhar Roy (IBM)
2026-02-10 9:01 ` [patch v1 0/2] Misc refactoring in XFS Carlos Maiolino
@ 2026-02-10 12:35 ` Nirjhar Roy (IBM)
2 siblings, 0 replies; 5+ messages in thread
From: Nirjhar Roy (IBM) @ 2026-02-10 12:35 UTC (permalink / raw)
To: djwong, hch, cem; +Cc: linux-xfs, ritesh.list, ojaswin
On Fri, 2026-02-06 at 21:07 +0530, Nirjhar Roy (IBM) wrote:
> This patchset contains 2 refactorings. Details are in the patches.
> Please note that the RB for patch 1 was given in [1].
Please ignore this series - there was some technical glitch in gmail while I was trying to send it.
I have re-sent in [2].
[2] - https://lore.kernel.org/all/cover.1770725429.git.nirjhar.roy.lists@gmail.com/
--NR
>
> [1] https://lore.kernel.org/all/20250729202428.GE2672049@frogsfrogsfrogs/
>
> Nirjhar Roy (IBM) (2):
> xfs: Refactoring the nagcount and delta calculation
> xfs: Use rtg_group() wrapper in xfs_zone_gc.c
>
> fs/xfs/libxfs/xfs_ag.c | 28 ++++++++++++++++++++++++++++
> fs/xfs/libxfs/xfs_ag.h | 3 +++
> fs/xfs/xfs_fsops.c | 17 ++---------------
> fs/xfs/xfs_zone_gc.c | 4 ++--
> 4 files changed, 35 insertions(+), 17 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-10 12:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 15:37 [patch v1 0/2] Misc refactoring in XFS Nirjhar Roy (IBM)
2026-02-06 15:38 ` [patch v1 1/2] xfs: Refactoring the nagcount and delta calculation Nirjhar Roy (IBM)
2026-02-10 9:01 ` [patch v1 0/2] Misc refactoring in XFS Carlos Maiolino
2026-02-10 10:01 ` Nirjhar Roy (IBM)
2026-02-10 12:35 ` Nirjhar Roy (IBM)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox