Source-Changes-HG archive

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

[src/trunk]: src/sys Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to



details:   https://anonhg.NetBSD.org/src/rev/43f596dfa1d4
branches:  trunk
changeset: 766126:43f596dfa1d4
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Jun 16 09:21:02 2011 +0000

description:
Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing
the first argument to an uvm_object and adding a flags argument.

Modify tmpfs_reg_resize() to zero the backing store (aobj) instead
of the vnode.  Ubc_purge() no longer panics when unmounting tmpfs.

Keep uvm_vnp_zerorange() until the next kernel version bump.

diffstat:

 sys/fs/msdosfs/msdosfs_denode.c   |  16 +++++++++-------
 sys/fs/msdosfs/msdosfs_vnops.c    |   7 ++++---
 sys/fs/tmpfs/tmpfs_subr.c         |  11 ++++-------
 sys/fs/udf/udf_allocation.c       |  13 ++++++++-----
 sys/rump/librump/rumpvfs/vm_vfs.c |   7 +++----
 sys/ufs/ext2fs/ext2fs_inode.c     |   7 ++++---
 sys/ufs/ffs/ffs_inode.c           |   7 ++++---
 sys/ufs/lfs/lfs_inode.c           |   7 ++++---
 sys/uvm/uvm_bio.c                 |  25 +++++++++++++++++--------
 sys/uvm/uvm_extern.h              |   4 ++--
 10 files changed, 59 insertions(+), 45 deletions(-)

diffs (truncated from 377 to 300 lines):

diff -r c633466da768 -r 43f596dfa1d4 sys/fs/msdosfs/msdosfs_denode.c
--- a/sys/fs/msdosfs/msdosfs_denode.c   Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_denode.c   Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_denode.c,v 1.45 2011/06/12 03:35:53 rmind Exp $        */
+/*     $NetBSD: msdosfs_denode.c,v 1.46 2011/06/16 09:21:02 hannken Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.45 2011/06/12 03:35:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.46 2011/06/16 09:21:02 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -537,8 +537,9 @@
                        else
                                bdwrite(bp);
                } else {
-                       uvm_vnp_zerorange(DETOV(dep), length,
-                                         pmp->pm_bpcluster - boff);
+                       ubc_zerorange(&DETOV(dep)->v_uobj, length,
+                                     pmp->pm_bpcluster - boff,
+                                     UBC_UNMAP_FLAG(DETOV(dep)));
                }
        }
 
@@ -626,7 +627,7 @@
        }
 
        /*
-        * Zero extend file range; uvm_vnp_zerorange() uses ubc_alloc() and a
+        * Zero extend file range; ubc_zerorange() uses ubc_alloc() and a
         * memset(); we set the write size so ubc won't read in file data that
         * is zero'd later.
         */
@@ -634,8 +635,9 @@
        dep->de_FileSize = length;
        uvm_vnp_setwritesize(DETOV(dep), (voff_t)dep->de_FileSize);
        dep->de_flag |= DE_UPDATE|DE_MODIFIED;
-       uvm_vnp_zerorange(DETOV(dep), (off_t)osize,
-           (size_t)(round_page(dep->de_FileSize) - osize));
+       ubc_zerorange(&DETOV(dep)->v_uobj, (off_t)osize,
+           (size_t)(round_page(dep->de_FileSize) - osize),
+           UBC_UNMAP_FLAG(DETOV(dep)));
        uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize);
        return (deupdat(dep, 1));
 }
diff -r c633466da768 -r 43f596dfa1d4 sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c    Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c    Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.76 2011/06/12 03:35:53 rmind Exp $ */
+/*     $NetBSD: msdosfs_vnops.c,v 1.77 2011/06/16 09:21:02 hannken Exp $       */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.76 2011/06/12 03:35:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.77 2011/06/16 09:21:02 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -627,7 +627,8 @@
                /* zero out the remainder of the last page */
                rem = round_page(dep->de_FileSize) - dep->de_FileSize;
                if (rem > 0)
-                       uvm_vnp_zerorange(vp, (off_t)dep->de_FileSize, rem);
+                       ubc_zerorange(&vp->v_uobj, (off_t)dep->de_FileSize,
+                           rem, UBC_UNMAP_FLAG(vp));
                extended = 1;
        }
 
diff -r c633466da768 -r 43f596dfa1d4 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_subr.c,v 1.73 2011/06/12 03:35:54 rmind Exp $    */
+/*     $NetBSD: tmpfs_subr.c,v 1.74 2011/06/16 09:21:02 hannken Exp $  */
 
 /*
  * Copyright (c) 2005-2011 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.73 2011/06/12 03:35:54 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.74 2011/06/16 09:21:02 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -803,6 +803,7 @@
 {
        tmpfs_mount_t *tmp = VFS_TO_TMPFS(vp->v_mount);
        tmpfs_node_t *node = VP_TO_TMPFS_NODE(vp);
+       struct uvm_object *uobj = node->tn_spec.tn_reg.tn_aobj;
        size_t newpages, oldpages;
        off_t oldsize;
 
@@ -822,8 +823,7 @@
        } else if (newsize < oldsize) {
                int zerolen = MIN(round_page(newsize), node->tn_size) - newsize;
 
-               /* Zero out the truncated part of the last page. */
-               uvm_vnp_zerorange(vp, newsize, zerolen);
+               ubc_zerorange(uobj, newsize, zerolen, UBC_UNMAP_FLAG(vp));
        }
 
        node->tn_spec.tn_reg.tn_aobj_pages = newpages;
@@ -834,9 +834,6 @@
         * Free "backing store".
         */
        if (newpages < oldpages) {
-               struct uvm_object *uobj;
-
-               uobj = node->tn_spec.tn_reg.tn_aobj;
                KASSERT(uobj->vmobjlock == vp->v_interlock);
 
                mutex_enter(uobj->vmobjlock);
diff -r c633466da768 -r 43f596dfa1d4 sys/fs/udf/udf_allocation.c
--- a/sys/fs/udf/udf_allocation.c       Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/fs/udf/udf_allocation.c       Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_allocation.c,v 1.31 2011/01/14 09:09:18 reinoud Exp $ */
+/* $NetBSD: udf_allocation.c,v 1.32 2011/06/16 09:21:02 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.31 2011/01/14 09:09:18 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.32 2011/06/16 09:21:02 hannken Exp $");
 #endif /* not lint */
 
 
@@ -2711,7 +2711,8 @@
 
 #if 0
                        /* zero append space in buffer */
-                       uvm_vnp_zerorange(vp, old_size, new_size - old_size);
+                       ubc_zerorange(&vp->v_uobj, old_size,
+                           new_size - old_size, UBC_UNMAP_FLAG(vp));
 #endif
        
                        udf_node_sanity_check(udf_node, &new_inflen, &new_lbrec);
@@ -2817,7 +2818,8 @@
                c_ad.len = udf_rw32(len | flags);
 
                /* TODO zero appened space in buffer! */
-               /* using uvm_vnp_zerorange(vp, old_size, new_size - old_size); ? */
+               /* using ubc_zerorange(&vp->v_uobj, old_size, */
+               /*    new_size - old_size, UBC_UNMAP_FLAG(vp)); ? */
        }
        memset(&s_ad, 0, sizeof(struct long_ad));
 
@@ -2987,7 +2989,8 @@
                memset(data_pos + new_size, 0, old_size - new_size);
 
                /* TODO zero appened space in buffer! */
-               /* using uvm_vnp_zerorange(vp, old_size, old_size - new_size); ? */
+               /* using ubc_zerorange(&vp->v_uobj, old_size, */
+               /*    old_size - new_size, UBC_UNMAP_FLAG(vp)); ? */
 
                /* set new size for uvm */
                uvm_vnp_setsize(vp, new_size);
diff -r c633466da768 -r 43f596dfa1d4 sys/rump/librump/rumpvfs/vm_vfs.c
--- a/sys/rump/librump/rumpvfs/vm_vfs.c Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/rump/librump/rumpvfs/vm_vfs.c Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_vfs.c,v 1.29 2011/06/12 03:35:59 rmind Exp $        */
+/*     $NetBSD: vm_vfs.c,v 1.30 2011/06/16 09:21:03 hannken Exp $      */
 
 /*
  * Copyright (c) 2008-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.29 2011/06/12 03:35:59 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.30 2011/06/16 09:21:03 hannken Exp $");
 
 #include <sys/param.h>
 
@@ -102,9 +102,8 @@
 #define PAGERFLAGS (PGO_SYNCIO | PGO_NOBLOCKALLOC | PGO_NOTIMESTAMP)
 
 void
-uvm_vnp_zerorange(struct vnode *vp, off_t off, size_t len)
+ubc_zerorange(struct uvm_object *uobj, off_t off, size_t len, int flags)
 {
-       struct uvm_object *uobj = &vp->v_uobj;
        struct vm_page **pgs;
        struct uvm_object *pguobj;
        int maxpages = MIN(32, round_page(len) >> PAGE_SHIFT);
diff -r c633466da768 -r 43f596dfa1d4 sys/ufs/ext2fs/ext2fs_inode.c
--- a/sys/ufs/ext2fs/ext2fs_inode.c     Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/ufs/ext2fs/ext2fs_inode.c     Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_inode.c,v 1.73 2010/07/28 11:03:48 hannken Exp $        */
+/*     $NetBSD: ext2fs_inode.c,v 1.74 2011/06/16 09:21:03 hannken Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.73 2010/07/28 11:03:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.74 2011/06/16 09:21:03 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -311,7 +311,8 @@
                size = fs->e2fs_bsize;
 
                /* XXXUBC we should handle more than just VREG */
-               uvm_vnp_zerorange(ovp, length, size - offset);
+               ubc_zerorange(&ovp->v_uobj, length, size - offset,
+                   UBC_UNMAP_FLAG(ovp));
        }
        (void)ext2fs_setsize(oip, length);
        uvm_vnp_setsize(ovp, length);
diff -r c633466da768 -r 43f596dfa1d4 sys/ufs/ffs/ffs_inode.c
--- a/sys/ufs/ffs/ffs_inode.c   Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/ufs/ffs/ffs_inode.c   Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_inode.c,v 1.106 2011/06/12 03:36:00 rmind Exp $    */
+/*     $NetBSD: ffs_inode.c,v 1.107 2011/06/16 09:21:03 hannken Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.106 2011/06/12 03:36:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.107 2011/06/16 09:21:03 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -321,7 +321,8 @@
                size = blksize(fs, oip, lbn);
                eoz = MIN(MAX(lblktosize(fs, lbn) + size, round_page(pgoffset)),
                    osize);
-               uvm_vnp_zerorange(ovp, length, eoz - length);
+               ubc_zerorange(&ovp->v_uobj, length, eoz - length,
+                   UBC_UNMAP_FLAG(ovp));
                if (round_page(eoz) > round_page(length)) {
                        mutex_enter(ovp->v_interlock);
                        error = VOP_PUTPAGES(ovp, round_page(length),
diff -r c633466da768 -r 43f596dfa1d4 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.123 2011/06/12 03:36:01 rmind Exp $    */
+/*     $NetBSD: lfs_inode.c,v 1.124 2011/06/16 09:21:03 hannken Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.123 2011/06/12 03:36:01 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.124 2011/06/16 09:21:03 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -391,7 +391,8 @@
                xlbn = lblkno(fs, length);
                size = blksize(fs, oip, xlbn);
                eoz = MIN(lblktosize(fs, xlbn) + size, osize);
-               uvm_vnp_zerorange(ovp, length, eoz - length);
+               ubc_zerorange(&ovp->v_uobj, length, eoz - length,
+                   UBC_UNMAP_FLAG(ovp));
                if (round_page(eoz) > round_page(length)) {
                        mutex_enter(ovp->v_interlock);
                        error = VOP_PUTPAGES(ovp, round_page(length),
diff -r c633466da768 -r 43f596dfa1d4 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Thu Jun 16 08:27:28 2011 +0000
+++ b/sys/uvm/uvm_bio.c Thu Jun 16 09:21:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_bio.c,v 1.73 2011/06/12 03:36:02 rmind Exp $       */
+/*     $NetBSD: uvm_bio.c,v 1.74 2011/06/16 09:21:03 hannken Exp $     */
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.73 2011/06/12 03:36:02 rmind Exp $");



Home | Main Index | Thread Index | Old Index