Blame view
fs/jfs/jfs_umount.c
3.98 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 |
/* * Copyright (C) International Business Machines Corp., 2000-2004 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |
63f83c9fc JFS: White space ... |
6 |
* the Free Software Foundation; either version 2 of the License, or |
1da177e4c Linux-2.6.12-rc2 |
7 |
* (at your option) any later version. |
63f83c9fc JFS: White space ... |
8 |
* |
1da177e4c Linux-2.6.12-rc2 |
9 10 11 12 13 14 |
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
63f83c9fc JFS: White space ... |
15 |
* along with this program; if not, write to the Free Software |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 21 22 23 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * jfs_umount.c * * note: file system in transition to aggregate/fileset: * (ref. jfs_mount.c) * |
63f83c9fc JFS: White space ... |
25 26 |
* file system unmount is interpreted as mount of the single/only * fileset in the aggregate and, if unmount of the last fileset, |
1da177e4c Linux-2.6.12-rc2 |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
* as unmount of the aggerate; */ #include <linux/fs.h> #include "jfs_incore.h" #include "jfs_filsys.h" #include "jfs_superblock.h" #include "jfs_dmap.h" #include "jfs_imap.h" #include "jfs_metapage.h" #include "jfs_debug.h" /* * NAME: jfs_umount(vfsp, flags, crp) * * FUNCTION: vfs_umount() * * PARAMETERS: vfsp - virtual file system pointer * flags - unmount for shutdown * crp - credential * * RETURN : EBUSY - device has open files */ int jfs_umount(struct super_block *sb) { |
1da177e4c Linux-2.6.12-rc2 |
52 53 54 55 56 57 58 59 60 61 62 |
struct jfs_sb_info *sbi = JFS_SBI(sb); struct inode *ipbmap = sbi->ipbmap; struct inode *ipimap = sbi->ipimap; struct inode *ipaimap = sbi->ipaimap; struct inode *ipaimap2 = sbi->ipaimap2; struct jfs_log *log; int rc = 0; jfs_info("UnMount JFS: sb:0x%p", sb); /* |
f720e3ba5 JFS: Whitespace c... |
63 |
* update superblock and close log |
1da177e4c Linux-2.6.12-rc2 |
64 65 66 67 68 |
* * if mounted read-write and log based recovery was enabled */ if ((log = sbi->log)) /* |
63f83c9fc JFS: White space ... |
69 |
* Wait for outstanding transactions to be written to log: |
1da177e4c Linux-2.6.12-rc2 |
70 |
*/ |
1c8007b07 jfs: flush journa... |
71 |
jfs_flush_journal(log, 2); |
1da177e4c Linux-2.6.12-rc2 |
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
/* * close fileset inode allocation map (aka fileset inode) */ diUnmount(ipimap, 0); diFreeSpecial(ipimap); sbi->ipimap = NULL; /* * close secondary aggregate inode allocation map */ ipaimap2 = sbi->ipaimap2; if (ipaimap2) { diUnmount(ipaimap2, 0); diFreeSpecial(ipaimap2); sbi->ipaimap2 = NULL; } /* * close aggregate inode allocation map */ ipaimap = sbi->ipaimap; diUnmount(ipaimap, 0); diFreeSpecial(ipaimap); sbi->ipaimap = NULL; /* * close aggregate block allocation map */ dbUnmount(ipbmap, 0); diFreeSpecial(ipbmap); sbi->ipimap = NULL; /* * Make sure all metadata makes it to disk before we mark * the superblock as clean */ |
28fd12982 [PATCH] Fix and a... |
111 |
filemap_write_and_wait(sbi->direct_inode->i_mapping); |
1da177e4c Linux-2.6.12-rc2 |
112 113 114 |
/* * ensure all file system file pages are propagated to their |
63f83c9fc JFS: White space ... |
115 |
* home blocks on disk (and their in-memory buffer pages are |
1da177e4c Linux-2.6.12-rc2 |
116 |
* invalidated) BEFORE updating file system superblock state |
63f83c9fc JFS: White space ... |
117 118 |
* (to signify file system is unmounted cleanly, and thus in * consistent state) and log superblock active file system |
1da177e4c Linux-2.6.12-rc2 |
119 120 121 122 |
* list (to signify skip logredo()). */ if (log) { /* log = NULL if read-only mount */ updateSuper(sb, FM_CLEAN); |
1da177e4c Linux-2.6.12-rc2 |
123 |
/* |
63f83c9fc JFS: White space ... |
124 |
* close log: |
1da177e4c Linux-2.6.12-rc2 |
125 126 127 128 129 130 131 132 133 134 135 136 |
* * remove file system from log active file system list. */ rc = lmLogClose(sb); } jfs_info("UnMount JFS Complete: rc = %d", rc); return rc; } int jfs_umount_rw(struct super_block *sb) { |
1da177e4c Linux-2.6.12-rc2 |
137 138 139 140 141 142 143 |
struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_log *log = sbi->log; if (!log) return 0; /* |
63f83c9fc JFS: White space ... |
144 |
* close log: |
1da177e4c Linux-2.6.12-rc2 |
145 146 147 |
* * remove file system from log active file system list. */ |
1c8007b07 jfs: flush journa... |
148 |
jfs_flush_journal(log, 2); |
1da177e4c Linux-2.6.12-rc2 |
149 150 151 152 153 154 155 156 157 158 159 160 161 |
/* * Make sure all metadata makes it to disk */ dbSync(sbi->ipbmap); diSync(sbi->ipimap); /* * Note that we have to do this even if sync_blockdev() will * do exactly the same a few instructions later: We can't * mark the superblock clean before everything is flushed to * disk. */ |
28fd12982 [PATCH] Fix and a... |
162 |
filemap_write_and_wait(sbi->direct_inode->i_mapping); |
1da177e4c Linux-2.6.12-rc2 |
163 164 |
updateSuper(sb, FM_CLEAN); |
1da177e4c Linux-2.6.12-rc2 |
165 166 |
return lmLogClose(sb); } |