diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-05-19 21:30:52 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:58:20 -0400 |
commit | e48ad3160e5c5f5b952c7a7ed814f6f289a60100 (patch) | |
tree | 25f1c0d30cc6b88976ff5dd31f1f983248c238cf /fs/xfs/xfs_vfsops.c | |
parent | 61436febae29085bffc7c291db03cbd709dc68a3 (diff) |
[XFS] merge xfs_unmount into xfs_fs_put_super / xfs_fs_fill_super
xfs_unmount is small and already pretty Linux specific, so merge it into
the callers. The real unmount path is simplified a little by doing a
WARN_ON on the xfs_unmount_flush retval directly instead of propagating
the error back to the caller, and the mout failure case in simplified
significantly by removing the forced shutdown case and all the dmapi
events that shouldn't be sent because the dmapi mount event hasn't been
sent by that time either.
SGI-PV: 981951
SGI-Modid: xfs-linux-melb:xfs-kern:31188a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index e223aeab68be..bc34f90e7eea 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -558,93 +558,6 @@ error0: | |||
558 | return error; | 558 | return error; |
559 | } | 559 | } |
560 | 560 | ||
561 | int | ||
562 | xfs_unmount( | ||
563 | xfs_mount_t *mp, | ||
564 | int flags, | ||
565 | cred_t *credp) | ||
566 | { | ||
567 | xfs_inode_t *rip; | ||
568 | bhv_vnode_t *rvp; | ||
569 | int unmount_event_wanted = 0; | ||
570 | int unmount_event_flags = 0; | ||
571 | int xfs_unmountfs_needed = 0; | ||
572 | int error; | ||
573 | |||
574 | rip = mp->m_rootip; | ||
575 | rvp = XFS_ITOV(rip); | ||
576 | |||
577 | #ifdef HAVE_DMAPI | ||
578 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | ||
579 | error = XFS_SEND_PREUNMOUNT(mp, | ||
580 | rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL, | ||
581 | NULL, NULL, 0, 0, | ||
582 | (mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))? | ||
583 | 0:DM_FLAGS_UNWANTED); | ||
584 | if (error) | ||
585 | return XFS_ERROR(error); | ||
586 | unmount_event_wanted = 1; | ||
587 | unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))? | ||
588 | 0 : DM_FLAGS_UNWANTED; | ||
589 | } | ||
590 | #endif | ||
591 | |||
592 | /* | ||
593 | * Blow away any referenced inode in the filestreams cache. | ||
594 | * This can and will cause log traffic as inodes go inactive | ||
595 | * here. | ||
596 | */ | ||
597 | xfs_filestream_unmount(mp); | ||
598 | |||
599 | XFS_bflush(mp->m_ddev_targp); | ||
600 | error = xfs_unmount_flush(mp, 0); | ||
601 | if (error) | ||
602 | goto out; | ||
603 | |||
604 | ASSERT(vn_count(rvp) == 1); | ||
605 | |||
606 | /* | ||
607 | * Drop the reference count | ||
608 | */ | ||
609 | IRELE(rip); | ||
610 | |||
611 | /* | ||
612 | * If we're forcing a shutdown, typically because of a media error, | ||
613 | * we want to make sure we invalidate dirty pages that belong to | ||
614 | * referenced vnodes as well. | ||
615 | */ | ||
616 | if (XFS_FORCED_SHUTDOWN(mp)) { | ||
617 | error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE); | ||
618 | ASSERT(error != EFSCORRUPTED); | ||
619 | } | ||
620 | xfs_unmountfs_needed = 1; | ||
621 | |||
622 | out: | ||
623 | /* Send DMAPI event, if required. | ||
624 | * Then do xfs_unmountfs() if needed. | ||
625 | * Then return error (or zero). | ||
626 | */ | ||
627 | if (unmount_event_wanted) { | ||
628 | /* Note: mp structure must still exist for | ||
629 | * XFS_SEND_UNMOUNT() call. | ||
630 | */ | ||
631 | XFS_SEND_UNMOUNT(mp, error == 0 ? rip : NULL, | ||
632 | DM_RIGHT_NULL, 0, error, unmount_event_flags); | ||
633 | } | ||
634 | if (xfs_unmountfs_needed) { | ||
635 | /* | ||
636 | * Call common unmount function to flush to disk | ||
637 | * and free the super block buffer & mount structures. | ||
638 | */ | ||
639 | xfs_unmountfs(mp, credp); | ||
640 | xfs_qmops_put(mp); | ||
641 | xfs_dmops_put(mp); | ||
642 | kmem_free(mp); | ||
643 | } | ||
644 | |||
645 | return XFS_ERROR(error); | ||
646 | } | ||
647 | |||
648 | STATIC void | 561 | STATIC void |
649 | xfs_quiesce_fs( | 562 | xfs_quiesce_fs( |
650 | xfs_mount_t *mp) | 563 | xfs_mount_t *mp) |