Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs tmpfs_reg_resize(): do nothing if newsize == ol...



details:   https://anonhg.NetBSD.org/src/rev/d5d09562b666
branches:  trunk
changeset: 745852:d5d09562b666
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Mar 14 13:37:49 2020 +0000

description:
tmpfs_reg_resize(): do nothing if newsize == oldsize.

diffstat:

 sys/fs/tmpfs/tmpfs_subr.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r fc37830791ff -r d5d09562b666 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Sat Mar 14 13:34:43 2020 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Sat Mar 14 13:37:49 2020 +0000
@@ -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 @@
        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)) {



Home | Main Index | Thread Index | Old Index