Merge tag 'xfs-fixes-6.19-rc6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Carlos Maiolino:
 "Just a few obvious fixes and some 'cosmetic' changes"

* tag 'xfs-fixes-6.19-rc6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: set max_agbno to allow sparse alloc of last full inode chunk
  xfs: Fix xfs_grow_last_rtg()
  xfs: improve the assert at the top of xfs_log_cover
  xfs: fix an overly long line in xfs_rtgroup_calc_geometry
  xfs: mark __xfs_rtgroup_extents static
  xfs: Fix the return value of xfs_rtcopy_summary()
  xfs: fix memory leak in xfs_growfs_check_rtgeom()
This commit is contained in:
Linus Torvalds
2026-01-16 09:09:41 -08:00
5 changed files with 41 additions and 39 deletions

View File

@@ -848,15 +848,16 @@ sparse_alloc:
* invalid inode records, such as records that start at agbno 0
* or extend beyond the AG.
*
* Set min agbno to the first aligned, non-zero agbno and max to
* the last aligned agbno that is at least one full chunk from
* the end of the AG.
* Set min agbno to the first chunk aligned, non-zero agbno and
* max to one less than the last chunk aligned agbno from the
* end of the AG. We subtract 1 from max so that the cluster
* allocation alignment takes over and allows allocation within
* the last full inode chunk in the AG.
*/
args.min_agbno = args.mp->m_sb.sb_inoalignmt;
args.max_agbno = round_down(xfs_ag_block_count(args.mp,
pag_agno(pag)),
args.mp->m_sb.sb_inoalignmt) -
igeo->ialloc_blks;
args.mp->m_sb.sb_inoalignmt) - 1;
error = xfs_alloc_vextent_near_bno(&args,
xfs_agbno_to_fsb(pag,

View File

@@ -48,6 +48,31 @@ xfs_rtgroup_min_block(
return 0;
}
/* Compute the number of rt extents in this realtime group. */
static xfs_rtxnum_t
__xfs_rtgroup_extents(
struct xfs_mount *mp,
xfs_rgnumber_t rgno,
xfs_rgnumber_t rgcount,
xfs_rtbxlen_t rextents)
{
ASSERT(rgno < rgcount);
if (rgno == rgcount - 1)
return rextents - ((xfs_rtxnum_t)rgno * mp->m_sb.sb_rgextents);
ASSERT(xfs_has_rtgroups(mp));
return mp->m_sb.sb_rgextents;
}
xfs_rtxnum_t
xfs_rtgroup_extents(
struct xfs_mount *mp,
xfs_rgnumber_t rgno)
{
return __xfs_rtgroup_extents(mp, rgno, mp->m_sb.sb_rgcount,
mp->m_sb.sb_rextents);
}
/* Precompute this group's geometry */
void
xfs_rtgroup_calc_geometry(
@@ -58,7 +83,8 @@ xfs_rtgroup_calc_geometry(
xfs_rtbxlen_t rextents)
{
rtg->rtg_extents = __xfs_rtgroup_extents(mp, rgno, rgcount, rextents);
rtg_group(rtg)->xg_block_count = rtg->rtg_extents * mp->m_sb.sb_rextsize;
rtg_group(rtg)->xg_block_count =
rtg->rtg_extents * mp->m_sb.sb_rextsize;
rtg_group(rtg)->xg_min_gbno = xfs_rtgroup_min_block(mp, rgno);
}
@@ -136,31 +162,6 @@ out_unwind_new_rtgs:
return error;
}
/* Compute the number of rt extents in this realtime group. */
xfs_rtxnum_t
__xfs_rtgroup_extents(
struct xfs_mount *mp,
xfs_rgnumber_t rgno,
xfs_rgnumber_t rgcount,
xfs_rtbxlen_t rextents)
{
ASSERT(rgno < rgcount);
if (rgno == rgcount - 1)
return rextents - ((xfs_rtxnum_t)rgno * mp->m_sb.sb_rgextents);
ASSERT(xfs_has_rtgroups(mp));
return mp->m_sb.sb_rgextents;
}
xfs_rtxnum_t
xfs_rtgroup_extents(
struct xfs_mount *mp,
xfs_rgnumber_t rgno)
{
return __xfs_rtgroup_extents(mp, rgno, mp->m_sb.sb_rgcount,
mp->m_sb.sb_rextents);
}
/*
* Update the rt extent count of the previous tail rtgroup if it changed during
* recovery (i.e. recovery of a growfs).

View File

@@ -285,8 +285,6 @@ void xfs_free_rtgroups(struct xfs_mount *mp, xfs_rgnumber_t first_rgno,
int xfs_initialize_rtgroups(struct xfs_mount *mp, xfs_rgnumber_t first_rgno,
xfs_rgnumber_t end_rgno, xfs_rtbxlen_t rextents);
xfs_rtxnum_t __xfs_rtgroup_extents(struct xfs_mount *mp, xfs_rgnumber_t rgno,
xfs_rgnumber_t rgcount, xfs_rtbxlen_t rextents);
xfs_rtxnum_t xfs_rtgroup_extents(struct xfs_mount *mp, xfs_rgnumber_t rgno);
void xfs_rtgroup_calc_geometry(struct xfs_mount *mp, struct xfs_rtgroup *rtg,
xfs_rgnumber_t rgno, xfs_rgnumber_t rgcount,

View File

@@ -1180,9 +1180,11 @@ xfs_log_cover(
int error = 0;
bool need_covered;
ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
!xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
xlog_is_shutdown(mp->m_log));
if (!xlog_is_shutdown(mp->m_log)) {
ASSERT(xlog_cil_empty(mp->m_log));
ASSERT(xlog_iclogs_empty(mp->m_log));
ASSERT(!xfs_ail_min_lsn(mp->m_log->l_ailp));
}
if (!xfs_log_writable(mp))
return 0;

View File

@@ -126,7 +126,7 @@ xfs_rtcopy_summary(
error = 0;
out:
xfs_rtbuf_cache_relse(oargs);
return 0;
return error;
}
/*
* Mark an extent specified by start and len allocated.
@@ -1265,7 +1265,7 @@ xfs_growfs_check_rtgeom(
uint32_t rem;
if (rextsize != 1)
return -EINVAL;
goto out_inval;
div_u64_rem(nmp->m_sb.sb_rblocks, gblocks, &rem);
if (rem) {
xfs_warn(mp,
@@ -1326,7 +1326,7 @@ xfs_grow_last_rtg(
return true;
if (mp->m_sb.sb_rgcount == 0)
return false;
return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <=
return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <
mp->m_sb.sb_rgextents;
}