aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index e9c21454b9e..6ce828e0e17 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1256,6 +1256,29 @@ xfs_fs_statfs(
1256 return 0; 1256 return 0;
1257} 1257}
1258 1258
1259STATIC void
1260xfs_save_resvblks(struct xfs_mount *mp)
1261{
1262 __uint64_t resblks = 0;
1263
1264 mp->m_resblks_save = mp->m_resblks;
1265 xfs_reserve_blocks(mp, &resblks, NULL);
1266}
1267
1268STATIC void
1269xfs_restore_resvblks(struct xfs_mount *mp)
1270{
1271 __uint64_t resblks;
1272
1273 if (mp->m_resblks_save) {
1274 resblks = mp->m_resblks_save;
1275 mp->m_resblks_save = 0;
1276 } else
1277 resblks = xfs_default_resblks(mp);
1278
1279 xfs_reserve_blocks(mp, &resblks, NULL);
1280}
1281
1259STATIC int 1282STATIC int
1260xfs_fs_remount( 1283xfs_fs_remount(
1261 struct super_block *sb, 1284 struct super_block *sb,
@@ -1318,8 +1341,6 @@ xfs_fs_remount(
1318 1341
1319 /* ro -> rw */ 1342 /* ro -> rw */
1320 if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) { 1343 if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) {
1321 __uint64_t resblks;
1322
1323 mp->m_flags &= ~XFS_MOUNT_RDONLY; 1344 mp->m_flags &= ~XFS_MOUNT_RDONLY;
1324 if (mp->m_flags & XFS_MOUNT_BARRIER) 1345 if (mp->m_flags & XFS_MOUNT_BARRIER)
1325 xfs_mountfs_check_barriers(mp); 1346 xfs_mountfs_check_barriers(mp);
@@ -1342,15 +1363,7 @@ xfs_fs_remount(
1342 * Fill out the reserve pool if it is empty. Use the stashed 1363 * Fill out the reserve pool if it is empty. Use the stashed
1343 * value if it is non-zero, otherwise go with the default. 1364 * value if it is non-zero, otherwise go with the default.
1344 */ 1365 */
1345 if (mp->m_resblks_save) { 1366 xfs_restore_resvblks(mp);
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);
1354 } 1367 }
1355 1368
1356 /* rw -> ro */ 1369 /* rw -> ro */
@@ -1363,11 +1376,9 @@ xfs_fs_remount(
1363 * so that if we get remounted rw, we can return it to the same 1376 * so that if we get remounted rw, we can return it to the same
1364 * size. 1377 * size.
1365 */ 1378 */
1366 __uint64_t resblks = 0;
1367 1379
1368 xfs_quiesce_data(mp); 1380 xfs_quiesce_data(mp);
1369 mp->m_resblks_save = mp->m_resblks; 1381 xfs_save_resvblks(mp);
1370 xfs_reserve_blocks(mp, &resblks, NULL);
1371 xfs_quiesce_attr(mp); 1382 xfs_quiesce_attr(mp);
1372 mp->m_flags |= XFS_MOUNT_RDONLY; 1383 mp->m_flags |= XFS_MOUNT_RDONLY;
1373 } 1384 }
@@ -1386,11 +1397,22 @@ xfs_fs_freeze(
1386{ 1397{
1387 struct xfs_mount *mp = XFS_M(sb); 1398 struct xfs_mount *mp = XFS_M(sb);
1388 1399
1400 xfs_save_resvblks(mp);
1389 xfs_quiesce_attr(mp); 1401 xfs_quiesce_attr(mp);
1390 return -xfs_fs_log_dummy(mp); 1402 return -xfs_fs_log_dummy(mp);
1391} 1403}
1392 1404
1393STATIC int 1405STATIC int
1406xfs_fs_unfreeze(
1407 struct super_block *sb)
1408{
1409 struct xfs_mount *mp = XFS_M(sb);
1410
1411 xfs_restore_resvblks(mp);
1412 return 0;
1413}
1414
1415STATIC int
1394xfs_fs_show_options( 1416xfs_fs_show_options(
1395 struct seq_file *m, 1417 struct seq_file *m,
1396 struct vfsmount *mnt) 1418 struct vfsmount *mnt)
@@ -1612,6 +1634,7 @@ static const struct super_operations xfs_super_operations = {
1612 .put_super = xfs_fs_put_super, 1634 .put_super = xfs_fs_put_super,
1613 .sync_fs = xfs_fs_sync_fs, 1635 .sync_fs = xfs_fs_sync_fs,
1614 .freeze_fs = xfs_fs_freeze, 1636 .freeze_fs = xfs_fs_freeze,
1637 .unfreeze_fs = xfs_fs_unfreeze,
1615 .statfs = xfs_fs_statfs, 1638 .statfs = xfs_fs_statfs,
1616 .remount_fs = xfs_fs_remount, 1639 .remount_fs = xfs_fs_remount,
1617 .show_options = xfs_fs_show_options, 1640 .show_options = xfs_fs_show_options,