Skip to content

Commit 353c6f4

Browse files
committed
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()
2 parents 983d014 + c360004 commit 353c6f4

5 files changed

Lines changed: 41 additions & 39 deletions

File tree

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -848,15 +848,16 @@ xfs_ialloc_ag_alloc(
848848
* invalid inode records, such as records that start at agbno 0
849849
* or extend beyond the AG.
850850
*
851-
* Set min agbno to the first aligned, non-zero agbno and max to
852-
* the last aligned agbno that is at least one full chunk from
853-
* the end of the AG.
851+
* Set min agbno to the first chunk aligned, non-zero agbno and
852+
* max to one less than the last chunk aligned agbno from the
853+
* end of the AG. We subtract 1 from max so that the cluster
854+
* allocation alignment takes over and allows allocation within
855+
* the last full inode chunk in the AG.
854856
*/
855857
args.min_agbno = args.mp->m_sb.sb_inoalignmt;
856858
args.max_agbno = round_down(xfs_ag_block_count(args.mp,
857859
pag_agno(pag)),
858-
args.mp->m_sb.sb_inoalignmt) -
859-
igeo->ialloc_blks;
860+
args.mp->m_sb.sb_inoalignmt) - 1;
860861

861862
error = xfs_alloc_vextent_near_bno(&args,
862863
xfs_agbno_to_fsb(pag,

fs/xfs/libxfs/xfs_rtgroup.c

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,31 @@ xfs_rtgroup_min_block(
4848
return 0;
4949
}
5050

51+
/* Compute the number of rt extents in this realtime group. */
52+
static xfs_rtxnum_t
53+
__xfs_rtgroup_extents(
54+
struct xfs_mount *mp,
55+
xfs_rgnumber_t rgno,
56+
xfs_rgnumber_t rgcount,
57+
xfs_rtbxlen_t rextents)
58+
{
59+
ASSERT(rgno < rgcount);
60+
if (rgno == rgcount - 1)
61+
return rextents - ((xfs_rtxnum_t)rgno * mp->m_sb.sb_rgextents);
62+
63+
ASSERT(xfs_has_rtgroups(mp));
64+
return mp->m_sb.sb_rgextents;
65+
}
66+
67+
xfs_rtxnum_t
68+
xfs_rtgroup_extents(
69+
struct xfs_mount *mp,
70+
xfs_rgnumber_t rgno)
71+
{
72+
return __xfs_rtgroup_extents(mp, rgno, mp->m_sb.sb_rgcount,
73+
mp->m_sb.sb_rextents);
74+
}
75+
5176
/* Precompute this group's geometry */
5277
void
5378
xfs_rtgroup_calc_geometry(
@@ -58,7 +83,8 @@ xfs_rtgroup_calc_geometry(
5883
xfs_rtbxlen_t rextents)
5984
{
6085
rtg->rtg_extents = __xfs_rtgroup_extents(mp, rgno, rgcount, rextents);
61-
rtg_group(rtg)->xg_block_count = rtg->rtg_extents * mp->m_sb.sb_rextsize;
86+
rtg_group(rtg)->xg_block_count =
87+
rtg->rtg_extents * mp->m_sb.sb_rextsize;
6288
rtg_group(rtg)->xg_min_gbno = xfs_rtgroup_min_block(mp, rgno);
6389
}
6490

@@ -136,31 +162,6 @@ xfs_initialize_rtgroups(
136162
return error;
137163
}
138164

139-
/* Compute the number of rt extents in this realtime group. */
140-
xfs_rtxnum_t
141-
__xfs_rtgroup_extents(
142-
struct xfs_mount *mp,
143-
xfs_rgnumber_t rgno,
144-
xfs_rgnumber_t rgcount,
145-
xfs_rtbxlen_t rextents)
146-
{
147-
ASSERT(rgno < rgcount);
148-
if (rgno == rgcount - 1)
149-
return rextents - ((xfs_rtxnum_t)rgno * mp->m_sb.sb_rgextents);
150-
151-
ASSERT(xfs_has_rtgroups(mp));
152-
return mp->m_sb.sb_rgextents;
153-
}
154-
155-
xfs_rtxnum_t
156-
xfs_rtgroup_extents(
157-
struct xfs_mount *mp,
158-
xfs_rgnumber_t rgno)
159-
{
160-
return __xfs_rtgroup_extents(mp, rgno, mp->m_sb.sb_rgcount,
161-
mp->m_sb.sb_rextents);
162-
}
163-
164165
/*
165166
* Update the rt extent count of the previous tail rtgroup if it changed during
166167
* recovery (i.e. recovery of a growfs).

fs/xfs/libxfs/xfs_rtgroup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ void xfs_free_rtgroups(struct xfs_mount *mp, xfs_rgnumber_t first_rgno,
285285
int xfs_initialize_rtgroups(struct xfs_mount *mp, xfs_rgnumber_t first_rgno,
286286
xfs_rgnumber_t end_rgno, xfs_rtbxlen_t rextents);
287287

288-
xfs_rtxnum_t __xfs_rtgroup_extents(struct xfs_mount *mp, xfs_rgnumber_t rgno,
289-
xfs_rgnumber_t rgcount, xfs_rtbxlen_t rextents);
290288
xfs_rtxnum_t xfs_rtgroup_extents(struct xfs_mount *mp, xfs_rgnumber_t rgno);
291289
void xfs_rtgroup_calc_geometry(struct xfs_mount *mp, struct xfs_rtgroup *rtg,
292290
xfs_rgnumber_t rgno, xfs_rgnumber_t rgcount,

fs/xfs/xfs_log.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,11 @@ xfs_log_cover(
11801180
int error = 0;
11811181
bool need_covered;
11821182

1183-
ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
1184-
!xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
1185-
xlog_is_shutdown(mp->m_log));
1183+
if (!xlog_is_shutdown(mp->m_log)) {
1184+
ASSERT(xlog_cil_empty(mp->m_log));
1185+
ASSERT(xlog_iclogs_empty(mp->m_log));
1186+
ASSERT(!xfs_ail_min_lsn(mp->m_log->l_ailp));
1187+
}
11861188

11871189
if (!xfs_log_writable(mp))
11881190
return 0;

fs/xfs/xfs_rtalloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ xfs_rtcopy_summary(
126126
error = 0;
127127
out:
128128
xfs_rtbuf_cache_relse(oargs);
129-
return 0;
129+
return error;
130130
}
131131
/*
132132
* Mark an extent specified by start and len allocated.
@@ -1265,7 +1265,7 @@ xfs_growfs_check_rtgeom(
12651265
uint32_t rem;
12661266

12671267
if (rextsize != 1)
1268-
return -EINVAL;
1268+
goto out_inval;
12691269
div_u64_rem(nmp->m_sb.sb_rblocks, gblocks, &rem);
12701270
if (rem) {
12711271
xfs_warn(mp,
@@ -1326,7 +1326,7 @@ xfs_grow_last_rtg(
13261326
return true;
13271327
if (mp->m_sb.sb_rgcount == 0)
13281328
return false;
1329-
return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <=
1329+
return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <
13301330
mp->m_sb.sb_rgextents;
13311331
}
13321332

0 commit comments

Comments
 (0)