diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 9f2e398a5616..e9c21454b9e2 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -1318,6 +1318,8 @@ xfs_fs_remount( | |||
1318 | 1318 | ||
1319 | /* ro -> rw */ | 1319 | /* ro -> rw */ |
1320 | if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) { | 1320 | if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) { |
1321 | __uint64_t resblks; | ||
1322 | |||
1321 | mp->m_flags &= ~XFS_MOUNT_RDONLY; | 1323 | mp->m_flags &= ~XFS_MOUNT_RDONLY; |
1322 | if (mp->m_flags & XFS_MOUNT_BARRIER) | 1324 | if (mp->m_flags & XFS_MOUNT_BARRIER) |
1323 | xfs_mountfs_check_barriers(mp); | 1325 | xfs_mountfs_check_barriers(mp); |
@@ -1335,11 +1337,37 @@ xfs_fs_remount( | |||
1335 | } | 1337 | } |
1336 | mp->m_update_flags = 0; | 1338 | mp->m_update_flags = 0; |
1337 | } | 1339 | } |
1340 | |||
1341 | /* | ||
1342 | * Fill out the reserve pool if it is empty. Use the stashed | ||
1343 | * value if it is non-zero, otherwise go with the default. | ||
1344 | */ | ||
1345 | if (mp->m_resblks_save) { | ||
1346 | resblks = mp->m_resblks_save; | ||
1347 | mp->m_resblks_save = 0; | ||
1348 | } else { | ||
1349 | resblks = mp->m_sb.sb_dblocks; | ||
1350 | do_div(resblks, 20); | ||
1351 | resblks = min_t(__uint64_t, resblks, 1024); | ||
1352 | } | ||
1353 | xfs_reserve_blocks(mp, &resblks, NULL); | ||
1338 | } | 1354 | } |
1339 | 1355 | ||
1340 | /* rw -> ro */ | 1356 | /* rw -> ro */ |
1341 | if (!(mp->m_flags & XFS_MOUNT_RDONLY) && (*flags & MS_RDONLY)) { | 1357 | if (!(mp->m_flags & XFS_MOUNT_RDONLY) && (*flags & MS_RDONLY)) { |
1358 | /* | ||
1359 | * After we have synced the data but before we sync the | ||
1360 | * metadata, we need to free up the reserve block pool so that | ||
1361 | * the used block count in the superblock on disk is correct at | ||
1362 | * the end of the remount. Stash the current reserve pool size | ||
1363 | * so that if we get remounted rw, we can return it to the same | ||
1364 | * size. | ||
1365 | */ | ||
1366 | __uint64_t resblks = 0; | ||
1367 | |||
1342 | xfs_quiesce_data(mp); | 1368 | xfs_quiesce_data(mp); |
1369 | mp->m_resblks_save = mp->m_resblks; | ||
1370 | xfs_reserve_blocks(mp, &resblks, NULL); | ||
1343 | xfs_quiesce_attr(mp); | 1371 | xfs_quiesce_attr(mp); |
1344 | mp->m_flags |= XFS_MOUNT_RDONLY; | 1372 | mp->m_flags |= XFS_MOUNT_RDONLY; |
1345 | } | 1373 | } |