Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2025 22:58:36 +0000
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Chuck Silvers <chs@FreeBSD.org>
Subject:   git: 2b4dbad2db57 - main - nda: fix setting of unmappedio flag
Message-ID:  <6926349c.3b599.381eedc5@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by imp:

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

commit 2b4dbad2db5766294ee97bb96228ec6826a9e7c3
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2025-11-25 22:30:19 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-11-25 22:46:52 +0000

    nda: fix setting of unmappedio flag
    
    The upstream refactoring of ndaregister() to split out ndasetgeom()
    accidentally used an uninitialed variable to decide whether or not
    to set DISKFLAG_UNMAPPED_BIO.  Fix this by moving that portion of
    ndasetgeom() back up to ndaregister().  The check for PIM_UNMAPPED
    is not really needed because nvme devices always have that set,
    so it cannot change in the other path that ndasetgeom() is now called.
    
    Reviewed by:    imp
    Fixes:          dffd882d12d2a71aca464f48209ec9ae6f393b15
    Sponsored by:   Netflix
    MFC After:      1 minute
---
 sys/cam/nvme/nvme_da.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index 506fce3d99d3..833738cfcb98 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -648,7 +648,6 @@ static void
 ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
 {
 	struct disk *disk = softc->disk;
-	struct ccb_pathinq cpi;
 	const struct nvme_namespace_data *nsd;
 	const struct nvme_controller_data *cd;
 	uint8_t flbas_fmt, lbads, vwc_present;
@@ -667,10 +666,6 @@ ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
 	vwc_present = NVMEV(NVME_CTRLR_DATA_VWC_PRESENT, cd->vwc);
 	if (vwc_present)
 		disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
-	if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
-		disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
-		softc->unmappedio = 1;
-	}
 }
 
 static void
@@ -944,6 +939,10 @@ ndaregister(struct cam_periph *periph, void *arg)
 		maxio = maxphys;	/* for safety */
 	disk->d_maxsize = maxio;
 	ndasetgeom(softc, periph);
+	if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
+		disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
+		softc->unmappedio = 1;
+	}
 
 	/*
 	 * d_ident and d_descr are both far bigger than the length of either


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6926349c.3b599.381eedc5>