diff options
author | Christoph Hellwig <hch@lst.de> | 2017-02-02 02:55:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-04 03:47:11 -0500 |
commit | c63f4d3aa09d0b8c36836a887d32cf20a974509f (patch) | |
tree | c70b434355ff486fe4014fb73974eb9a7eeda3f4 /fs | |
parent | d20e4ad06c4be123ef350a0ca78f1480bbdc5f8e (diff) |
xfs: fix bogus minleft manipulations
commit 255c516278175a6dc7037d1406307f35237d8688 upstream.
We can't just set minleft to 0 when we're low on space - that's exactly
what we need minleft for: to protect space in the AG for btree block
allocations when we are low on free space.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 24 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 3 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap_btree.c | 3 |
3 files changed, 8 insertions, 22 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 0a46f8488b8d..fe925702c955 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c | |||
@@ -2635,12 +2635,10 @@ xfs_alloc_vextent( | |||
2635 | xfs_agblock_t agsize; /* allocation group size */ | 2635 | xfs_agblock_t agsize; /* allocation group size */ |
2636 | int error; | 2636 | int error; |
2637 | int flags; /* XFS_ALLOC_FLAG_... locking flags */ | 2637 | int flags; /* XFS_ALLOC_FLAG_... locking flags */ |
2638 | xfs_extlen_t minleft;/* minimum left value, temp copy */ | ||
2639 | xfs_mount_t *mp; /* mount structure pointer */ | 2638 | xfs_mount_t *mp; /* mount structure pointer */ |
2640 | xfs_agnumber_t sagno; /* starting allocation group number */ | 2639 | xfs_agnumber_t sagno; /* starting allocation group number */ |
2641 | xfs_alloctype_t type; /* input allocation type */ | 2640 | xfs_alloctype_t type; /* input allocation type */ |
2642 | int bump_rotor = 0; | 2641 | int bump_rotor = 0; |
2643 | int no_min = 0; | ||
2644 | xfs_agnumber_t rotorstep = xfs_rotorstep; /* inode32 agf stepper */ | 2642 | xfs_agnumber_t rotorstep = xfs_rotorstep; /* inode32 agf stepper */ |
2645 | 2643 | ||
2646 | mp = args->mp; | 2644 | mp = args->mp; |
@@ -2669,7 +2667,6 @@ xfs_alloc_vextent( | |||
2669 | trace_xfs_alloc_vextent_badargs(args); | 2667 | trace_xfs_alloc_vextent_badargs(args); |
2670 | return 0; | 2668 | return 0; |
2671 | } | 2669 | } |
2672 | minleft = args->minleft; | ||
2673 | 2670 | ||
2674 | switch (type) { | 2671 | switch (type) { |
2675 | case XFS_ALLOCTYPE_THIS_AG: | 2672 | case XFS_ALLOCTYPE_THIS_AG: |
@@ -2680,9 +2677,7 @@ xfs_alloc_vextent( | |||
2680 | */ | 2677 | */ |
2681 | args->agno = XFS_FSB_TO_AGNO(mp, args->fsbno); | 2678 | args->agno = XFS_FSB_TO_AGNO(mp, args->fsbno); |
2682 | args->pag = xfs_perag_get(mp, args->agno); | 2679 | args->pag = xfs_perag_get(mp, args->agno); |
2683 | args->minleft = 0; | ||
2684 | error = xfs_alloc_fix_freelist(args, 0); | 2680 | error = xfs_alloc_fix_freelist(args, 0); |
2685 | args->minleft = minleft; | ||
2686 | if (error) { | 2681 | if (error) { |
2687 | trace_xfs_alloc_vextent_nofix(args); | 2682 | trace_xfs_alloc_vextent_nofix(args); |
2688 | goto error0; | 2683 | goto error0; |
@@ -2747,9 +2742,7 @@ xfs_alloc_vextent( | |||
2747 | */ | 2742 | */ |
2748 | for (;;) { | 2743 | for (;;) { |
2749 | args->pag = xfs_perag_get(mp, args->agno); | 2744 | args->pag = xfs_perag_get(mp, args->agno); |
2750 | if (no_min) args->minleft = 0; | ||
2751 | error = xfs_alloc_fix_freelist(args, flags); | 2745 | error = xfs_alloc_fix_freelist(args, flags); |
2752 | args->minleft = minleft; | ||
2753 | if (error) { | 2746 | if (error) { |
2754 | trace_xfs_alloc_vextent_nofix(args); | 2747 | trace_xfs_alloc_vextent_nofix(args); |
2755 | goto error0; | 2748 | goto error0; |
@@ -2789,20 +2782,17 @@ xfs_alloc_vextent( | |||
2789 | * or switch to non-trylock mode. | 2782 | * or switch to non-trylock mode. |
2790 | */ | 2783 | */ |
2791 | if (args->agno == sagno) { | 2784 | if (args->agno == sagno) { |
2792 | if (no_min == 1) { | 2785 | if (flags == 0) { |
2793 | args->agbno = NULLAGBLOCK; | 2786 | args->agbno = NULLAGBLOCK; |
2794 | trace_xfs_alloc_vextent_allfailed(args); | 2787 | trace_xfs_alloc_vextent_allfailed(args); |
2795 | break; | 2788 | break; |
2796 | } | 2789 | } |
2797 | if (flags == 0) { | 2790 | |
2798 | no_min = 1; | 2791 | flags = 0; |
2799 | } else { | 2792 | if (type == XFS_ALLOCTYPE_START_BNO) { |
2800 | flags = 0; | 2793 | args->agbno = XFS_FSB_TO_AGBNO(mp, |
2801 | if (type == XFS_ALLOCTYPE_START_BNO) { | 2794 | args->fsbno); |
2802 | args->agbno = XFS_FSB_TO_AGBNO(mp, | 2795 | args->type = XFS_ALLOCTYPE_NEAR_BNO; |
2803 | args->fsbno); | ||
2804 | args->type = XFS_ALLOCTYPE_NEAR_BNO; | ||
2805 | } | ||
2806 | } | 2796 | } |
2807 | } | 2797 | } |
2808 | xfs_perag_put(args->pag); | 2798 | xfs_perag_put(args->pag); |
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 89d727b659fc..52dc5c175001 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -3903,7 +3903,6 @@ xfs_bmap_btalloc( | |||
3903 | args.fsbno = 0; | 3903 | args.fsbno = 0; |
3904 | args.type = XFS_ALLOCTYPE_FIRST_AG; | 3904 | args.type = XFS_ALLOCTYPE_FIRST_AG; |
3905 | args.total = ap->minlen; | 3905 | args.total = ap->minlen; |
3906 | args.minleft = 0; | ||
3907 | if ((error = xfs_alloc_vextent(&args))) | 3906 | if ((error = xfs_alloc_vextent(&args))) |
3908 | return error; | 3907 | return error; |
3909 | ap->dfops->dop_low = true; | 3908 | ap->dfops->dop_low = true; |
@@ -4437,8 +4436,6 @@ xfs_bmapi_allocate( | |||
4437 | if (error) | 4436 | if (error) |
4438 | return error; | 4437 | return error; |
4439 | 4438 | ||
4440 | if (bma->dfops->dop_low) | ||
4441 | bma->minleft = 0; | ||
4442 | if (bma->cur) | 4439 | if (bma->cur) |
4443 | bma->cur->bc_private.b.firstblock = *bma->firstblock; | 4440 | bma->cur->bc_private.b.firstblock = *bma->firstblock; |
4444 | if (bma->blkno == NULLFSBLOCK) | 4441 | if (bma->blkno == NULLFSBLOCK) |
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c index 049fa597ae91..f76c1693ff01 100644 --- a/fs/xfs/libxfs/xfs_bmap_btree.c +++ b/fs/xfs/libxfs/xfs_bmap_btree.c | |||
@@ -502,12 +502,11 @@ try_another_ag: | |||
502 | if (args.fsbno == NULLFSBLOCK && args.minleft) { | 502 | if (args.fsbno == NULLFSBLOCK && args.minleft) { |
503 | /* | 503 | /* |
504 | * Could not find an AG with enough free space to satisfy | 504 | * Could not find an AG with enough free space to satisfy |
505 | * a full btree split. Try again without minleft and if | 505 | * a full btree split. Try again and if |
506 | * successful activate the lowspace algorithm. | 506 | * successful activate the lowspace algorithm. |
507 | */ | 507 | */ |
508 | args.fsbno = 0; | 508 | args.fsbno = 0; |
509 | args.type = XFS_ALLOCTYPE_FIRST_AG; | 509 | args.type = XFS_ALLOCTYPE_FIRST_AG; |
510 | args.minleft = 0; | ||
511 | error = xfs_alloc_vextent(&args); | 510 | error = xfs_alloc_vextent(&args); |
512 | if (error) | 511 | if (error) |
513 | goto error0; | 512 | goto error0; |