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:		dffd882d12
Sponsored by:	Netflix
MFC After:	1 minute
This commit is contained in:
Chuck Silvers
2025-11-25 14:30:19 -08:00
committed by Warner Losh
parent 98f6f6e4f4
commit 2b4dbad2db
+4 -5
View File
@@ -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