Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Don't use VTOI(vp)->i_flags to test for snapshot...



details:   https://anonhg.NetBSD.org/src/rev/a853ccea3ed2
branches:  trunk
changeset: 566972:a853ccea3ed2
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed May 26 20:33:10 2004 +0000

description:
Don't use VTOI(vp)->i_flags to test for snapshot devices. Will not work
for non-UFS file systems. Test for VBLK vnode instead.

diffstat:

 sys/ufs/ffs/ffs_alloc.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (61 lines):

diff -r 12998715e925 -r a853ccea3ed2 sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c   Wed May 26 20:32:48 2004 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c   Wed May 26 20:33:10 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_alloc.c,v 1.76 2004/05/25 14:54:58 hannken Exp $   */
+/*     $NetBSD: ffs_alloc.c,v 1.77 2004/05/26 20:33:10 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.76 2004/05/25 14:54:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.77 2004/05/26 20:33:10 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1554,7 +1554,8 @@
        const int needswap = UFS_FSNEEDSWAP(fs);
 
        cg = dtog(fs, bno);
-       if (VTOI(devvp)->i_flags & SF_SNAPSHOT) {
+       if (devvp->v_type != VBLK) {
+               /* devvp is a snapshot */
                dev = VTOI(devvp)->i_devvp->v_rdev;
                cgblkno = fragstoblks(fs, cgtod(fs, cg));
        } else {
@@ -1597,7 +1598,8 @@
        if (size == fs->fs_bsize) {
                fragno = fragstoblks(fs, cgbno);
                if (!ffs_isfreeblock(fs, blksfree, fragno)) {
-                       if (VTOI(devvp)->i_flags & SF_SNAPSHOT) {
+                       if (devvp->v_type != VBLK) {
+                               /* devvp is a snapshot */
                                brelse(bp);
                                return;
                        }
@@ -1779,7 +1781,8 @@
 #endif
 
        cg = ino_to_cg(fs, ino);
-       if (pip->i_flags & SF_SNAPSHOT) {
+       if (pip->i_devvp->v_type != VBLK) {
+               /* pip->i_devvp is a snapshot */
                cgbno = fragstoblks(fs, cgtod(fs, cg));
        } else {
                cgbno = fsbtodb(fs, cgtod(fs, cg));
@@ -1841,9 +1844,10 @@
        u_int8_t *inosused;
 
        cg = ino_to_cg(fs, ino);
-       if (VTOI(devvp)->i_flags & SF_SNAPSHOT)
+       if (devvp->v_type != VBLK) {
+               /* devvp is a snapshot */
                cgbno = fragstoblks(fs, cgtod(fs, cg));
-       else
+       } else
                cgbno = fsbtodb(fs, cgtod(fs, cg));
        if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
                return 1;



Home | Main Index | Thread Index | Old Index