Module Name: src
Committed By: enami
Date: Thu Jun 30 00:09:27 UTC 2011
Modified Files:
src/sys/fs/tmpfs: tmpfs_subr.c
Log Message:
- 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().
To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/fs/tmpfs/tmpfs_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.74 src/sys/fs/tmpfs/tmpfs_subr.c:1.75
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.74 Thu Jun 16 09:21:02 2011
+++ src/sys/fs/tmpfs/tmpfs_subr.c Thu Jun 30 00:09:26 2011
@@ -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 @@
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 @@
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);
}