Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs While creating a snapshot inodes must be freed f...
details: https://anonhg.NetBSD.org/src/rev/bb98baabb8cf
branches: trunk
changeset: 569678:bb98baabb8cf
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Aug 29 10:13:48 2004 +0000
description:
While creating a snapshot inodes must be freed from the
snapshot, not from the file system.
ffs_freefile() needs explicit "fs" and "devvp" arguments.
diffstat:
sys/ufs/ffs/ffs_alloc.c | 37 ++++++++++++++++++-------------------
sys/ufs/ffs/ffs_extern.h | 4 ++--
sys/ufs/ffs/ffs_snapshot.c | 12 ++++--------
sys/ufs/ffs/ffs_softdep.c | 19 ++++---------------
4 files changed, 28 insertions(+), 44 deletions(-)
diffs (201 lines):
diff -r 8a7c2ca397eb -r bb98baabb8cf sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c Sun Aug 29 08:16:18 2004 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c Sun Aug 29 10:13:48 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_alloc.c,v 1.77 2004/05/26 20:33:10 hannken Exp $ */
+/* $NetBSD: ffs_alloc.c,v 1.78 2004/08/29 10:13:48 hannken Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.77 2004/05/26 20:33:10 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.78 2004/08/29 10:13:48 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -1752,7 +1752,8 @@
softdep_freefile(ap);
return (0);
}
- return (ffs_freefile(ap));
+ return (ffs_freefile(VTOI(ap->a_pvp)->i_fs, VTOI(ap->a_pvp)->i_devvp,
+ ap->a_ino, ap->a_mode));
}
/*
@@ -1760,37 +1761,35 @@
* The specified inode is placed back in the free map.
*/
int
-ffs_freefile(v)
- void *v;
+ffs_freefile(fs, devvp, ino, mode)
+ struct fs *fs;
+ struct vnode *devvp;
+ ino_t ino;
+ int mode;
{
- struct vop_vfree_args /* {
- struct vnode *a_pvp;
- ino_t a_ino;
- int a_mode;
- } */ *ap = v;
struct cg *cgp;
- struct inode *pip = VTOI(ap->a_pvp);
- struct fs *fs = pip->i_fs;
- ino_t ino = ap->a_ino;
struct buf *bp;
int error, cg;
daddr_t cgbno;
u_int8_t *inosused;
+ dev_t dev;
#ifdef FFS_EI
const int needswap = UFS_FSNEEDSWAP(fs);
#endif
cg = ino_to_cg(fs, ino);
- if (pip->i_devvp->v_type != VBLK) {
- /* pip->i_devvp is a snapshot */
+ if (devvp->v_type != VBLK) {
+ /* devvp is a snapshot */
+ dev = VTOI(devvp)->i_devvp->v_rdev;
cgbno = fragstoblks(fs, cgtod(fs, cg));
} else {
+ dev = devvp->v_rdev;
cgbno = fsbtodb(fs, cgtod(fs, cg));
}
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
panic("ifree: range: dev = 0x%x, ino = %d, fs = %s",
- pip->i_dev, ino, fs->fs_fsmnt);
- error = bread(pip->i_devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp);
+ dev, ino, fs->fs_fsmnt);
+ error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp);
if (error) {
brelse(bp);
return (error);
@@ -1808,7 +1807,7 @@
ino %= fs->fs_ipg;
if (isclr(inosused, ino)) {
printf("dev = 0x%x, ino = %d, fs = %s\n",
- pip->i_dev, ino, fs->fs_fsmnt);
+ dev, ino, fs->fs_fsmnt);
if (fs->fs_ronly == 0)
panic("ifree: freeing free inode");
}
@@ -1818,7 +1817,7 @@
ufs_add32(cgp->cg_cs.cs_nifree, 1, needswap);
fs->fs_cstotal.cs_nifree++;
fs->fs_cs(fs, cg).cs_nifree++;
- if ((ap->a_mode & IFMT) == IFDIR) {
+ if ((mode & IFMT) == IFDIR) {
ufs_add32(cgp->cg_cs.cs_ndir, -1, needswap);
fs->fs_cstotal.cs_ndir--;
fs->fs_cs(fs, cg).cs_ndir--;
diff -r 8a7c2ca397eb -r bb98baabb8cf sys/ufs/ffs/ffs_extern.h
--- a/sys/ufs/ffs/ffs_extern.h Sun Aug 29 08:16:18 2004 +0000
+++ b/sys/ufs/ffs/ffs_extern.h Sun Aug 29 10:13:48 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_extern.h,v 1.40 2004/06/04 07:43:56 he Exp $ */
+/* $NetBSD: ffs_extern.h,v 1.41 2004/08/29 10:13:48 hannken Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -110,7 +110,7 @@
/* ffs_subr.c */
void ffs_load_inode __P((struct buf *, struct inode *, struct fs *, ino_t));
int ffs_blkatoff __P((void *));
-int ffs_freefile __P((void *));
+int ffs_freefile __P((struct fs *, struct vnode *, ino_t, int));
void ffs_fragacct __P((struct fs *, int, int32_t[], int, int));
#ifdef DIAGNOSTIC
void ffs_checkoverlap __P((struct buf *, struct inode *));
diff -r 8a7c2ca397eb -r bb98baabb8cf sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Sun Aug 29 08:16:18 2004 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Sun Aug 29 10:13:48 2004 +0000
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.5 2004/06/30 18:42:17 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.6 2004/08/29 10:13:48 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -147,7 +147,6 @@
struct buf *bp, *ibp;
struct vattr vat;
struct vnode *xvp, *nvp, *devvp;
- struct vop_vfree_args args;
ns = UFS_FSNEEDSWAP(fs);
/*
@@ -405,12 +404,9 @@
BLK_NOCOPY);
if (blkno)
db_assign(xp, loc, blkno);
- if (!error) {
- args.a_pvp = vp;
- args.a_ino = xp->i_number;
- args.a_mode = xp->i_mode;
- error = ffs_freefile(&args);
- }
+ if (!error)
+ error = ffs_freefile(copy_fs, vp, xp->i_number,
+ xp->i_mode);
VOP_UNLOCK(xvp, 0);
if (error) {
free(copy_fs->fs_csp, M_UFSMNT);
diff -r 8a7c2ca397eb -r bb98baabb8cf sys/ufs/ffs/ffs_softdep.c
--- a/sys/ufs/ffs/ffs_softdep.c Sun Aug 29 08:16:18 2004 +0000
+++ b/sys/ufs/ffs/ffs_softdep.c Sun Aug 29 10:13:48 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_softdep.c,v 1.59 2004/05/25 14:54:59 hannken Exp $ */
+/* $NetBSD: ffs_softdep.c,v 1.60 2004/08/29 10:13:48 hannken Exp $ */
/*
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.59 2004/05/25 14:54:59 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.60 2004/08/29 10:13:48 hannken Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -3362,12 +3362,9 @@
handle_workitem_freefile(freefile)
struct freefile *freefile;
{
- struct vnode vp;
- struct inode tip;
#ifdef DEBUG
struct inodedep *idp;
#endif
- struct vop_vfree_args args;
int error;
#ifdef DEBUG
@@ -3376,17 +3373,9 @@
panic("handle_workitem_freefile: inodedep survived");
FREE_LOCK(&lk);
#endif
- tip.i_devvp = freefile->fx_devvp;
- tip.i_dev = freefile->fx_devvp->v_rdev;
- tip.i_fs = freefile->fx_fs;
freefile->fx_fs->fs_pendinginodes -= 1;
- vp.v_data = &tip;
- vp.v_mount = freefile->fx_devvp->v_specmountpoint;
- tip.i_vnode = &vp;
- args.a_pvp = &vp;
- args.a_ino = freefile->fx_oldinum;
- args.a_mode = freefile->fx_mode;
- if ((error = ffs_freefile(&args)) != 0)
+ if ((error = ffs_freefile(freefile->fx_fs, freefile->fx_devvp,
+ freefile->fx_oldinum, freefile->fx_mode)) != 0)
softdep_error("handle_workitem_freefile", error);
WORKITEM_FREE(freefile, D_FREEFILE);
}
Home |
Main Index |
Thread Index |
Old Index