From owner-dev-commits-src-all@freebsd.org Thu Sep 30 21:59:17 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 C40B6670E5B; Thu, 30 Sep 2021 21:59:17 +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 4HL6b952Bkz4wbB; Thu, 30 Sep 2021 21:59:17 +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 8D2191386A; Thu, 30 Sep 2021 21:59:17 +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 18ULxHrb081954; Thu, 30 Sep 2021 21:59:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ULxH0H081953; Thu, 30 Sep 2021 21:59:17 GMT (envelope-from git) Date: Thu, 30 Sep 2021 21:59:17 GMT Message-Id: <202109302159.18ULxH0H081953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: ce73f768b764 - main - EFI loader: Don't free bcache for DEVT_DISK devs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce73f768b76486b1562f207a6fc1cef87065418a 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: Thu, 30 Sep 2021 21:59:17 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ce73f768b76486b1562f207a6fc1cef87065418a commit ce73f768b76486b1562f207a6fc1cef87065418a Author: Colin Percival AuthorDate: 2021-09-30 21:48:14 +0000 Commit: Colin Percival CommitDate: 2021-09-30 21:48:14 +0000 EFI loader: Don't free bcache for DEVT_DISK devs Booting on an EC2 c5.xlarge instance, this reduces the number of I/Os performed from 609 to 432, reduces the total number of blocks read from 61963 to 60797, and reduces the time spent in the loader by 39 ms. Note that b4cb3fe0e39a allowed the bcache to be retained for most of the boot process, but relies on mounting filesystems; this commit allows the bcache to be retained at the start of the boot process, before the root filesystem has been located. Reviewed by: imp, tsoome MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32239 --- stand/efi/libefi/efipart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c index aede28ef40c3..7807c17077a6 100644 --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -949,8 +949,10 @@ efipart_close(struct open_file *f) pd->pd_open--; if (pd->pd_open == 0) { pd->pd_blkio = NULL; - bcache_free(pd->pd_bcache); - pd->pd_bcache = NULL; + if (dev->dd.d_dev->dv_type != DEVT_DISK) { + bcache_free(pd->pd_bcache); + pd->pd_bcache = NULL; + } } if (dev->dd.d_dev->dv_type == DEVT_DISK) return (disk_close(dev));