aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r--fs/xfs/xfs_mount.c82
1 files changed, 27 insertions, 55 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 6c5d1325e7f6..a4503f5e9497 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -128,7 +128,7 @@ static const struct {
128 * initialized. 128 * initialized.
129 */ 129 */
130STATIC void 130STATIC void
131xfs_mount_free( 131xfs_free_perag(
132 xfs_mount_t *mp) 132 xfs_mount_t *mp)
133{ 133{
134 if (mp->m_perag) { 134 if (mp->m_perag) {
@@ -139,20 +139,6 @@ xfs_mount_free(
139 kmem_free(mp->m_perag[agno].pagb_list); 139 kmem_free(mp->m_perag[agno].pagb_list);
140 kmem_free(mp->m_perag); 140 kmem_free(mp->m_perag);
141 } 141 }
142
143 spinlock_destroy(&mp->m_ail_lock);
144 spinlock_destroy(&mp->m_sb_lock);
145 mutex_destroy(&mp->m_ilock);
146 mutex_destroy(&mp->m_growlock);
147 if (mp->m_quotainfo)
148 XFS_QM_DONE(mp);
149
150 if (mp->m_fsname != NULL)
151 kmem_free(mp->m_fsname);
152 if (mp->m_rtname != NULL)
153 kmem_free(mp->m_rtname);
154 if (mp->m_logname != NULL)
155 kmem_free(mp->m_logname);
156} 142}
157 143
158/* 144/*
@@ -704,11 +690,11 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
704 * Update alignment values based on mount options and sb values 690 * Update alignment values based on mount options and sb values
705 */ 691 */
706STATIC int 692STATIC int
707xfs_update_alignment(xfs_mount_t *mp, int mfsi_flags, __uint64_t *update_flags) 693xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags)
708{ 694{
709 xfs_sb_t *sbp = &(mp->m_sb); 695 xfs_sb_t *sbp = &(mp->m_sb);
710 696
711 if (mp->m_dalign && !(mfsi_flags & XFS_MFSI_SECOND)) { 697 if (mp->m_dalign) {
712 /* 698 /*
713 * If stripe unit and stripe width are not multiples 699 * If stripe unit and stripe width are not multiples
714 * of the fs blocksize turn off alignment. 700 * of the fs blocksize turn off alignment.
@@ -864,7 +850,7 @@ xfs_set_inoalignment(xfs_mount_t *mp)
864 * Check that the data (and log if separate) are an ok size. 850 * Check that the data (and log if separate) are an ok size.
865 */ 851 */
866STATIC int 852STATIC int
867xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags) 853xfs_check_sizes(xfs_mount_t *mp)
868{ 854{
869 xfs_buf_t *bp; 855 xfs_buf_t *bp;
870 xfs_daddr_t d; 856 xfs_daddr_t d;
@@ -887,8 +873,7 @@ xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
887 return error; 873 return error;
888 } 874 }
889 875
890 if (((mfsi_flags & XFS_MFSI_CLIENT) == 0) && 876 if (mp->m_logdev_targp != mp->m_ddev_targp) {
891 mp->m_logdev_targp != mp->m_ddev_targp) {
892 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); 877 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
893 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { 878 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
894 cmn_err(CE_WARN, "XFS: size check 3 failed"); 879 cmn_err(CE_WARN, "XFS: size check 3 failed");
@@ -923,15 +908,13 @@ xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
923 */ 908 */
924int 909int
925xfs_mountfs( 910xfs_mountfs(
926 xfs_mount_t *mp, 911 xfs_mount_t *mp)
927 int mfsi_flags)
928{ 912{
929 xfs_sb_t *sbp = &(mp->m_sb); 913 xfs_sb_t *sbp = &(mp->m_sb);
930 xfs_inode_t *rip; 914 xfs_inode_t *rip;
931 __uint64_t resblks; 915 __uint64_t resblks;
932 __int64_t update_flags = 0LL; 916 __int64_t update_flags = 0LL;
933 uint quotamount, quotaflags; 917 uint quotamount, quotaflags;
934 int agno;
935 int uuid_mounted = 0; 918 int uuid_mounted = 0;
936 int error = 0; 919 int error = 0;
937 920
@@ -985,7 +968,7 @@ xfs_mountfs(
985 * allocator alignment is within an ag, therefore ag has 968 * allocator alignment is within an ag, therefore ag has
986 * to be aligned at stripe boundary. 969 * to be aligned at stripe boundary.
987 */ 970 */
988 error = xfs_update_alignment(mp, mfsi_flags, &update_flags); 971 error = xfs_update_alignment(mp, &update_flags);
989 if (error) 972 if (error)
990 goto error1; 973 goto error1;
991 974
@@ -1004,8 +987,7 @@ xfs_mountfs(
1004 * since a single partition filesystem is identical to a single 987 * since a single partition filesystem is identical to a single
1005 * partition volume/filesystem. 988 * partition volume/filesystem.
1006 */ 989 */
1007 if ((mfsi_flags & XFS_MFSI_SECOND) == 0 && 990 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
1008 (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
1009 if (xfs_uuid_mount(mp)) { 991 if (xfs_uuid_mount(mp)) {
1010 error = XFS_ERROR(EINVAL); 992 error = XFS_ERROR(EINVAL);
1011 goto error1; 993 goto error1;
@@ -1033,7 +1015,7 @@ xfs_mountfs(
1033 /* 1015 /*
1034 * Check that the data (and log if separate) are an ok size. 1016 * Check that the data (and log if separate) are an ok size.
1035 */ 1017 */
1036 error = xfs_check_sizes(mp, mfsi_flags); 1018 error = xfs_check_sizes(mp);
1037 if (error) 1019 if (error)
1038 goto error1; 1020 goto error1;
1039 1021
@@ -1047,13 +1029,6 @@ xfs_mountfs(
1047 } 1029 }
1048 1030
1049 /* 1031 /*
1050 * For client case we are done now
1051 */
1052 if (mfsi_flags & XFS_MFSI_CLIENT) {
1053 return 0;
1054 }
1055
1056 /*
1057 * Copies the low order bits of the timestamp and the randomly 1032 * Copies the low order bits of the timestamp and the randomly
1058 * set "sequence" number out of a UUID. 1033 * set "sequence" number out of a UUID.
1059 */ 1034 */
@@ -1077,8 +1052,10 @@ xfs_mountfs(
1077 * Allocate and initialize the per-ag data. 1052 * Allocate and initialize the per-ag data.
1078 */ 1053 */
1079 init_rwsem(&mp->m_peraglock); 1054 init_rwsem(&mp->m_peraglock);
1080 mp->m_perag = 1055 mp->m_perag = kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t),
1081 kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP); 1056 KM_MAYFAIL);
1057 if (!mp->m_perag)
1058 goto error1;
1082 1059
1083 mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount); 1060 mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
1084 1061
@@ -1190,7 +1167,7 @@ xfs_mountfs(
1190 * delayed until after the root and real-time bitmap inodes 1167 * delayed until after the root and real-time bitmap inodes
1191 * were consistently read in. 1168 * were consistently read in.
1192 */ 1169 */
1193 error = xfs_log_mount_finish(mp, mfsi_flags); 1170 error = xfs_log_mount_finish(mp);
1194 if (error) { 1171 if (error) {
1195 cmn_err(CE_WARN, "XFS: log mount finish failed"); 1172 cmn_err(CE_WARN, "XFS: log mount finish failed");
1196 goto error4; 1173 goto error4;
@@ -1199,7 +1176,7 @@ xfs_mountfs(
1199 /* 1176 /*
1200 * Complete the quota initialisation, post-log-replay component. 1177 * Complete the quota initialisation, post-log-replay component.
1201 */ 1178 */
1202 error = XFS_QM_MOUNT(mp, quotamount, quotaflags, mfsi_flags); 1179 error = XFS_QM_MOUNT(mp, quotamount, quotaflags);
1203 if (error) 1180 if (error)
1204 goto error4; 1181 goto error4;
1205 1182
@@ -1233,12 +1210,7 @@ xfs_mountfs(
1233 error3: 1210 error3:
1234 xfs_log_unmount_dealloc(mp); 1211 xfs_log_unmount_dealloc(mp);
1235 error2: 1212 error2:
1236 for (agno = 0; agno < sbp->sb_agcount; agno++) 1213 xfs_free_perag(mp);
1237 if (mp->m_perag[agno].pagb_list)
1238 kmem_free(mp->m_perag[agno].pagb_list);
1239 kmem_free(mp->m_perag);
1240 mp->m_perag = NULL;
1241 /* FALLTHROUGH */
1242 error1: 1214 error1:
1243 if (uuid_mounted) 1215 if (uuid_mounted)
1244 uuid_table_remove(&mp->m_sb.sb_uuid); 1216 uuid_table_remove(&mp->m_sb.sb_uuid);
@@ -1246,16 +1218,17 @@ xfs_mountfs(
1246} 1218}
1247 1219
1248/* 1220/*
1249 * xfs_unmountfs
1250 *
1251 * This flushes out the inodes,dquots and the superblock, unmounts the 1221 * This flushes out the inodes,dquots and the superblock, unmounts the
1252 * log and makes sure that incore structures are freed. 1222 * log and makes sure that incore structures are freed.
1253 */ 1223 */
1254int 1224void
1255xfs_unmountfs(xfs_mount_t *mp) 1225xfs_unmountfs(
1226 struct xfs_mount *mp)
1256{ 1227{
1257 __uint64_t resblks; 1228 __uint64_t resblks;
1258 int error = 0; 1229 int error;
1230
1231 IRELE(mp->m_rootip);
1259 1232
1260 /* 1233 /*
1261 * We can potentially deadlock here if we have an inode cluster 1234 * We can potentially deadlock here if we have an inode cluster
@@ -1312,8 +1285,6 @@ xfs_unmountfs(xfs_mount_t *mp)
1312 xfs_unmountfs_wait(mp); /* wait for async bufs */ 1285 xfs_unmountfs_wait(mp); /* wait for async bufs */
1313 xfs_log_unmount(mp); /* Done! No more fs ops. */ 1286 xfs_log_unmount(mp); /* Done! No more fs ops. */
1314 1287
1315 xfs_freesb(mp);
1316
1317 /* 1288 /*
1318 * All inodes from this mount point should be freed. 1289 * All inodes from this mount point should be freed.
1319 */ 1290 */
@@ -1322,11 +1293,12 @@ xfs_unmountfs(xfs_mount_t *mp)
1322 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) 1293 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)
1323 uuid_table_remove(&mp->m_sb.sb_uuid); 1294 uuid_table_remove(&mp->m_sb.sb_uuid);
1324 1295
1325#if defined(DEBUG) || defined(INDUCE_IO_ERROR) 1296#if defined(DEBUG)
1326 xfs_errortag_clearall(mp, 0); 1297 xfs_errortag_clearall(mp, 0);
1327#endif 1298#endif
1328 xfs_mount_free(mp); 1299 xfs_free_perag(mp);
1329 return 0; 1300 if (mp->m_quotainfo)
1301 XFS_QM_DONE(mp);
1330} 1302}
1331 1303
1332STATIC void 1304STATIC void