diff options
author | Dave Chinner <david@fromorbit.com> | 2014-12-03 17:46:17 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-12-03 17:46:17 -0500 |
commit | 6044e4386cd51dece882ea42352cdaaab0f24cad (patch) | |
tree | cde51132ea9d6afefdf05ad621fc22bbb796d5f4 /fs/xfs/libxfs/xfs_ialloc.c | |
parent | c14fc01340dd0afe58d8671acc3ea5e907e707ae (diff) | |
parent | b29c70f59870dad0945b0e0b3fe3758ad528e268 (diff) |
Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next
Conflicts:
fs/xfs/xfs_iops.c
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index d1dc590a7c54..116ef1ddb3e3 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c | |||
@@ -45,12 +45,12 @@ | |||
45 | */ | 45 | */ |
46 | static inline int | 46 | static inline int |
47 | xfs_ialloc_cluster_alignment( | 47 | xfs_ialloc_cluster_alignment( |
48 | xfs_alloc_arg_t *args) | 48 | struct xfs_mount *mp) |
49 | { | 49 | { |
50 | if (xfs_sb_version_hasalign(&args->mp->m_sb) && | 50 | if (xfs_sb_version_hasalign(&mp->m_sb) && |
51 | args->mp->m_sb.sb_inoalignmt >= | 51 | mp->m_sb.sb_inoalignmt >= |
52 | XFS_B_TO_FSBT(args->mp, args->mp->m_inode_cluster_size)) | 52 | XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size)) |
53 | return args->mp->m_sb.sb_inoalignmt; | 53 | return mp->m_sb.sb_inoalignmt; |
54 | return 1; | 54 | return 1; |
55 | } | 55 | } |
56 | 56 | ||
@@ -409,7 +409,7 @@ xfs_ialloc_ag_alloc( | |||
409 | * but not to use them in the actual exact allocation. | 409 | * but not to use them in the actual exact allocation. |
410 | */ | 410 | */ |
411 | args.alignment = 1; | 411 | args.alignment = 1; |
412 | args.minalignslop = xfs_ialloc_cluster_alignment(&args) - 1; | 412 | args.minalignslop = xfs_ialloc_cluster_alignment(args.mp) - 1; |
413 | 413 | ||
414 | /* Allow space for the inode btree to split. */ | 414 | /* Allow space for the inode btree to split. */ |
415 | args.minleft = args.mp->m_in_maxlevels - 1; | 415 | args.minleft = args.mp->m_in_maxlevels - 1; |
@@ -445,7 +445,7 @@ xfs_ialloc_ag_alloc( | |||
445 | args.alignment = args.mp->m_dalign; | 445 | args.alignment = args.mp->m_dalign; |
446 | isaligned = 1; | 446 | isaligned = 1; |
447 | } else | 447 | } else |
448 | args.alignment = xfs_ialloc_cluster_alignment(&args); | 448 | args.alignment = xfs_ialloc_cluster_alignment(args.mp); |
449 | /* | 449 | /* |
450 | * Need to figure out where to allocate the inode blocks. | 450 | * Need to figure out where to allocate the inode blocks. |
451 | * Ideally they should be spaced out through the a.g. | 451 | * Ideally they should be spaced out through the a.g. |
@@ -474,7 +474,7 @@ xfs_ialloc_ag_alloc( | |||
474 | args.type = XFS_ALLOCTYPE_NEAR_BNO; | 474 | args.type = XFS_ALLOCTYPE_NEAR_BNO; |
475 | args.agbno = be32_to_cpu(agi->agi_root); | 475 | args.agbno = be32_to_cpu(agi->agi_root); |
476 | args.fsbno = XFS_AGB_TO_FSB(args.mp, agno, args.agbno); | 476 | args.fsbno = XFS_AGB_TO_FSB(args.mp, agno, args.agbno); |
477 | args.alignment = xfs_ialloc_cluster_alignment(&args); | 477 | args.alignment = xfs_ialloc_cluster_alignment(args.mp); |
478 | if ((error = xfs_alloc_vextent(&args))) | 478 | if ((error = xfs_alloc_vextent(&args))) |
479 | return error; | 479 | return error; |
480 | } | 480 | } |
@@ -629,10 +629,24 @@ xfs_ialloc_ag_select( | |||
629 | } | 629 | } |
630 | 630 | ||
631 | /* | 631 | /* |
632 | * Is there enough free space for the file plus a block of | 632 | * Check that there is enough free space for the file plus a |
633 | * inodes? (if we need to allocate some)? | 633 | * chunk of inodes if we need to allocate some. If this is the |
634 | * first pass across the AGs, take into account the potential | ||
635 | * space needed for alignment of inode chunks when checking the | ||
636 | * longest contiguous free space in the AG - this prevents us | ||
637 | * from getting ENOSPC because we have free space larger than | ||
638 | * m_ialloc_blks but alignment constraints prevent us from using | ||
639 | * it. | ||
640 | * | ||
641 | * If we can't find an AG with space for full alignment slack to | ||
642 | * be taken into account, we must be near ENOSPC in all AGs. | ||
643 | * Hence we don't include alignment for the second pass and so | ||
644 | * if we fail allocation due to alignment issues then it is most | ||
645 | * likely a real ENOSPC condition. | ||
634 | */ | 646 | */ |
635 | ineed = mp->m_ialloc_blks; | 647 | ineed = mp->m_ialloc_blks; |
648 | if (flags && ineed > 1) | ||
649 | ineed += xfs_ialloc_cluster_alignment(mp); | ||
636 | longest = pag->pagf_longest; | 650 | longest = pag->pagf_longest; |
637 | if (!longest) | 651 | if (!longest) |
638 | longest = pag->pagf_flcount > 0; | 652 | longest = pag->pagf_flcount > 0; |