diff options
author | David Chinner <david@fromorbit.com> | 2008-10-30 02:06:28 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:06:28 -0400 |
commit | 75c68f411b1242c8fdaf731078fdd4e77b14981d (patch) | |
tree | 776eab26d76e14dc0478015d1f352c5d2bea9daa /fs/xfs | |
parent | a167b17e899a930758506bbc18748078d6fd8c89 (diff) |
[XFS] Remove xfs_iflush_all and clean up xfs_finish_reclaim_all()
xfs_iflush_all() walks the m_inodes list to find inodes that need
reclaiming. We already have such a list - the m_del_inodes list. Replace
xfs_iflush_all() with a call to xfs_finish_reclaim_all() and clean up
xfs_finish_reclaim_all() to handle the different flush modes now needed.
Originally based on a patch from Christoph Hellwig.
Version 3 o rediff against new linux-2.6/xfs_sync.c code
Version 2 o revert xfs_syncsub() inode reclaim behaviour back to original
code o xfs_quiesce_fs() should use XFS_IFLUSH_DELWRI_ELSE_ASYNC, not
XFS_IFLUSH_ASYNC, to prevent change of behaviour.
SGI-PV: 988139
SGI-Modid: xfs-linux-melb:xfs-kern:32284a
Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 35 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 42 |
6 files changed, 22 insertions, 64 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index a51534c71b36..cd82ba523dc4 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -504,7 +504,7 @@ xfs_syncsub( | |||
504 | 504 | ||
505 | if (flags & (SYNC_ATTR|SYNC_DELWRI)) { | 505 | if (flags & (SYNC_ATTR|SYNC_DELWRI)) { |
506 | if (flags & SYNC_BDFLUSH) | 506 | if (flags & SYNC_BDFLUSH) |
507 | xfs_finish_reclaim_all(mp, 1); | 507 | xfs_finish_reclaim_all(mp, 1, XFS_IFLUSH_DELWRI_ELSE_ASYNC); |
508 | else | 508 | else |
509 | error = xfs_sync_inodes(mp, flags, bypassed); | 509 | error = xfs_sync_inodes(mp, flags, bypassed); |
510 | } | 510 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 2b1294b8ad79..0c65ba2faa43 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -3499,41 +3499,6 @@ corrupt_out: | |||
3499 | } | 3499 | } |
3500 | 3500 | ||
3501 | 3501 | ||
3502 | /* | ||
3503 | * Flush all inactive inodes in mp. | ||
3504 | */ | ||
3505 | void | ||
3506 | xfs_iflush_all( | ||
3507 | xfs_mount_t *mp) | ||
3508 | { | ||
3509 | xfs_inode_t *ip; | ||
3510 | |||
3511 | again: | ||
3512 | XFS_MOUNT_ILOCK(mp); | ||
3513 | ip = mp->m_inodes; | ||
3514 | if (ip == NULL) | ||
3515 | goto out; | ||
3516 | |||
3517 | do { | ||
3518 | /* Make sure we skip markers inserted by sync */ | ||
3519 | if (ip->i_mount == NULL) { | ||
3520 | ip = ip->i_mnext; | ||
3521 | continue; | ||
3522 | } | ||
3523 | |||
3524 | if (!VFS_I(ip)) { | ||
3525 | XFS_MOUNT_IUNLOCK(mp); | ||
3526 | xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC); | ||
3527 | goto again; | ||
3528 | } | ||
3529 | |||
3530 | ASSERT(vn_count(VFS_I(ip)) == 0); | ||
3531 | |||
3532 | ip = ip->i_mnext; | ||
3533 | } while (ip != mp->m_inodes); | ||
3534 | out: | ||
3535 | XFS_MOUNT_IUNLOCK(mp); | ||
3536 | } | ||
3537 | 3502 | ||
3538 | #ifdef XFS_ILOCK_TRACE | 3503 | #ifdef XFS_ILOCK_TRACE |
3539 | ktrace_t *xfs_ilock_trace_buf; | 3504 | ktrace_t *xfs_ilock_trace_buf; |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index a8f1e6833aa6..104623b7ec6e 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -503,7 +503,7 @@ uint xfs_ilock_map_shared(xfs_inode_t *); | |||
503 | void xfs_iunlock_map_shared(xfs_inode_t *, uint); | 503 | void xfs_iunlock_map_shared(xfs_inode_t *, uint); |
504 | void xfs_ireclaim(xfs_inode_t *); | 504 | void xfs_ireclaim(xfs_inode_t *); |
505 | int xfs_finish_reclaim(xfs_inode_t *, int, int); | 505 | int xfs_finish_reclaim(xfs_inode_t *, int, int); |
506 | int xfs_finish_reclaim_all(struct xfs_mount *, int); | 506 | int xfs_finish_reclaim_all(struct xfs_mount *, int, int); |
507 | 507 | ||
508 | /* | 508 | /* |
509 | * xfs_inode.c prototypes. | 509 | * xfs_inode.c prototypes. |
@@ -530,7 +530,6 @@ void xfs_iext_realloc(xfs_inode_t *, int, int); | |||
530 | void xfs_ipin(xfs_inode_t *); | 530 | void xfs_ipin(xfs_inode_t *); |
531 | void xfs_iunpin(xfs_inode_t *); | 531 | void xfs_iunpin(xfs_inode_t *); |
532 | int xfs_iflush(xfs_inode_t *, uint); | 532 | int xfs_iflush(xfs_inode_t *, uint); |
533 | void xfs_iflush_all(struct xfs_mount *); | ||
534 | void xfs_ichgtime(xfs_inode_t *, int); | 533 | void xfs_ichgtime(xfs_inode_t *, int); |
535 | xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); | 534 | xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); |
536 | void xfs_lock_inodes(xfs_inode_t **, int, uint); | 535 | void xfs_lock_inodes(xfs_inode_t **, int, uint); |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 15f5dd22fbb2..5ec6032d230f 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1241,7 +1241,7 @@ xfs_unmountfs( | |||
1241 | * need to force the log first. | 1241 | * need to force the log first. |
1242 | */ | 1242 | */ |
1243 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); | 1243 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); |
1244 | xfs_iflush_all(mp); | 1244 | xfs_finish_reclaim_all(mp, 0, XFS_IFLUSH_ASYNC); |
1245 | 1245 | ||
1246 | XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); | 1246 | XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); |
1247 | 1247 | ||
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index 01e274b902c0..0c5ee5ec7ee4 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -66,7 +66,7 @@ xfs_quiesce_fs( | |||
66 | int count = 0, pincount; | 66 | int count = 0, pincount; |
67 | 67 | ||
68 | xfs_flush_buftarg(mp->m_ddev_targp, 0); | 68 | xfs_flush_buftarg(mp->m_ddev_targp, 0); |
69 | xfs_finish_reclaim_all(mp, 0); | 69 | xfs_finish_reclaim_all(mp, 0, XFS_IFLUSH_DELWRI_ELSE_ASYNC); |
70 | 70 | ||
71 | /* This loop must run at least twice. | 71 | /* This loop must run at least twice. |
72 | * The first instance of the loop will flush | 72 | * The first instance of the loop will flush |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 8b6812f66a15..a6714579a414 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2918,36 +2918,30 @@ xfs_finish_reclaim( | |||
2918 | } | 2918 | } |
2919 | 2919 | ||
2920 | int | 2920 | int |
2921 | xfs_finish_reclaim_all(xfs_mount_t *mp, int noblock) | 2921 | xfs_finish_reclaim_all( |
2922 | xfs_mount_t *mp, | ||
2923 | int noblock, | ||
2924 | int mode) | ||
2922 | { | 2925 | { |
2923 | int purged; | ||
2924 | xfs_inode_t *ip, *n; | 2926 | xfs_inode_t *ip, *n; |
2925 | int done = 0; | ||
2926 | 2927 | ||
2927 | while (!done) { | 2928 | restart: |
2928 | purged = 0; | 2929 | XFS_MOUNT_ILOCK(mp); |
2929 | XFS_MOUNT_ILOCK(mp); | 2930 | list_for_each_entry_safe(ip, n, &mp->m_del_inodes, i_reclaim) { |
2930 | list_for_each_entry_safe(ip, n, &mp->m_del_inodes, i_reclaim) { | 2931 | if (noblock) { |
2931 | if (noblock) { | 2932 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) |
2932 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) | 2933 | continue; |
2933 | continue; | 2934 | if (xfs_ipincount(ip) || |
2934 | if (xfs_ipincount(ip) || | 2935 | !xfs_iflock_nowait(ip)) { |
2935 | !xfs_iflock_nowait(ip)) { | 2936 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
2936 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 2937 | continue; |
2937 | continue; | ||
2938 | } | ||
2939 | } | 2938 | } |
2940 | XFS_MOUNT_IUNLOCK(mp); | ||
2941 | if (xfs_finish_reclaim(ip, noblock, | ||
2942 | XFS_IFLUSH_DELWRI_ELSE_ASYNC)) | ||
2943 | delay(1); | ||
2944 | purged = 1; | ||
2945 | break; | ||
2946 | } | 2939 | } |
2947 | 2940 | XFS_MOUNT_IUNLOCK(mp); | |
2948 | done = !purged; | 2941 | if (xfs_finish_reclaim(ip, noblock, mode)) |
2942 | delay(1); | ||
2943 | goto restart; | ||
2949 | } | 2944 | } |
2950 | |||
2951 | XFS_MOUNT_IUNLOCK(mp); | 2945 | XFS_MOUNT_IUNLOCK(mp); |
2952 | return 0; | 2946 | return 0; |
2953 | } | 2947 | } |