Module Name: src
Committed By: ad
Date: Sat Mar 14 13:37:49 UTC 2020
Modified Files:
src/sys/fs/tmpfs: tmpfs_subr.c
Log Message:
tmpfs_reg_resize(): do nothing if newsize == oldsize.
To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 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.106 src/sys/fs/tmpfs/tmpfs_subr.c:1.107
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.106 Sun Feb 23 15:46:40 2020
+++ src/sys/fs/tmpfs/tmpfs_subr.c Sat Mar 14 13:37:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tmpfs_subr.c,v 1.106 2020/02/23 15:46:40 ad Exp $ */
+/* $NetBSD: tmpfs_subr.c,v 1.107 2020/03/14 13:37:49 ad Exp $ */
/*
* Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.106 2020/02/23 15:46:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.107 2020/03/14 13:37:49 ad Exp $");
#include <sys/param.h>
#include <sys/cprng.h>
@@ -914,6 +914,10 @@ tmpfs_reg_resize(struct vnode *vp, off_t
newpages = round_page(newsize) >> PAGE_SHIFT;
KASSERT(oldpages == node->tn_spec.tn_reg.tn_aobj_pages);
+ if (newsize == oldsize) {
+ return 0;
+ }
+
if (newpages > oldpages) {
/* Increase the used-memory counter if getting extra pages. */
if (!tmpfs_mem_incr(tmp, (newpages - oldpages) << PAGE_SHIFT)) {