aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-04-23 01:59:03 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:59 -0400
commit2af51f3a4ef93945d20ff27ab28c5c68b5a21efc (patch)
treeb07fb8fefd07abcbd3d14cb8ad724f0060e528e5 /fs
parent2a0ec1d9ed7f3aa7974fccfbb612fadda2e10bad (diff)
xfs: move xfs_do_force_shutdown() and kill xfs_rw.c
xfs_do_force_shutdown now is the only thing in xfs_rw.c. There is no need to keep it in it's own file anymore, so move it to xfs_fsops.c next to xfs_fs_goingdown() and kill xfs_rw.c. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/Makefile1
-rw-r--r--fs/xfs/xfs_fsops.c60
-rw-r--r--fs/xfs/xfs_rw.c90
3 files changed, 60 insertions, 91 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index ca9229ff8ac0..d2bf974b1a2f 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -50,7 +50,6 @@ xfs-y += xfs_aops.o \
50 xfs_sync.o \ 50 xfs_sync.o \
51 xfs_xattr.o \ 51 xfs_xattr.o \
52 xfs_rename.o \ 52 xfs_rename.o \
53 xfs_rw.o \
54 xfs_utils.o \ 53 xfs_utils.o \
55 xfs_vnodeops.o \ 54 xfs_vnodeops.o \
56 kmem.o \ 55 kmem.o \
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index f6c7698c9a75..537c2aeb1ad2 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -688,3 +688,63 @@ xfs_fs_goingdown(
688 688
689 return 0; 689 return 0;
690} 690}
691
692/*
693 * Force a shutdown of the filesystem instantly while keeping the filesystem
694 * consistent. We don't do an unmount here; just shutdown the shop, make sure
695 * that absolutely nothing persistent happens to this filesystem after this
696 * point.
697 */
698void
699xfs_do_force_shutdown(
700 xfs_mount_t *mp,
701 int flags,
702 char *fname,
703 int lnnum)
704{
705 int logerror;
706
707 logerror = flags & SHUTDOWN_LOG_IO_ERROR;
708
709 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
710 xfs_notice(mp,
711 "%s(0x%x) called from line %d of file %s. Return address = 0x%p",
712 __func__, flags, lnnum, fname, __return_address);
713 }
714 /*
715 * No need to duplicate efforts.
716 */
717 if (XFS_FORCED_SHUTDOWN(mp) && !logerror)
718 return;
719
720 /*
721 * This flags XFS_MOUNT_FS_SHUTDOWN, makes sure that we don't
722 * queue up anybody new on the log reservations, and wakes up
723 * everybody who's sleeping on log reservations to tell them
724 * the bad news.
725 */
726 if (xfs_log_force_umount(mp, logerror))
727 return;
728
729 if (flags & SHUTDOWN_CORRUPT_INCORE) {
730 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
731 "Corruption of in-memory data detected. Shutting down filesystem");
732 if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
733 xfs_stack_trace();
734 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
735 if (logerror) {
736 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
737 "Log I/O Error Detected. Shutting down filesystem");
738 } else if (flags & SHUTDOWN_DEVICE_REQ) {
739 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
740 "All device paths lost. Shutting down filesystem");
741 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
742 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
743 "I/O Error Detected. Shutting down filesystem");
744 }
745 }
746 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
747 xfs_alert(mp,
748 "Please umount the filesystem and rectify the problem(s)");
749 }
750}
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
deleted file mode 100644
index c406cb6075fa..000000000000
--- a/fs/xfs/xfs_rw.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#include "xfs.h"
19#include "xfs_fs.h"
20#include "xfs_types.h"
21#include "xfs_bit.h"
22#include "xfs_log.h"
23#include "xfs_trans.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h"
27#include "xfs_bmap_btree.h"
28#include "xfs_dinode.h"
29#include "xfs_inode.h"
30#include "xfs_error.h"
31
32/*
33 * Force a shutdown of the filesystem instantly while keeping
34 * the filesystem consistent. We don't do an unmount here; just shutdown
35 * the shop, make sure that absolutely nothing persistent happens to
36 * this filesystem after this point.
37 */
38void
39xfs_do_force_shutdown(
40 xfs_mount_t *mp,
41 int flags,
42 char *fname,
43 int lnnum)
44{
45 int logerror;
46
47 logerror = flags & SHUTDOWN_LOG_IO_ERROR;
48
49 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
50 xfs_notice(mp,
51 "%s(0x%x) called from line %d of file %s. Return address = 0x%p",
52 __func__, flags, lnnum, fname, __return_address);
53 }
54 /*
55 * No need to duplicate efforts.
56 */
57 if (XFS_FORCED_SHUTDOWN(mp) && !logerror)
58 return;
59
60 /*
61 * This flags XFS_MOUNT_FS_SHUTDOWN, makes sure that we don't
62 * queue up anybody new on the log reservations, and wakes up
63 * everybody who's sleeping on log reservations to tell them
64 * the bad news.
65 */
66 if (xfs_log_force_umount(mp, logerror))
67 return;
68
69 if (flags & SHUTDOWN_CORRUPT_INCORE) {
70 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
71 "Corruption of in-memory data detected. Shutting down filesystem");
72 if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
73 xfs_stack_trace();
74 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
75 if (logerror) {
76 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
77 "Log I/O Error Detected. Shutting down filesystem");
78 } else if (flags & SHUTDOWN_DEVICE_REQ) {
79 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
80 "All device paths lost. Shutting down filesystem");
81 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
82 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
83 "I/O Error Detected. Shutting down filesystem");
84 }
85 }
86 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
87 xfs_alert(mp,
88 "Please umount the filesystem and rectify the problem(s)");
89 }
90}