diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_sync.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index a51a07c3a70..dfcbd98d159 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -24,25 +24,14 @@ | |||
24 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
25 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
26 | #include "xfs_ag.h" | 26 | #include "xfs_ag.h" |
27 | #include "xfs_dir2.h" | ||
28 | #include "xfs_dmapi.h" | ||
29 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
30 | #include "xfs_bmap_btree.h" | 28 | #include "xfs_bmap_btree.h" |
31 | #include "xfs_alloc_btree.h" | ||
32 | #include "xfs_ialloc_btree.h" | ||
33 | #include "xfs_btree.h" | ||
34 | #include "xfs_dir2_sf.h" | ||
35 | #include "xfs_attr_sf.h" | ||
36 | #include "xfs_inode.h" | 29 | #include "xfs_inode.h" |
37 | #include "xfs_dinode.h" | 30 | #include "xfs_dinode.h" |
38 | #include "xfs_error.h" | 31 | #include "xfs_error.h" |
39 | #include "xfs_mru_cache.h" | ||
40 | #include "xfs_filestream.h" | 32 | #include "xfs_filestream.h" |
41 | #include "xfs_vnodeops.h" | 33 | #include "xfs_vnodeops.h" |
42 | #include "xfs_utils.h" | ||
43 | #include "xfs_buf_item.h" | ||
44 | #include "xfs_inode_item.h" | 34 | #include "xfs_inode_item.h" |
45 | #include "xfs_rw.h" | ||
46 | #include "xfs_quota.h" | 35 | #include "xfs_quota.h" |
47 | #include "xfs_trace.h" | 36 | #include "xfs_trace.h" |
48 | 37 | ||
@@ -319,7 +308,7 @@ xfs_sync_inode_attr( | |||
319 | /* | 308 | /* |
320 | * Write out pagecache data for the whole filesystem. | 309 | * Write out pagecache data for the whole filesystem. |
321 | */ | 310 | */ |
322 | int | 311 | STATIC int |
323 | xfs_sync_data( | 312 | xfs_sync_data( |
324 | struct xfs_mount *mp, | 313 | struct xfs_mount *mp, |
325 | int flags) | 314 | int flags) |
@@ -340,7 +329,7 @@ xfs_sync_data( | |||
340 | /* | 329 | /* |
341 | * Write out inode metadata (attributes) for the whole filesystem. | 330 | * Write out inode metadata (attributes) for the whole filesystem. |
342 | */ | 331 | */ |
343 | int | 332 | STATIC int |
344 | xfs_sync_attr( | 333 | xfs_sync_attr( |
345 | struct xfs_mount *mp, | 334 | struct xfs_mount *mp, |
346 | int flags) | 335 | int flags) |
@@ -373,8 +362,7 @@ xfs_commit_dummy_trans( | |||
373 | 362 | ||
374 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 363 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
375 | 364 | ||
376 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 365 | xfs_trans_ijoin(tp, ip); |
377 | xfs_trans_ihold(tp, ip); | ||
378 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 366 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
379 | error = xfs_trans_commit(tp, 0); | 367 | error = xfs_trans_commit(tp, 0); |
380 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 368 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
@@ -867,7 +855,36 @@ out: | |||
867 | reclaim: | 855 | reclaim: |
868 | xfs_ifunlock(ip); | 856 | xfs_ifunlock(ip); |
869 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 857 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
870 | xfs_ireclaim(ip); | 858 | |
859 | XFS_STATS_INC(xs_ig_reclaims); | ||
860 | /* | ||
861 | * Remove the inode from the per-AG radix tree. | ||
862 | * | ||
863 | * Because radix_tree_delete won't complain even if the item was never | ||
864 | * added to the tree assert that it's been there before to catch | ||
865 | * problems with the inode life time early on. | ||
866 | */ | ||
867 | write_lock(&pag->pag_ici_lock); | ||
868 | if (!radix_tree_delete(&pag->pag_ici_root, | ||
869 | XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino))) | ||
870 | ASSERT(0); | ||
871 | write_unlock(&pag->pag_ici_lock); | ||
872 | |||
873 | /* | ||
874 | * Here we do an (almost) spurious inode lock in order to coordinate | ||
875 | * with inode cache radix tree lookups. This is because the lookup | ||
876 | * can reference the inodes in the cache without taking references. | ||
877 | * | ||
878 | * We make that OK here by ensuring that we wait until the inode is | ||
879 | * unlocked after the lookup before we go ahead and free it. We get | ||
880 | * both the ilock and the iolock because the code may need to drop the | ||
881 | * ilock one but will still hold the iolock. | ||
882 | */ | ||
883 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
884 | xfs_qm_dqdetach(ip); | ||
885 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
886 | |||
887 | xfs_inode_free(ip); | ||
871 | return error; | 888 | return error; |
872 | 889 | ||
873 | } | 890 | } |