Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2021 16:08:57 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e70ed10f8f4d - stable/12 - EFI loader: Don't free bcache for DEVT_DISK devs
Message-ID:  <202110081608.198G8vlv001909@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=e70ed10f8f4d648ae69052aa805d36344ae75140

commit e70ed10f8f4d648ae69052aa805d36344ae75140
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-09-30 21:48:14 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 08:04:57 +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
    
    (cherry picked from commit ce73f768b76486b1562f207a6fc1cef87065418a)
---
 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 424df7d2e423..2afc96a45b10 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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110081608.198G8vlv001909>