diff options
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 81 |
1 files changed, 26 insertions, 55 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 15f5dd22fbb2..3c97c6463a4e 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -567,8 +567,6 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
567 | STATIC void | 567 | STATIC void |
568 | xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | 568 | xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) |
569 | { | 569 | { |
570 | int i; | ||
571 | |||
572 | mp->m_agfrotor = mp->m_agirotor = 0; | 570 | mp->m_agfrotor = mp->m_agirotor = 0; |
573 | spin_lock_init(&mp->m_agirotor_lock); | 571 | spin_lock_init(&mp->m_agirotor_lock); |
574 | mp->m_maxagi = mp->m_sb.sb_agcount; | 572 | mp->m_maxagi = mp->m_sb.sb_agcount; |
@@ -577,12 +575,10 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | |||
577 | mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT; | 575 | mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT; |
578 | mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1; | 576 | mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1; |
579 | mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog; | 577 | mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog; |
580 | mp->m_litino = sbp->sb_inodesize - | 578 | mp->m_litino = sbp->sb_inodesize - sizeof(struct xfs_dinode); |
581 | ((uint)sizeof(xfs_dinode_core_t) + (uint)sizeof(xfs_agino_t)); | ||
582 | mp->m_blockmask = sbp->sb_blocksize - 1; | 579 | mp->m_blockmask = sbp->sb_blocksize - 1; |
583 | mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG; | 580 | mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG; |
584 | mp->m_blockwmask = mp->m_blockwsize - 1; | 581 | mp->m_blockwmask = mp->m_blockwsize - 1; |
585 | INIT_LIST_HEAD(&mp->m_del_inodes); | ||
586 | 582 | ||
587 | /* | 583 | /* |
588 | * Setup for attributes, in case they get created. | 584 | * Setup for attributes, in case they get created. |
@@ -605,24 +601,20 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | |||
605 | } | 601 | } |
606 | ASSERT(mp->m_attroffset < XFS_LITINO(mp)); | 602 | ASSERT(mp->m_attroffset < XFS_LITINO(mp)); |
607 | 603 | ||
608 | for (i = 0; i < 2; i++) { | 604 | mp->m_alloc_mxr[0] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 1); |
609 | mp->m_alloc_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 605 | mp->m_alloc_mxr[1] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 0); |
610 | xfs_alloc, i == 0); | 606 | mp->m_alloc_mnr[0] = mp->m_alloc_mxr[0] / 2; |
611 | mp->m_alloc_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | 607 | mp->m_alloc_mnr[1] = mp->m_alloc_mxr[1] / 2; |
612 | xfs_alloc, i == 0); | 608 | |
613 | } | 609 | mp->m_inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 1); |
614 | for (i = 0; i < 2; i++) { | 610 | mp->m_inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 0); |
615 | mp->m_bmap_dmxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 611 | mp->m_inobt_mnr[0] = mp->m_inobt_mxr[0] / 2; |
616 | xfs_bmbt, i == 0); | 612 | mp->m_inobt_mnr[1] = mp->m_inobt_mxr[1] / 2; |
617 | mp->m_bmap_dmnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | 613 | |
618 | xfs_bmbt, i == 0); | 614 | mp->m_bmap_dmxr[0] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 1); |
619 | } | 615 | mp->m_bmap_dmxr[1] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 0); |
620 | for (i = 0; i < 2; i++) { | 616 | mp->m_bmap_dmnr[0] = mp->m_bmap_dmxr[0] / 2; |
621 | mp->m_inobt_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 617 | mp->m_bmap_dmnr[1] = mp->m_bmap_dmxr[1] / 2; |
622 | xfs_inobt, i == 0); | ||
623 | mp->m_inobt_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | ||
624 | xfs_inobt, i == 0); | ||
625 | } | ||
626 | 618 | ||
627 | mp->m_bsize = XFS_FSB_TO_BB(mp, 1); | 619 | mp->m_bsize = XFS_FSB_TO_BB(mp, 1); |
628 | mp->m_ialloc_inos = (int)MAX((__uint16_t)XFS_INODES_PER_CHUNK, | 620 | mp->m_ialloc_inos = (int)MAX((__uint16_t)XFS_INODES_PER_CHUNK, |
@@ -1228,6 +1220,16 @@ xfs_unmountfs( | |||
1228 | __uint64_t resblks; | 1220 | __uint64_t resblks; |
1229 | int error; | 1221 | int error; |
1230 | 1222 | ||
1223 | /* | ||
1224 | * Release dquot that rootinode, rbmino and rsumino might be holding, | ||
1225 | * and release the quota inodes. | ||
1226 | */ | ||
1227 | XFS_QM_UNMOUNT(mp); | ||
1228 | |||
1229 | if (mp->m_rbmip) | ||
1230 | IRELE(mp->m_rbmip); | ||
1231 | if (mp->m_rsumip) | ||
1232 | IRELE(mp->m_rsumip); | ||
1231 | IRELE(mp->m_rootip); | 1233 | IRELE(mp->m_rootip); |
1232 | 1234 | ||
1233 | /* | 1235 | /* |
@@ -1241,7 +1243,7 @@ xfs_unmountfs( | |||
1241 | * need to force the log first. | 1243 | * need to force the log first. |
1242 | */ | 1244 | */ |
1243 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); | 1245 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); |
1244 | xfs_iflush_all(mp); | 1246 | xfs_reclaim_inodes(mp, 0, XFS_IFLUSH_ASYNC); |
1245 | 1247 | ||
1246 | XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); | 1248 | XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); |
1247 | 1249 | ||
@@ -1288,11 +1290,6 @@ xfs_unmountfs( | |||
1288 | xfs_unmountfs_wait(mp); /* wait for async bufs */ | 1290 | xfs_unmountfs_wait(mp); /* wait for async bufs */ |
1289 | xfs_log_unmount(mp); /* Done! No more fs ops. */ | 1291 | xfs_log_unmount(mp); /* Done! No more fs ops. */ |
1290 | 1292 | ||
1291 | /* | ||
1292 | * All inodes from this mount point should be freed. | ||
1293 | */ | ||
1294 | ASSERT(mp->m_inodes == NULL); | ||
1295 | |||
1296 | if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) | 1293 | if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) |
1297 | uuid_table_remove(&mp->m_sb.sb_uuid); | 1294 | uuid_table_remove(&mp->m_sb.sb_uuid); |
1298 | 1295 | ||
@@ -1365,24 +1362,6 @@ xfs_log_sbcount( | |||
1365 | return error; | 1362 | return error; |
1366 | } | 1363 | } |
1367 | 1364 | ||
1368 | STATIC void | ||
1369 | xfs_mark_shared_ro( | ||
1370 | xfs_mount_t *mp, | ||
1371 | xfs_buf_t *bp) | ||
1372 | { | ||
1373 | xfs_dsb_t *sb = XFS_BUF_TO_SBP(bp); | ||
1374 | __uint16_t version; | ||
1375 | |||
1376 | if (!(sb->sb_flags & XFS_SBF_READONLY)) | ||
1377 | sb->sb_flags |= XFS_SBF_READONLY; | ||
1378 | |||
1379 | version = be16_to_cpu(sb->sb_versionnum); | ||
1380 | if ((version & XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4 || | ||
1381 | !(version & XFS_SB_VERSION_SHAREDBIT)) | ||
1382 | version |= XFS_SB_VERSION_SHAREDBIT; | ||
1383 | sb->sb_versionnum = cpu_to_be16(version); | ||
1384 | } | ||
1385 | |||
1386 | int | 1365 | int |
1387 | xfs_unmountfs_writesb(xfs_mount_t *mp) | 1366 | xfs_unmountfs_writesb(xfs_mount_t *mp) |
1388 | { | 1367 | { |
@@ -1398,12 +1377,6 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) | |||
1398 | 1377 | ||
1399 | sbp = xfs_getsb(mp, 0); | 1378 | sbp = xfs_getsb(mp, 0); |
1400 | 1379 | ||
1401 | /* | ||
1402 | * mark shared-readonly if desired | ||
1403 | */ | ||
1404 | if (mp->m_mk_sharedro) | ||
1405 | xfs_mark_shared_ro(mp, sbp); | ||
1406 | |||
1407 | XFS_BUF_UNDONE(sbp); | 1380 | XFS_BUF_UNDONE(sbp); |
1408 | XFS_BUF_UNREAD(sbp); | 1381 | XFS_BUF_UNREAD(sbp); |
1409 | XFS_BUF_UNDELAYWRITE(sbp); | 1382 | XFS_BUF_UNDELAYWRITE(sbp); |
@@ -1415,8 +1388,6 @@ xfs_unmountfs_writesb(xfs_mount_t *mp) | |||
1415 | if (error) | 1388 | if (error) |
1416 | xfs_ioerror_alert("xfs_unmountfs_writesb", | 1389 | xfs_ioerror_alert("xfs_unmountfs_writesb", |
1417 | mp, sbp, XFS_BUF_ADDR(sbp)); | 1390 | mp, sbp, XFS_BUF_ADDR(sbp)); |
1418 | if (error && mp->m_mk_sharedro) | ||
1419 | xfs_fs_cmn_err(CE_ALERT, mp, "Superblock write error detected while unmounting. Filesystem may not be marked shared readonly"); | ||
1420 | xfs_buf_relse(sbp); | 1391 | xfs_buf_relse(sbp); |
1421 | } | 1392 | } |
1422 | return error; | 1393 | return error; |