summaryrefslogtreecommitdiff
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authorenami <enami@NetBSD.org>2011-06-30 00:09:26 +0000
committerenami <enami@NetBSD.org>2011-06-30 00:09:26 +0000
commitbbff8513e76fcb010177db55558331baa2ae1b48 (patch)
treeb199eb95eeca0d5055898ac1aaea8326f2d77496 /sys/fs/tmpfs
parentcc7b9f2ff73f2b6bd596a2db69d3f319668f39af (diff)
- Use << PAGE_SHIFT rather than calling round_page again.
- No need to call uao_dropswap_range() here since uao_dropswap() is already called for each pages by uvm_vnp_setsize().
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index d4632f80fa1..933d2fab4c9 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.74 2011/06/16 09:21:02 hannken Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.75 2011/06/30 00:09:26 enami 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.74 2011/06/16 09:21:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.75 2011/06/30 00:09:26 enami Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@@ -821,7 +821,8 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize)
return ENOSPC;
}
} else if (newsize < oldsize) {
- int zerolen = MIN(round_page(newsize), node->tn_size) - newsize;
+ int zerolen = MIN(newpages << PAGE_SHIFT, node->tn_size)
+ - newsize;
ubc_zerorange(uobj, newsize, zerolen, UBC_UNMAP_FLAG(vp));
}
@@ -830,16 +831,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize)
node->tn_size = newsize;
uvm_vnp_setsize(vp, newsize);
- /*
- * Free "backing store".
- */
if (newpages < oldpages) {
- KASSERT(uobj->vmobjlock == vp->v_interlock);
-
- mutex_enter(uobj->vmobjlock);
- uao_dropswap_range(uobj, newpages, oldpages);
- mutex_exit(uobj->vmobjlock);
-
/* Decrease the used-memory counter. */
tmpfs_mem_decr(tmp, (oldpages - newpages) << PAGE_SHIFT);
}