diff options
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 76 |
1 files changed, 24 insertions, 52 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index 7094caff13cf..fc48158fe479 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include "xfs_error.h" | 43 | #include "xfs_error.h" |
44 | #include "xfs_bmap.h" | 44 | #include "xfs_bmap.h" |
45 | #include "xfs_rw.h" | 45 | #include "xfs_rw.h" |
46 | #include "xfs_refcache.h" | ||
47 | #include "xfs_buf_item.h" | 46 | #include "xfs_buf_item.h" |
48 | #include "xfs_log_priv.h" | 47 | #include "xfs_log_priv.h" |
49 | #include "xfs_dir2_trace.h" | 48 | #include "xfs_dir2_trace.h" |
@@ -56,6 +55,7 @@ | |||
56 | #include "xfs_fsops.h" | 55 | #include "xfs_fsops.h" |
57 | #include "xfs_vnodeops.h" | 56 | #include "xfs_vnodeops.h" |
58 | #include "xfs_vfsops.h" | 57 | #include "xfs_vfsops.h" |
58 | #include "xfs_utils.h" | ||
59 | 59 | ||
60 | 60 | ||
61 | int __init | 61 | int __init |
@@ -69,15 +69,17 @@ xfs_init(void) | |||
69 | /* | 69 | /* |
70 | * Initialize all of the zone allocators we use. | 70 | * Initialize all of the zone allocators we use. |
71 | */ | 71 | */ |
72 | xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t), | ||
73 | "xfs_log_ticket"); | ||
72 | xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t), | 74 | xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t), |
73 | "xfs_bmap_free_item"); | 75 | "xfs_bmap_free_item"); |
74 | xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t), | 76 | xfs_btree_cur_zone = kmem_zone_init(sizeof(xfs_btree_cur_t), |
75 | "xfs_btree_cur"); | 77 | "xfs_btree_cur"); |
76 | xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans"); | 78 | xfs_da_state_zone = kmem_zone_init(sizeof(xfs_da_state_t), |
77 | xfs_da_state_zone = | 79 | "xfs_da_state"); |
78 | kmem_zone_init(sizeof(xfs_da_state_t), "xfs_da_state"); | ||
79 | xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf"); | 80 | xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf"); |
80 | xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork"); | 81 | xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork"); |
82 | xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans"); | ||
81 | xfs_acl_zone_init(xfs_acl_zone, "xfs_acl"); | 83 | xfs_acl_zone_init(xfs_acl_zone, "xfs_acl"); |
82 | xfs_mru_cache_init(); | 84 | xfs_mru_cache_init(); |
83 | xfs_filestream_init(); | 85 | xfs_filestream_init(); |
@@ -113,9 +115,6 @@ xfs_init(void) | |||
113 | xfs_ili_zone = | 115 | xfs_ili_zone = |
114 | kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili", | 116 | kmem_zone_init_flags(sizeof(xfs_inode_log_item_t), "xfs_ili", |
115 | KM_ZONE_SPREAD, NULL); | 117 | KM_ZONE_SPREAD, NULL); |
116 | xfs_icluster_zone = | ||
117 | kmem_zone_init_flags(sizeof(xfs_icluster_t), "xfs_icluster", | ||
118 | KM_ZONE_SPREAD, NULL); | ||
119 | 118 | ||
120 | /* | 119 | /* |
121 | * Allocate global trace buffers. | 120 | * Allocate global trace buffers. |
@@ -153,11 +152,9 @@ xfs_cleanup(void) | |||
153 | extern kmem_zone_t *xfs_inode_zone; | 152 | extern kmem_zone_t *xfs_inode_zone; |
154 | extern kmem_zone_t *xfs_efd_zone; | 153 | extern kmem_zone_t *xfs_efd_zone; |
155 | extern kmem_zone_t *xfs_efi_zone; | 154 | extern kmem_zone_t *xfs_efi_zone; |
156 | extern kmem_zone_t *xfs_icluster_zone; | ||
157 | 155 | ||
158 | xfs_cleanup_procfs(); | 156 | xfs_cleanup_procfs(); |
159 | xfs_sysctl_unregister(); | 157 | xfs_sysctl_unregister(); |
160 | xfs_refcache_destroy(); | ||
161 | xfs_filestream_uninit(); | 158 | xfs_filestream_uninit(); |
162 | xfs_mru_cache_uninit(); | 159 | xfs_mru_cache_uninit(); |
163 | xfs_acl_zone_destroy(xfs_acl_zone); | 160 | xfs_acl_zone_destroy(xfs_acl_zone); |
@@ -189,7 +186,6 @@ xfs_cleanup(void) | |||
189 | kmem_zone_destroy(xfs_efi_zone); | 186 | kmem_zone_destroy(xfs_efi_zone); |
190 | kmem_zone_destroy(xfs_ifork_zone); | 187 | kmem_zone_destroy(xfs_ifork_zone); |
191 | kmem_zone_destroy(xfs_ili_zone); | 188 | kmem_zone_destroy(xfs_ili_zone); |
192 | kmem_zone_destroy(xfs_icluster_zone); | ||
193 | } | 189 | } |
194 | 190 | ||
195 | /* | 191 | /* |
@@ -573,7 +569,7 @@ xfs_unmount( | |||
573 | #ifdef HAVE_DMAPI | 569 | #ifdef HAVE_DMAPI |
574 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | 570 | if (mp->m_flags & XFS_MOUNT_DMAPI) { |
575 | error = XFS_SEND_PREUNMOUNT(mp, | 571 | error = XFS_SEND_PREUNMOUNT(mp, |
576 | rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL, | 572 | rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL, |
577 | NULL, NULL, 0, 0, | 573 | NULL, NULL, 0, 0, |
578 | (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))? | 574 | (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))? |
579 | 0:DM_FLAGS_UNWANTED); | 575 | 0:DM_FLAGS_UNWANTED); |
@@ -584,11 +580,6 @@ xfs_unmount( | |||
584 | 0 : DM_FLAGS_UNWANTED; | 580 | 0 : DM_FLAGS_UNWANTED; |
585 | } | 581 | } |
586 | #endif | 582 | #endif |
587 | /* | ||
588 | * First blow any referenced inode from this file system | ||
589 | * out of the reference cache, and delete the timer. | ||
590 | */ | ||
591 | xfs_refcache_purge_mp(mp); | ||
592 | 583 | ||
593 | /* | 584 | /* |
594 | * Blow away any referenced inode in the filestreams cache. | 585 | * Blow away any referenced inode in the filestreams cache. |
@@ -607,7 +598,7 @@ xfs_unmount( | |||
607 | /* | 598 | /* |
608 | * Drop the reference count | 599 | * Drop the reference count |
609 | */ | 600 | */ |
610 | VN_RELE(rvp); | 601 | IRELE(rip); |
611 | 602 | ||
612 | /* | 603 | /* |
613 | * If we're forcing a shutdown, typically because of a media error, | 604 | * If we're forcing a shutdown, typically because of a media error, |
@@ -629,7 +620,7 @@ out: | |||
629 | /* Note: mp structure must still exist for | 620 | /* Note: mp structure must still exist for |
630 | * XFS_SEND_UNMOUNT() call. | 621 | * XFS_SEND_UNMOUNT() call. |
631 | */ | 622 | */ |
632 | XFS_SEND_UNMOUNT(mp, error == 0 ? rvp : NULL, | 623 | XFS_SEND_UNMOUNT(mp, error == 0 ? rip : NULL, |
633 | DM_RIGHT_NULL, 0, error, unmount_event_flags); | 624 | DM_RIGHT_NULL, 0, error, unmount_event_flags); |
634 | } | 625 | } |
635 | if (xfs_unmountfs_needed) { | 626 | if (xfs_unmountfs_needed) { |
@@ -646,13 +637,12 @@ out: | |||
646 | return XFS_ERROR(error); | 637 | return XFS_ERROR(error); |
647 | } | 638 | } |
648 | 639 | ||
649 | STATIC int | 640 | STATIC void |
650 | xfs_quiesce_fs( | 641 | xfs_quiesce_fs( |
651 | xfs_mount_t *mp) | 642 | xfs_mount_t *mp) |
652 | { | 643 | { |
653 | int count = 0, pincount; | 644 | int count = 0, pincount; |
654 | 645 | ||
655 | xfs_refcache_purge_mp(mp); | ||
656 | xfs_flush_buftarg(mp->m_ddev_targp, 0); | 646 | xfs_flush_buftarg(mp->m_ddev_targp, 0); |
657 | xfs_finish_reclaim_all(mp, 0); | 647 | xfs_finish_reclaim_all(mp, 0); |
658 | 648 | ||
@@ -671,8 +661,6 @@ xfs_quiesce_fs( | |||
671 | count++; | 661 | count++; |
672 | } | 662 | } |
673 | } while (count < 2); | 663 | } while (count < 2); |
674 | |||
675 | return 0; | ||
676 | } | 664 | } |
677 | 665 | ||
678 | /* | 666 | /* |
@@ -684,6 +672,8 @@ void | |||
684 | xfs_attr_quiesce( | 672 | xfs_attr_quiesce( |
685 | xfs_mount_t *mp) | 673 | xfs_mount_t *mp) |
686 | { | 674 | { |
675 | int error = 0; | ||
676 | |||
687 | /* wait for all modifications to complete */ | 677 | /* wait for all modifications to complete */ |
688 | while (atomic_read(&mp->m_active_trans) > 0) | 678 | while (atomic_read(&mp->m_active_trans) > 0) |
689 | delay(100); | 679 | delay(100); |
@@ -694,7 +684,11 @@ xfs_attr_quiesce( | |||
694 | ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0); | 684 | ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0); |
695 | 685 | ||
696 | /* Push the superblock and write an unmount record */ | 686 | /* Push the superblock and write an unmount record */ |
697 | xfs_log_sbcount(mp, 1); | 687 | error = xfs_log_sbcount(mp, 1); |
688 | if (error) | ||
689 | xfs_fs_cmn_err(CE_WARN, mp, | ||
690 | "xfs_attr_quiesce: failed to log sb changes. " | ||
691 | "Frozen image may not be consistent."); | ||
698 | xfs_log_unmount_write(mp); | 692 | xfs_log_unmount_write(mp); |
699 | xfs_unmountfs_writesb(mp); | 693 | xfs_unmountfs_writesb(mp); |
700 | } | 694 | } |
@@ -790,8 +784,8 @@ xfs_unmount_flush( | |||
790 | goto fscorrupt_out2; | 784 | goto fscorrupt_out2; |
791 | 785 | ||
792 | if (rbmip) { | 786 | if (rbmip) { |
793 | VN_RELE(XFS_ITOV(rbmip)); | 787 | IRELE(rbmip); |
794 | VN_RELE(XFS_ITOV(rsumip)); | 788 | IRELE(rsumip); |
795 | } | 789 | } |
796 | 790 | ||
797 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | 791 | xfs_iunlock(rip, XFS_ILOCK_EXCL); |
@@ -1169,10 +1163,10 @@ xfs_sync_inodes( | |||
1169 | * above, then wait until after we've unlocked | 1163 | * above, then wait until after we've unlocked |
1170 | * the inode to release the reference. This is | 1164 | * the inode to release the reference. This is |
1171 | * because we can be already holding the inode | 1165 | * because we can be already holding the inode |
1172 | * lock when VN_RELE() calls xfs_inactive(). | 1166 | * lock when IRELE() calls xfs_inactive(). |
1173 | * | 1167 | * |
1174 | * Make sure to drop the mount lock before calling | 1168 | * Make sure to drop the mount lock before calling |
1175 | * VN_RELE() so that we don't trip over ourselves if | 1169 | * IRELE() so that we don't trip over ourselves if |
1176 | * we have to go for the mount lock again in the | 1170 | * we have to go for the mount lock again in the |
1177 | * inactive code. | 1171 | * inactive code. |
1178 | */ | 1172 | */ |
@@ -1180,7 +1174,7 @@ xfs_sync_inodes( | |||
1180 | IPOINTER_INSERT(ip, mp); | 1174 | IPOINTER_INSERT(ip, mp); |
1181 | } | 1175 | } |
1182 | 1176 | ||
1183 | VN_RELE(vp); | 1177 | IRELE(ip); |
1184 | 1178 | ||
1185 | vnode_refed = B_FALSE; | 1179 | vnode_refed = B_FALSE; |
1186 | } | 1180 | } |
@@ -1323,30 +1317,8 @@ xfs_syncsub( | |||
1323 | } | 1317 | } |
1324 | 1318 | ||
1325 | /* | 1319 | /* |
1326 | * If this is the periodic sync, then kick some entries out of | ||
1327 | * the reference cache. This ensures that idle entries are | ||
1328 | * eventually kicked out of the cache. | ||
1329 | */ | ||
1330 | if (flags & SYNC_REFCACHE) { | ||
1331 | if (flags & SYNC_WAIT) | ||
1332 | xfs_refcache_purge_mp(mp); | ||
1333 | else | ||
1334 | xfs_refcache_purge_some(mp); | ||
1335 | } | ||
1336 | |||
1337 | /* | ||
1338 | * If asked, update the disk superblock with incore counter values if we | ||
1339 | * are using non-persistent counters so that they don't get too far out | ||
1340 | * of sync if we crash or get a forced shutdown. We don't want to force | ||
1341 | * this to disk, just get a transaction into the iclogs.... | ||
1342 | */ | ||
1343 | if (flags & SYNC_SUPER) | ||
1344 | xfs_log_sbcount(mp, 0); | ||
1345 | |||
1346 | /* | ||
1347 | * Now check to see if the log needs a "dummy" transaction. | 1320 | * Now check to see if the log needs a "dummy" transaction. |
1348 | */ | 1321 | */ |
1349 | |||
1350 | if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) { | 1322 | if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) { |
1351 | xfs_trans_t *tp; | 1323 | xfs_trans_t *tp; |
1352 | xfs_inode_t *ip; | 1324 | xfs_inode_t *ip; |