From owner-dev-commits-src-all@freebsd.org Sat May 22 09:46:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDFDA649611; Sat, 22 May 2021 09:46:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FnJXH2BQxz3lv6; Sat, 22 May 2021 09:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02F3E223A2; Sat, 22 May 2021 09:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14M9kcMA012639; Sat, 22 May 2021 09:46:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14M9kcHb012638; Sat, 22 May 2021 09:46:38 GMT (envelope-from git) Date: Sat, 22 May 2021 09:46:38 GMT Message-Id: <202105220946.14M9kcHb012638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 324fbdb27ab1 - stable/13 - vm_object_set_memattr(): handle all object types without listing them explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 324fbdb27ab1dbf027cf250fd575739985bf5434 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 May 2021 09:46:41 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=324fbdb27ab1dbf027cf250fd575739985bf5434 commit 324fbdb27ab1dbf027cf250fd575739985bf5434 Author: Konstantin Belousov AuthorDate: 2021-05-07 18:19:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-22 09:38:30 +0000 vm_object_set_memattr(): handle all object types without listing them explicitly (cherry picked from commit 3e7a11ca21f3a7948c50f27de5b2159f0bb56672) --- sys/vm/vm_object.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 735ab603a09b..1aa05093f93a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -330,24 +330,12 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) { VM_OBJECT_ASSERT_WLOCKED(object); - switch (object->type) { - case OBJT_DEFAULT: - case OBJT_DEVICE: - case OBJT_MGTDEVICE: - case OBJT_PHYS: - case OBJT_SG: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_VNODE: - if (!TAILQ_EMPTY(&object->memq)) - return (KERN_FAILURE); - break; - case OBJT_DEAD: + + if (object->type == OBJT_DEAD) return (KERN_INVALID_ARGUMENT); - default: - panic("vm_object_set_memattr: object %p is of undefined type", - object); - } + if (!TAILQ_EMPTY(&object->memq)) + return (KERN_FAILURE); + object->memattr = memattr; return (KERN_SUCCESS); }