ffs_vfsops.c (108315) | ffs_vfsops.c (108316) |
---|---|
1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 | 1/* 2 * Copyright (c) 1989, 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 |
34 * $FreeBSD: head/sys/ufs/ffs/ffs_vfsops.c 108315 2002-12-27 10:23:03Z phk $ | 34 * $FreeBSD: head/sys/ufs/ffs/ffs_vfsops.c 108316 2002-12-27 11:05:05Z phk $ |
35 */ 36 37#include "opt_mac.h" 38#include "opt_quota.h" 39#include "opt_ufs.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 17 unchanged lines hidden (view full) --- 60#include <ufs/ufs/ufsmount.h> 61#include <ufs/ufs/inode.h> 62#include <ufs/ufs/ufs_extern.h> 63 64#include <ufs/ffs/fs.h> 65#include <ufs/ffs/ffs_extern.h> 66 67#include <vm/vm.h> | 35 */ 36 37#include "opt_mac.h" 38#include "opt_quota.h" 39#include "opt_ufs.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 17 unchanged lines hidden (view full) --- 60#include <ufs/ufs/ufsmount.h> 61#include <ufs/ufs/inode.h> 62#include <ufs/ufs/ufs_extern.h> 63 64#include <ufs/ffs/fs.h> 65#include <ufs/ffs/ffs_extern.h> 66 67#include <vm/vm.h> |
68#include <vm/uma.h> |
|
68#include <vm/vm_page.h> 69 | 69#include <vm/vm_page.h> 70 |
70static MALLOC_DEFINE(M_FFSNODE, "FFS node", "FFS vnode private part"); | 71uma_zone_t uma_inode, uma_ufs1, uma_ufs2; |
71 72static int ffs_sbupdate(struct ufsmount *, int); 73 int ffs_reload(struct mount *,struct ucred *,struct thread *); 74static int ffs_mountfs(struct vnode *, struct mount *, struct thread *); 75static void ffs_oldfscompat_read(struct fs *, struct ufsmount *, 76 ufs2_daddr_t); 77static void ffs_oldfscompat_write(struct fs *, struct ufsmount *); 78static void ffs_ifree(struct ufsmount *ump, struct inode *ip); --- 68 unchanged lines hidden (view full) --- 147 size_t size; 148 struct vnode *devvp; 149 struct ufs_args args; 150 struct ufsmount *ump = 0; 151 struct fs *fs; 152 int error, flags; 153 mode_t accessmode; 154 | 72 73static int ffs_sbupdate(struct ufsmount *, int); 74 int ffs_reload(struct mount *,struct ucred *,struct thread *); 75static int ffs_mountfs(struct vnode *, struct mount *, struct thread *); 76static void ffs_oldfscompat_read(struct fs *, struct ufsmount *, 77 ufs2_daddr_t); 78static void ffs_oldfscompat_write(struct fs *, struct ufsmount *); 79static void ffs_ifree(struct ufsmount *ump, struct inode *ip); --- 68 unchanged lines hidden (view full) --- 148 size_t size; 149 struct vnode *devvp; 150 struct ufs_args args; 151 struct ufsmount *ump = 0; 152 struct fs *fs; 153 int error, flags; 154 mode_t accessmode; 155 |
156 if (uma_inode == NULL) { 157 uma_inode = uma_zcreate("FFS inode", 158 sizeof(struct inode), NULL, NULL, NULL, NULL, 159 UMA_ALIGN_PTR, 0); 160 uma_ufs1 = uma_zcreate("FFS1 dinode", 161 sizeof(struct ufs1_dinode), NULL, NULL, NULL, NULL, 162 UMA_ALIGN_PTR, 0); 163 uma_ufs2 = uma_zcreate("FFS2 dinode", 164 sizeof(struct ufs2_dinode), NULL, NULL, NULL, NULL, 165 UMA_ALIGN_PTR, 0); 166 } |
|
155 /* 156 * Use NULL path to indicate we are mounting the root filesystem. 157 */ 158 if (path == NULL) { 159 if ((error = bdevvp(rootdev, &rootvp))) { 160 printf("ffs_mountroot: can't find rootvp\n"); 161 return (error); 162 } --- 1068 unchanged lines hidden (view full) --- 1231 1232 /* 1233 * If this MALLOC() is performed after the getnewvnode() 1234 * it might block, leaving a vnode with a NULL v_data to be 1235 * found by ffs_sync() if a sync happens to fire right then, 1236 * which will cause a panic because ffs_sync() blindly 1237 * dereferences vp->v_data (as well it should). 1238 */ | 167 /* 168 * Use NULL path to indicate we are mounting the root filesystem. 169 */ 170 if (path == NULL) { 171 if ((error = bdevvp(rootdev, &rootvp))) { 172 printf("ffs_mountroot: can't find rootvp\n"); 173 return (error); 174 } --- 1068 unchanged lines hidden (view full) --- 1243 1244 /* 1245 * If this MALLOC() is performed after the getnewvnode() 1246 * it might block, leaving a vnode with a NULL v_data to be 1247 * found by ffs_sync() if a sync happens to fire right then, 1248 * which will cause a panic because ffs_sync() blindly 1249 * dereferences vp->v_data (as well it should). 1250 */ |
1239 MALLOC(ip, struct inode *, sizeof(struct inode), 1240 M_FFSNODE, M_WAITOK); | 1251 ip = uma_zalloc(uma_inode, M_WAITOK); |
1241 1242 /* Allocate a new vnode/inode. */ 1243 error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp); 1244 if (error) { 1245 *vpp = NULL; | 1252 1253 /* Allocate a new vnode/inode. */ 1254 error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp); 1255 if (error) { 1256 *vpp = NULL; |
1246 FREE(ip, M_FFSNODE); | 1257 uma_zfree(uma_inode, ip); |
1247 return (error); 1248 } 1249 bzero((caddr_t)ip, sizeof(struct inode)); 1250 /* 1251 * FFS supports recursive locking. 1252 */ 1253 vp->v_vnlock->lk_flags |= LK_CANRECURSE; 1254 vp->v_data = ip; --- 44 unchanged lines hidden (view full) --- 1299 * list by vput(). 1300 */ 1301 brelse(bp); 1302 vput(vp); 1303 *vpp = NULL; 1304 return (error); 1305 } 1306 if (ip->i_ump->um_fstype == UFS1) | 1258 return (error); 1259 } 1260 bzero((caddr_t)ip, sizeof(struct inode)); 1261 /* 1262 * FFS supports recursive locking. 1263 */ 1264 vp->v_vnlock->lk_flags |= LK_CANRECURSE; 1265 vp->v_data = ip; --- 44 unchanged lines hidden (view full) --- 1310 * list by vput(). 1311 */ 1312 brelse(bp); 1313 vput(vp); 1314 *vpp = NULL; 1315 return (error); 1316 } 1317 if (ip->i_ump->um_fstype == UFS1) |
1307 MALLOC(ip->i_din1, struct ufs1_dinode *, 1308 sizeof(struct ufs1_dinode), M_FFSNODE, M_WAITOK); | 1318 ip->i_din1 = uma_zalloc(uma_ufs1, M_WAITOK); |
1309 else | 1319 else |
1310 MALLOC(ip->i_din2, struct ufs2_dinode *, 1311 sizeof(struct ufs2_dinode), M_FFSNODE, M_WAITOK); | 1320 ip->i_din2 = uma_zalloc(uma_ufs2, M_WAITOK); |
1312 ffs_load_inode(bp, ip, fs, ino); 1313 if (DOINGSOFTDEP(vp)) 1314 softdep_load_inodeblock(ip); 1315 else 1316 ip->i_effnlink = ip->i_nlink; 1317 bqrelse(bp); 1318 1319 /* --- 204 unchanged lines hidden (view full) --- 1524#endif 1525} 1526 1527static void 1528ffs_ifree(struct ufsmount *ump, struct inode *ip) 1529{ 1530 1531 if (ump->um_fstype == UFS1) | 1321 ffs_load_inode(bp, ip, fs, ino); 1322 if (DOINGSOFTDEP(vp)) 1323 softdep_load_inodeblock(ip); 1324 else 1325 ip->i_effnlink = ip->i_nlink; 1326 bqrelse(bp); 1327 1328 /* --- 204 unchanged lines hidden (view full) --- 1533#endif 1534} 1535 1536static void 1537ffs_ifree(struct ufsmount *ump, struct inode *ip) 1538{ 1539 1540 if (ump->um_fstype == UFS1) |
1532 FREE(ip->i_din1, M_FFSNODE); | 1541 uma_zfree(uma_ufs1, ip->i_din1); |
1533 else | 1542 else |
1534 FREE(ip->i_din2, M_FFSNODE); 1535 FREE(ip, M_FFSNODE); | 1543 uma_zfree(uma_ufs2, ip->i_din1); 1544 uma_zfree(uma_inode, ip); |
1536} | 1545} |