Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162411294
D55519.id172702.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D55519.id172702.diff
View Options
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -285,6 +285,39 @@
nvme_ns_rw_cmd(&nvmeio->cmd, rwcmd, softc->nsid, lba, count);
}
+static void
+ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
+{
+ struct disk *disk = softc->disk;
+ const struct nvme_namespace_data *nsd;
+ const struct nvme_controller_data *cd;
+ uint8_t flbas_fmt, lbads, vwc_present;
+ u_int flags;
+
+ nsd = nvme_get_identify_ns(periph);
+ cd = nvme_get_identify_cntrl(periph);
+
+ /*
+ * Preserve flags we can't infer that were set before. UNMAPPED comes
+ * from the PIM, so won't change after we set it the first
+ * time. Subsequent times, we have to preserve it.
+ */
+ flags = disk->d_flags & DISKFLAG_UNMAPPED_BIO; /* Need to preserve */
+
+ flbas_fmt = NVMEV(NVME_NS_DATA_FLBAS_FORMAT, nsd->flbas);
+ lbads = NVMEV(NVME_NS_DATA_LBAF_LBADS, nsd->lbaf[flbas_fmt]);
+ disk->d_sectorsize = 1 << lbads;
+ disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze);
+ disk->d_delmaxsize = disk->d_mediasize;
+ disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
+ if (nvme_ctrlr_has_dataset_mgmt(cd))
+ disk->d_flags |= DISKFLAG_CANDELETE;
+ vwc_present = NVMEV(NVME_CTRLR_DATA_VWC_PRESENT, cd->vwc);
+ if (vwc_present)
+ disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
+ disk->d_flags |= flags;
+}
+
static int
ndaopen(struct disk *dp)
{
@@ -644,30 +677,6 @@
cam_periph_lock(periph);
}
-static void
-ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
-{
- struct disk *disk = softc->disk;
- const struct nvme_namespace_data *nsd;
- const struct nvme_controller_data *cd;
- uint8_t flbas_fmt, lbads, vwc_present;
-
- nsd = nvme_get_identify_ns(periph);
- cd = nvme_get_identify_cntrl(periph);
-
- flbas_fmt = NVMEV(NVME_NS_DATA_FLBAS_FORMAT, nsd->flbas);
- lbads = NVMEV(NVME_NS_DATA_LBAF_LBADS, nsd->lbaf[flbas_fmt]);
- disk->d_sectorsize = 1 << lbads;
- disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze);
- disk->d_delmaxsize = disk->d_mediasize;
- disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
- if (nvme_ctrlr_has_dataset_mgmt(cd))
- disk->d_flags |= DISKFLAG_CANDELETE;
- vwc_present = NVMEV(NVME_CTRLR_DATA_VWC_PRESENT, cd->vwc);
- if (vwc_present)
- disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
-}
-
static void
ndaasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 14, 12:14 AM (16 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35049770
Default Alt Text
D55519.id172702.diff (2 KB)
Attached To
Mode
D55519: nda: Move ndasetgeom
Attached
Detach File
Event Timeline
Log In to Comment