nda(4) fix check for Dataset Management support
In the nda(4) driver, only set DISKFLAG_CANDELETE (a.k.a. can support BIO_DELETE) if the drive supports Dataset Management. There are reports that without this check, VMWare Workstation does not work reliably. Fix is to check the ONCS field in the NVMe Controller Data structure for support. This check previously existed but did not survive the big-endian changes. Reported by: yuripv@yuripv.net Reviewed by: imp, mav, jimharris Approved by: imp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18493
This commit is contained in:
parent
32ab5aa1fd
commit
87b3975e36
@ -798,7 +798,7 @@ ndaregister(struct cam_periph *periph, void *arg)
|
|||||||
disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze);
|
disk->d_mediasize = (off_t)(disk->d_sectorsize * nsd->nsze);
|
||||||
disk->d_delmaxsize = disk->d_mediasize;
|
disk->d_delmaxsize = disk->d_mediasize;
|
||||||
disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
|
disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
|
||||||
// if (cd->oncs.dsm) // XXX broken?
|
if (nvme_ctrlr_has_dataset_mgmt(cd))
|
||||||
disk->d_flags |= DISKFLAG_CANDELETE;
|
disk->d_flags |= DISKFLAG_CANDELETE;
|
||||||
vwc_present = (cd->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
|
vwc_present = (cd->vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
|
||||||
NVME_CTRLR_DATA_VWC_PRESENT_MASK;
|
NVME_CTRLR_DATA_VWC_PRESENT_MASK;
|
||||||
|
@ -1259,6 +1259,13 @@ void nvme_unregister_consumer(struct nvme_consumer *consumer);
|
|||||||
device_t nvme_ctrlr_get_device(struct nvme_controller *ctrlr);
|
device_t nvme_ctrlr_get_device(struct nvme_controller *ctrlr);
|
||||||
const struct nvme_controller_data *
|
const struct nvme_controller_data *
|
||||||
nvme_ctrlr_get_data(struct nvme_controller *ctrlr);
|
nvme_ctrlr_get_data(struct nvme_controller *ctrlr);
|
||||||
|
static inline bool
|
||||||
|
nvme_ctrlr_has_dataset_mgmt(const struct nvme_controller_data *cd)
|
||||||
|
{
|
||||||
|
/* Assumes cd was byte swapped by nvme_controller_data_swapbytes() */
|
||||||
|
return ((cd->oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) &
|
||||||
|
NVME_CTRLR_DATA_ONCS_DSM_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
/* Namespace helper functions */
|
/* Namespace helper functions */
|
||||||
uint32_t nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns);
|
uint32_t nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns);
|
||||||
|
@ -498,8 +498,6 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id,
|
|||||||
struct nvme_completion_poll_status status;
|
struct nvme_completion_poll_status status;
|
||||||
int res;
|
int res;
|
||||||
int unit;
|
int unit;
|
||||||
uint16_t oncs;
|
|
||||||
uint8_t dsm;
|
|
||||||
uint8_t flbas_fmt;
|
uint8_t flbas_fmt;
|
||||||
uint8_t vwc_present;
|
uint8_t vwc_present;
|
||||||
|
|
||||||
@ -569,9 +567,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id,
|
|||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
oncs = ctrlr->cdata.oncs;
|
if (nvme_ctrlr_has_dataset_mgmt(&ctrlr->cdata))
|
||||||
dsm = (oncs >> NVME_CTRLR_DATA_ONCS_DSM_SHIFT) & NVME_CTRLR_DATA_ONCS_DSM_MASK;
|
|
||||||
if (dsm)
|
|
||||||
ns->flags |= NVME_NS_DEALLOCATE_SUPPORTED;
|
ns->flags |= NVME_NS_DEALLOCATE_SUPPORTED;
|
||||||
|
|
||||||
vwc_present = (ctrlr->cdata.vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
|
vwc_present = (ctrlr->cdata.vwc >> NVME_CTRLR_DATA_VWC_PRESENT_SHIFT) &
|
||||||
|
Loading…
Reference in New Issue
Block a user