diff options
Diffstat (limited to 'fs/xfs/linux-2.6')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 13 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 9 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 42 |
3 files changed, 21 insertions, 43 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 15412fe15c3a..b552f816de15 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -852,8 +852,8 @@ xfs_convert_page( | |||
| 852 | SetPageUptodate(page); | 852 | SetPageUptodate(page); |
| 853 | 853 | ||
| 854 | if (count) { | 854 | if (count) { |
| 855 | wbc->nr_to_write--; | 855 | if (--wbc->nr_to_write <= 0 && |
| 856 | if (wbc->nr_to_write <= 0) | 856 | wbc->sync_mode == WB_SYNC_NONE) |
| 857 | done = 1; | 857 | done = 1; |
| 858 | } | 858 | } |
| 859 | xfs_start_page_writeback(page, !page_dirty, count); | 859 | xfs_start_page_writeback(page, !page_dirty, count); |
| @@ -1068,7 +1068,7 @@ xfs_vm_writepage( | |||
| 1068 | * by themselves. | 1068 | * by themselves. |
| 1069 | */ | 1069 | */ |
| 1070 | if ((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC) | 1070 | if ((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC) |
| 1071 | goto out_fail; | 1071 | goto redirty; |
| 1072 | 1072 | ||
| 1073 | /* | 1073 | /* |
| 1074 | * We need a transaction if there are delalloc or unwritten buffers | 1074 | * We need a transaction if there are delalloc or unwritten buffers |
| @@ -1080,7 +1080,7 @@ xfs_vm_writepage( | |||
| 1080 | */ | 1080 | */ |
| 1081 | xfs_count_page_state(page, &delalloc, &unwritten); | 1081 | xfs_count_page_state(page, &delalloc, &unwritten); |
| 1082 | if ((current->flags & PF_FSTRANS) && (delalloc || unwritten)) | 1082 | if ((current->flags & PF_FSTRANS) && (delalloc || unwritten)) |
| 1083 | goto out_fail; | 1083 | goto redirty; |
| 1084 | 1084 | ||
| 1085 | /* Is this page beyond the end of the file? */ | 1085 | /* Is this page beyond the end of the file? */ |
| 1086 | offset = i_size_read(inode); | 1086 | offset = i_size_read(inode); |
| @@ -1245,12 +1245,15 @@ error: | |||
| 1245 | if (iohead) | 1245 | if (iohead) |
| 1246 | xfs_cancel_ioend(iohead); | 1246 | xfs_cancel_ioend(iohead); |
| 1247 | 1247 | ||
| 1248 | if (err == -EAGAIN) | ||
| 1249 | goto redirty; | ||
| 1250 | |||
| 1248 | xfs_aops_discard_page(page); | 1251 | xfs_aops_discard_page(page); |
| 1249 | ClearPageUptodate(page); | 1252 | ClearPageUptodate(page); |
| 1250 | unlock_page(page); | 1253 | unlock_page(page); |
| 1251 | return err; | 1254 | return err; |
| 1252 | 1255 | ||
| 1253 | out_fail: | 1256 | redirty: |
| 1254 | redirty_page_for_writepage(wbc, page); | 1257 | redirty_page_for_writepage(wbc, page); |
| 1255 | unlock_page(page); | 1258 | unlock_page(page); |
| 1256 | return 0; | 1259 | return 0; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 15c35b62ff14..a4e07974955b 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
| @@ -1226,6 +1226,7 @@ xfs_fs_statfs( | |||
| 1226 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 1226 | struct xfs_inode *ip = XFS_I(dentry->d_inode); |
| 1227 | __uint64_t fakeinos, id; | 1227 | __uint64_t fakeinos, id; |
| 1228 | xfs_extlen_t lsize; | 1228 | xfs_extlen_t lsize; |
| 1229 | __int64_t ffree; | ||
| 1229 | 1230 | ||
| 1230 | statp->f_type = XFS_SB_MAGIC; | 1231 | statp->f_type = XFS_SB_MAGIC; |
| 1231 | statp->f_namelen = MAXNAMELEN - 1; | 1232 | statp->f_namelen = MAXNAMELEN - 1; |
| @@ -1249,7 +1250,11 @@ xfs_fs_statfs( | |||
| 1249 | statp->f_files = min_t(typeof(statp->f_files), | 1250 | statp->f_files = min_t(typeof(statp->f_files), |
| 1250 | statp->f_files, | 1251 | statp->f_files, |
| 1251 | mp->m_maxicount); | 1252 | mp->m_maxicount); |
| 1252 | statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); | 1253 | |
| 1254 | /* make sure statp->f_ffree does not underflow */ | ||
| 1255 | ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); | ||
| 1256 | statp->f_ffree = max_t(__int64_t, ffree, 0); | ||
| 1257 | |||
| 1253 | spin_unlock(&mp->m_sb_lock); | 1258 | spin_unlock(&mp->m_sb_lock); |
| 1254 | 1259 | ||
| 1255 | if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) || | 1260 | if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) || |
| @@ -1402,7 +1407,7 @@ xfs_fs_freeze( | |||
| 1402 | 1407 | ||
| 1403 | xfs_save_resvblks(mp); | 1408 | xfs_save_resvblks(mp); |
| 1404 | xfs_quiesce_attr(mp); | 1409 | xfs_quiesce_attr(mp); |
| 1405 | return -xfs_fs_log_dummy(mp); | 1410 | return -xfs_fs_log_dummy(mp, SYNC_WAIT); |
| 1406 | } | 1411 | } |
| 1407 | 1412 | ||
| 1408 | STATIC int | 1413 | STATIC int |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index dfcbd98d1599..d59c4a65d492 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include "xfs_inode_item.h" | 34 | #include "xfs_inode_item.h" |
| 35 | #include "xfs_quota.h" | 35 | #include "xfs_quota.h" |
| 36 | #include "xfs_trace.h" | 36 | #include "xfs_trace.h" |
| 37 | #include "xfs_fsops.h" | ||
| 37 | 38 | ||
| 38 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
| 39 | #include <linux/freezer.h> | 40 | #include <linux/freezer.h> |
| @@ -341,38 +342,6 @@ xfs_sync_attr( | |||
| 341 | } | 342 | } |
| 342 | 343 | ||
| 343 | STATIC int | 344 | STATIC int |
| 344 | xfs_commit_dummy_trans( | ||
| 345 | struct xfs_mount *mp, | ||
| 346 | uint flags) | ||
| 347 | { | ||
| 348 | struct xfs_inode *ip = mp->m_rootip; | ||
| 349 | struct xfs_trans *tp; | ||
| 350 | int error; | ||
| 351 | |||
| 352 | /* | ||
| 353 | * Put a dummy transaction in the log to tell recovery | ||
| 354 | * that all others are OK. | ||
| 355 | */ | ||
| 356 | tp = xfs_trans_alloc(mp, XFS_TRANS_DUMMY1); | ||
| 357 | error = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0); | ||
| 358 | if (error) { | ||
| 359 | xfs_trans_cancel(tp, 0); | ||
| 360 | return error; | ||
| 361 | } | ||
| 362 | |||
| 363 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
| 364 | |||
| 365 | xfs_trans_ijoin(tp, ip); | ||
| 366 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
| 367 | error = xfs_trans_commit(tp, 0); | ||
| 368 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
| 369 | |||
| 370 | /* the log force ensures this transaction is pushed to disk */ | ||
| 371 | xfs_log_force(mp, (flags & SYNC_WAIT) ? XFS_LOG_SYNC : 0); | ||
| 372 | return error; | ||
| 373 | } | ||
| 374 | |||
| 375 | STATIC int | ||
| 376 | xfs_sync_fsdata( | 345 | xfs_sync_fsdata( |
| 377 | struct xfs_mount *mp) | 346 | struct xfs_mount *mp) |
| 378 | { | 347 | { |
| @@ -432,7 +401,7 @@ xfs_quiesce_data( | |||
| 432 | 401 | ||
| 433 | /* mark the log as covered if needed */ | 402 | /* mark the log as covered if needed */ |
| 434 | if (xfs_log_need_covered(mp)) | 403 | if (xfs_log_need_covered(mp)) |
| 435 | error2 = xfs_commit_dummy_trans(mp, SYNC_WAIT); | 404 | error2 = xfs_fs_log_dummy(mp, SYNC_WAIT); |
| 436 | 405 | ||
| 437 | /* flush data-only devices */ | 406 | /* flush data-only devices */ |
| 438 | if (mp->m_rtdev_targp) | 407 | if (mp->m_rtdev_targp) |
| @@ -563,7 +532,7 @@ xfs_flush_inodes( | |||
| 563 | /* | 532 | /* |
| 564 | * Every sync period we need to unpin all items, reclaim inodes and sync | 533 | * Every sync period we need to unpin all items, reclaim inodes and sync |
| 565 | * disk quotas. We might need to cover the log to indicate that the | 534 | * disk quotas. We might need to cover the log to indicate that the |
| 566 | * filesystem is idle. | 535 | * filesystem is idle and not frozen. |
| 567 | */ | 536 | */ |
| 568 | STATIC void | 537 | STATIC void |
| 569 | xfs_sync_worker( | 538 | xfs_sync_worker( |
| @@ -577,8 +546,9 @@ xfs_sync_worker( | |||
| 577 | xfs_reclaim_inodes(mp, 0); | 546 | xfs_reclaim_inodes(mp, 0); |
| 578 | /* dgc: errors ignored here */ | 547 | /* dgc: errors ignored here */ |
| 579 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); | 548 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
| 580 | if (xfs_log_need_covered(mp)) | 549 | if (mp->m_super->s_frozen == SB_UNFROZEN && |
| 581 | error = xfs_commit_dummy_trans(mp, 0); | 550 | xfs_log_need_covered(mp)) |
| 551 | error = xfs_fs_log_dummy(mp, 0); | ||
| 582 | } | 552 | } |
| 583 | mp->m_sync_seq++; | 553 | mp->m_sync_seq++; |
| 584 | wake_up(&mp->m_wait_single_sync_task); | 554 | wake_up(&mp->m_wait_single_sync_task); |
