diff options
author | Carlos Maiolino <cmaiolino@redhat.com> | 2012-09-20 09:32:38 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-09-26 16:56:33 -0400 |
commit | 2d2194f61fddab3a9731b6e7a7ae3a4a19dd810c (patch) | |
tree | aea773af614c823aad15ecd832b9061343a589bd /fs/xfs/xfs_mount.c | |
parent | 08bf540412ed82a15cb9068249ad49b410a7b082 (diff) |
xfs: reduce code duplication handling inode32/64 options
Add xfs_set_inode32() to be used to enable inode32 allocation mode. this
will reduce the amount of duplicated code needed to mount/remount a
filesystem with inode32 option. This patch also changes
xfs_set_inode64() to return the maximum AG number that inodes can be
allocated instead of set mp->m_maxagi by itself, so that the behaviour
is the same as xfs_set_inode32(). This simplifies code that calls these
functions and needs to know the maximum AG that inodes can be allocated
in.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 29c2f83d4147..b2bd3a0e6376 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -440,7 +440,7 @@ xfs_initialize_perag( | |||
440 | xfs_agnumber_t agcount, | 440 | xfs_agnumber_t agcount, |
441 | xfs_agnumber_t *maxagi) | 441 | xfs_agnumber_t *maxagi) |
442 | { | 442 | { |
443 | xfs_agnumber_t index, max_metadata; | 443 | xfs_agnumber_t index; |
444 | xfs_agnumber_t first_initialised = 0; | 444 | xfs_agnumber_t first_initialised = 0; |
445 | xfs_perag_t *pag; | 445 | xfs_perag_t *pag; |
446 | xfs_agino_t agino; | 446 | xfs_agino_t agino; |
@@ -500,43 +500,10 @@ xfs_initialize_perag( | |||
500 | else | 500 | else |
501 | mp->m_flags &= ~XFS_MOUNT_32BITINODES; | 501 | mp->m_flags &= ~XFS_MOUNT_32BITINODES; |
502 | 502 | ||
503 | if (mp->m_flags & XFS_MOUNT_32BITINODES) { | 503 | if (mp->m_flags & XFS_MOUNT_32BITINODES) |
504 | /* | 504 | index = xfs_set_inode32(mp); |
505 | * Calculate how much should be reserved for inodes to meet | 505 | else |
506 | * the max inode percentage. | 506 | index = xfs_set_inode64(mp); |
507 | */ | ||
508 | if (mp->m_maxicount) { | ||
509 | __uint64_t icount; | ||
510 | |||
511 | icount = sbp->sb_dblocks * sbp->sb_imax_pct; | ||
512 | do_div(icount, 100); | ||
513 | icount += sbp->sb_agblocks - 1; | ||
514 | do_div(icount, sbp->sb_agblocks); | ||
515 | max_metadata = icount; | ||
516 | } else { | ||
517 | max_metadata = agcount; | ||
518 | } | ||
519 | |||
520 | for (index = 0; index < agcount; index++) { | ||
521 | ino = XFS_AGINO_TO_INO(mp, index, agino); | ||
522 | if (ino > XFS_MAXINUMBER_32) { | ||
523 | index++; | ||
524 | break; | ||
525 | } | ||
526 | |||
527 | pag = xfs_perag_get(mp, index); | ||
528 | pag->pagi_inodeok = 1; | ||
529 | if (index < max_metadata) | ||
530 | pag->pagf_metadata = 1; | ||
531 | xfs_perag_put(pag); | ||
532 | } | ||
533 | } else { | ||
534 | for (index = 0; index < agcount; index++) { | ||
535 | pag = xfs_perag_get(mp, index); | ||
536 | pag->pagi_inodeok = 1; | ||
537 | xfs_perag_put(pag); | ||
538 | } | ||
539 | } | ||
540 | 507 | ||
541 | if (maxagi) | 508 | if (maxagi) |
542 | *maxagi = index; | 509 | *maxagi = index; |