Source-Changes-HG archive

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

[src/trunk]: src Take away "#ifdef LFS_UBC".



details:   https://anonhg.NetBSD.org/src/rev/efb3904f9e6d
branches:  trunk
changeset: 544021:efb3904f9e6d
user:      perseant <perseant%NetBSD.org@localhost>
date:      Sat Mar 08 21:46:04 2003 +0000

description:
Take away "#ifdef LFS_UBC".

diffstat:

 doc/CHANGES                 |   3 +-
 sys/ufs/lfs/lfs_inode.c     |  53 ++++++++++++++------------------------------
 sys/ufs/lfs/lfs_segment.c   |  12 +--------
 sys/ufs/lfs/lfs_vfsops.c    |  14 +----------
 sys/ufs/lfs/lfs_vnops.c     |  51 +++++++++++++++++-------------------------
 sys/ufs/ufs/ufs_readwrite.c |  12 ++-------
 6 files changed, 47 insertions(+), 98 deletions(-)

diffs (truncated from 459 to 300 lines):

diff -r 393031b41815 -r efb3904f9e6d doc/CHANGES
--- a/doc/CHANGES       Sat Mar 08 21:30:59 2003 +0000
+++ b/doc/CHANGES       Sat Mar 08 21:46:04 2003 +0000
@@ -1,4 +1,4 @@
-LIST OF CHANGES FROM LAST RELEASE:                     <$Revision: 1.111 $>
+LIST OF CHANGES FROM LAST RELEASE:                     <$Revision: 1.112 $>
 
 
 [Note: This file does not mention every change made to the NetBSD source tree.
@@ -310,3 +310,4 @@
        sysctl: Make hw.physmem and hw.usermem saturate if they are used
                on a system with >=4G RAM.  [thorpej 20030306]
        postfix: update to 2.0.6 [perry 20030308]
+       kernel: let LFS use UBC natively [perseant 20030308]
diff -r 393031b41815 -r efb3904f9e6d sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Sat Mar 08 21:30:59 2003 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Sat Mar 08 21:46:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.69 2003/03/04 19:10:35 perseant Exp $  */
+/*     $NetBSD: lfs_inode.c,v 1.70 2003/03/08 21:46:05 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.69 2003/03/04 19:10:35 perseant Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.70 2003/03/08 21:46:05 perseant Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -231,9 +231,7 @@
                struct proc *a_p;
        } */ *ap = v;
        struct vnode *ovp = ap->a_vp;
-#ifdef LFS_UBC
        struct genfs_node *gp = VTOG(ovp);
-#endif
        daddr_t lastblock;
        struct inode *oip;
        daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
@@ -247,6 +245,7 @@
        int i;
        int aflags, error, allerror = 0;
        off_t osize;
+       voff_t eoz;
        long lastseg;
        size_t bc;
        int obufsize, odb;
@@ -287,9 +286,7 @@
        lfs_imtime(fs);
        osize = oip->i_ffs_size;
        needunlock = usepc = 0;
-#ifdef LFS_UBC
        usepc = (ovp->v_type == VREG && ovp != fs->lfs_ivnode);
-#endif
 
        /*
         * Lengthen the size of the file. We must ensure that the
@@ -302,7 +299,6 @@
                aflags = B_CLRBUF;
                if (ap->a_flags & IO_SYNC)
                        aflags |= B_SYNC;
-#ifdef LFS_UBC
                if (usepc) {
                        if (lblkno(fs, osize) < NDADDR &&
                            lblkno(fs, osize) != lblkno(fs, length) &&
@@ -336,7 +332,6 @@
                        KASSERT(ovp->v_size == oip->i_ffs_size);
                        return (VOP_UPDATE(ovp, NULL, NULL, 0));
                } else {
-#endif /* !LFS_UBC */
                        error = lfs_reserve(fs, ovp, NULL,
                            btofsb(fs, (NIADDR + 2) << fs->lfs_bshift));
                        if (error)
@@ -352,9 +347,7 @@
                        (void) VOP_BWRITE(bp);
                        oip->i_flag |= IN_CHANGE | IN_UPDATE;
                        return (VOP_UPDATE(ovp, NULL, NULL, 0));
-#ifdef LFS_UBC
                }
-#endif
        }
 
        if ((error = lfs_reserve(fs, ovp, NULL,
@@ -374,11 +367,7 @@
        bc = 0;
        if (offset == 0) {
                oip->i_ffs_size = length;
-       } else
-#ifdef LFS_UBC
-       if (!usepc)
-#endif
-       {
+       } else if (!usepc) {
                lockmgr(&fs->lfs_fraglock, LK_SHARED, 0);
                lbn = lblkno(fs, length);
                aflags = B_CLRBUF;
@@ -405,26 +394,21 @@
                        fs->lfs_avail += odb - btofsb(fs, size);
                (void) VOP_BWRITE(bp);
                lockmgr(&fs->lfs_fraglock, LK_RELEASE, 0);
-       }
-#ifdef LFS_UBC
-       /*
-        * When truncating a regular file down to a non-block-aligned size,
-        * we must zero the part of last block which is past the new EOF.
-        * We must synchronously flush the zeroed pages to disk
-        * since the new pages will be invalidated as soon as we
-        * inform the VM system of the new, smaller size.
-        * We must do this before acquiring the GLOCK, since fetching
-        * the pages will acquire the GLOCK internally.
-        * So there is a window where another thread could see a whole
-        * zeroed page past EOF, but that's life.
-        */
-
-       else { /* vp->v_type == VREG && length < osize && offset != 0 */
-               voff_t eoz;
-
+       } else { /* vp->v_type == VREG && length < osize && offset != 0 */
+               /*
+                * When truncating a regular file down to a non-block-aligned
+                * size, we must zero the part of last block which is past
+                * the new EOF.  We must synchronously flush the zeroed pages
+                * to disk since the new pages will be invalidated as soon
+                * as we inform the VM system of the new, smaller size.
+                * We must do this before acquiring the GLOCK, since fetching
+                * the pages will acquire the GLOCK internally.
+                * So there is a window where another thread could see a whole
+                * zeroed page past EOF, but that's life.
+                */
                aflags = ap->a_flags & IO_SYNC ? B_SYNC : 0;
                error = ufs_balloc_range(ovp, length - 1, 1, ap->a_cred,
-                       aflags);
+                                        aflags);
                if (error) {
                        return error;
                }
@@ -439,7 +423,6 @@
        }
 
        lockmgr(&gp->g_glock, LK_EXCLUSIVE, NULL);
-#endif
 
        oip->i_ffs_size = length;
        uvm_vnp_setsize(ovp, length);
@@ -599,9 +582,7 @@
            -btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
        if (needunlock)
                lockmgr(&fs->lfs_fraglock, LK_RELEASE, 0);
-#ifdef LFS_UBC
        lockmgr(&gp->g_glock, LK_RELEASE, NULL);
-#endif
        return (allerror);
 }
 
diff -r 393031b41815 -r efb3904f9e6d sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sat Mar 08 21:30:59 2003 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sat Mar 08 21:46:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.107 2003/03/08 02:55:48 perseant Exp $       */
+/*     $NetBSD: lfs_segment.c,v 1.108 2003/03/08 21:46:05 perseant Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.107 2003/03/08 02:55:48 perseant Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.108 2003/03/08 21:46:05 perseant Exp $");
 
 #define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
 
@@ -230,7 +230,6 @@
                        nbp = LIST_NEXT(bp, b_vnbufs);
                        if (!LFS_IS_MALLOC_BUF(bp))
                                continue;
-#ifdef LFS_UBC
                        /*
                         * Look for pages matching the range covered
                         * by cleaning blocks.  It's okay if more dirty
@@ -261,7 +260,6 @@
                                }
                                simple_unlock(&vp->v_interlock);
                        }
-#endif
                        for (tbp = LIST_FIRST(&vp->v_dirtyblkhd); tbp;
                            tbp = tnbp)
                        {
@@ -278,9 +276,7 @@
                                        break;
                                }
                        }
-#ifdef LFS_UBC
                    nextbp:
-#endif
                }
                splx(s);
        }
@@ -805,7 +801,6 @@
                }
        } else {
                lfs_gather(fs, sp, vp, lfs_match_data);
-#ifdef LFS_UBC
                /*
                 * If we're flushing, we've already called VOP_PUTPAGES
                 * so don't do it again.  Otherwise, we want to write
@@ -817,7 +812,6 @@
                                     PGO_CLEANIT | PGO_ALLPAGES | PGO_LOCKED |
                                     PGO_BUSYFAIL);
                }
-#endif
        }
 
        /*
@@ -1862,7 +1856,6 @@
                                        printf("ino %d lbn %" PRId64 " entry %d off %" PRIx64 "\n",
                                               VTOI(bp->b_vp)->i_number,
                                               bp->b_lblkno, ioff, doff);
-# ifdef LFS_UBC
                                        if (bp->b_vp->v_type == VREG) {
                                                /*
                                                 * What is up with this page?
@@ -1876,7 +1869,6 @@
                                                                printf("  page at %" PRIx64 " flags 0x%x pqflags 0x%x\n", doff, pg->flags, pg->pqflags);
                                                }
                                        }
-# endif /* LFS_UBC */
 #endif /* DEBUG_LFS */
                                        ++changed;
                                        *daddrp = 0;
diff -r 393031b41815 -r efb3904f9e6d sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Sat Mar 08 21:30:59 2003 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Sat Mar 08 21:46:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.103 2003/03/08 02:55:49 perseant Exp $        */
+/*     $NetBSD: lfs_vfsops.c,v 1.104 2003/03/08 21:46:06 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.103 2003/03/08 02:55:49 perseant Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.104 2003/03/08 21:46:06 perseant Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -114,11 +114,9 @@
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
 
-#ifdef LFS_UBC
 #include <miscfs/genfs/genfs.h>
 #include <miscfs/genfs/genfs_node.h>
 static int lfs_gop_write(struct vnode *, struct vm_page **, int, int);
-#endif
 
 static int lfs_mountfs(struct vnode *, struct mount *, struct proc *);
 
@@ -162,15 +160,9 @@
 };
 
 struct genfs_ops lfs_genfsops = {
-#ifdef LFS_UBC
        lfs_gop_size,
        ufs_gop_alloc,
        lfs_gop_write,
-#else
-       NULL,
-       NULL,
-       genfs_compat_gop_write,
-#endif
 };
 
 struct pool lfs_inode_pool, lfs_inoext_pool;
@@ -1757,7 +1749,6 @@
        /* NOTREACHED */
 }
 
-#ifdef LFS_UBC
 /*
  * lfs_gop_write functions exactly like genfs_gop_write, except that
  * (1) it requires the seglock to be held by its caller, and sp->fip
@@ -2006,4 +1997,3 @@
        UVMHIST_LOG(ubchist, "returning 0", 0,0,0,0);
        return (0);
 }
-#endif /* LFS_UBC */
diff -r 393031b41815 -r efb3904f9e6d sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Sat Mar 08 21:30:59 2003 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sat Mar 08 21:46:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.94 2003/03/08 02:55:50 perseant Exp $  */
+/*     $NetBSD: lfs_vnops.c,v 1.95 2003/03/08 21:46:06 perseant Exp $  */
 
 /*-



Home | Main Index | Thread Index | Old Index