Skip to content

Commit d704426

Browse files
committed
Merge tag 'xfs-6.3-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Darrick Wong: "This batch started with some debugging enhancements to the new allocator refactoring that we put in 6.3-rc1 to assist developers in rebasing their dev branches. As for more serious code changes -- there's a bug fix to make the lockless allocator scan the whole filesystem before resorting to the locking allocator. We're also adding a selftest for the venerable directory/xattr hash function to make sure that it produces consistent results so that we can address any fallout as soon as possible. - Add a few debugging assertions so that people (me) trying to port code to the new allocator functions don't mess up the caller requirements - Relax some overly cautious lock ordering enforcement in the new allocator code, which means that file allocations will locklessly scan for the best space they can get before backing off to the traditional lock-and-really-get-it behavior - Add tracepoints to make it easier to trace the xfs allocator behavior - Actually test the dir/xattr hash algorithm to make sure it produces consistent results across all the platforms XFS supports" * tag 'xfs-6.3-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: test dir/attr hash when loading module xfs: add tracepoints for each of the externally visible allocators xfs: walk all AGs if TRYLOCK passed to xfs_alloc_vextent_iterate_ags xfs: try to idiot-proof the allocators
2 parents 4bdec23 + 3cfb929 commit d704426

File tree

6 files changed

+722
-1
lines changed

6 files changed

+722
-1
lines changed

fs/xfs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ xfs-y += xfs_aops.o \
6363
xfs_bmap_util.o \
6464
xfs_bio_io.o \
6565
xfs_buf.o \
66+
xfs_dahash_test.o \
6667
xfs_dir2_readdir.o \
6768
xfs_discard.o \
6869
xfs_error.o \

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3255,6 +3255,8 @@ xfs_alloc_vextent_finish(
32553255
XFS_STATS_INC(mp, xs_allocx);
32563256
XFS_STATS_ADD(mp, xs_allocb, args->len);
32573257

3258+
trace_xfs_alloc_vextent_finish(args);
3259+
32583260
out_drop_perag:
32593261
if (drop_perag && args->pag) {
32603262
xfs_perag_rele(args->pag);
@@ -3279,8 +3281,14 @@ xfs_alloc_vextent_this_ag(
32793281
xfs_agnumber_t minimum_agno;
32803282
int error;
32813283

3284+
ASSERT(args->pag != NULL);
3285+
ASSERT(args->pag->pag_agno == agno);
3286+
32823287
args->agno = agno;
32833288
args->agbno = 0;
3289+
3290+
trace_xfs_alloc_vextent_this_ag(args);
3291+
32843292
error = xfs_alloc_vextent_check_args(args, XFS_AGB_TO_FSB(mp, agno, 0),
32853293
&minimum_agno);
32863294
if (error) {
@@ -3323,11 +3331,14 @@ xfs_alloc_vextent_iterate_ags(
33233331
uint32_t flags)
33243332
{
33253333
struct xfs_mount *mp = args->mp;
3334+
xfs_agnumber_t restart_agno = minimum_agno;
33263335
xfs_agnumber_t agno;
33273336
int error = 0;
33283337

3338+
if (flags & XFS_ALLOC_FLAG_TRYLOCK)
3339+
restart_agno = 0;
33293340
restart:
3330-
for_each_perag_wrap_range(mp, start_agno, minimum_agno,
3341+
for_each_perag_wrap_range(mp, start_agno, restart_agno,
33313342
mp->m_sb.sb_agcount, agno, args->pag) {
33323343
args->agno = agno;
33333344
error = xfs_alloc_vextent_prepare_ag(args);
@@ -3366,6 +3377,7 @@ xfs_alloc_vextent_iterate_ags(
33663377
*/
33673378
if (flags) {
33683379
flags = 0;
3380+
restart_agno = minimum_agno;
33693381
goto restart;
33703382
}
33713383

@@ -3394,8 +3406,13 @@ xfs_alloc_vextent_start_ag(
33943406
bool bump_rotor = false;
33953407
int error;
33963408

3409+
ASSERT(args->pag == NULL);
3410+
33973411
args->agno = NULLAGNUMBER;
33983412
args->agbno = NULLAGBLOCK;
3413+
3414+
trace_xfs_alloc_vextent_first_ag(args);
3415+
33993416
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
34003417
if (error) {
34013418
if (error == -ENOSPC)
@@ -3442,8 +3459,13 @@ xfs_alloc_vextent_first_ag(
34423459
xfs_agnumber_t start_agno;
34433460
int error;
34443461

3462+
ASSERT(args->pag == NULL);
3463+
34453464
args->agno = NULLAGNUMBER;
34463465
args->agbno = NULLAGBLOCK;
3466+
3467+
trace_xfs_alloc_vextent_start_ag(args);
3468+
34473469
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
34483470
if (error) {
34493471
if (error == -ENOSPC)
@@ -3470,8 +3492,14 @@ xfs_alloc_vextent_exact_bno(
34703492
xfs_agnumber_t minimum_agno;
34713493
int error;
34723494

3495+
ASSERT(args->pag != NULL);
3496+
ASSERT(args->pag->pag_agno == XFS_FSB_TO_AGNO(mp, target));
3497+
34733498
args->agno = XFS_FSB_TO_AGNO(mp, target);
34743499
args->agbno = XFS_FSB_TO_AGBNO(mp, target);
3500+
3501+
trace_xfs_alloc_vextent_near_bno(args);
3502+
34753503
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
34763504
if (error) {
34773505
if (error == -ENOSPC)
@@ -3502,8 +3530,14 @@ xfs_alloc_vextent_near_bno(
35023530
bool needs_perag = args->pag == NULL;
35033531
int error;
35043532

3533+
if (!needs_perag)
3534+
ASSERT(args->pag->pag_agno == XFS_FSB_TO_AGNO(mp, target));
3535+
35053536
args->agno = XFS_FSB_TO_AGNO(mp, target);
35063537
args->agbno = XFS_FSB_TO_AGBNO(mp, target);
3538+
3539+
trace_xfs_alloc_vextent_exact_bno(args);
3540+
35073541
error = xfs_alloc_vextent_check_args(args, target, &minimum_agno);
35083542
if (error) {
35093543
if (error == -ENOSPC)

0 commit comments

Comments
 (0)