summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2018-02-01 19:13:19 +0000
committermav <mav@FreeBSD.org>2018-02-01 19:13:19 +0000
commit482353f80736bd9e1d36aa824c1458fa0660c5f3 (patch)
treed3b9217eeb3dda795366a7f6531545521a0097fd
parent94bf160b70d468c1af238fb1ec973b1216a59def (diff)
downloadFreeBSD-src-482353f80736bd9e1d36aa824c1458fa0660c5f3.zip
FreeBSD-src-482353f80736bd9e1d36aa824c1458fa0660c5f3.tar.gz
MFC r324632 (by imp):
Be nicer on the dump stack by allocating only a ccb_nvmeio rather than a full ccb. This saves a few hundre bytes, which might be important during a crash dump...
-rw-r--r--sys/cam/nvme/nvme_da.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index 652f330..60f3cd6 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -379,7 +379,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
struct cam_periph *periph;
struct nda_softc *softc;
u_int secsize;
- union ccb ccb;
+ struct ccb_nvmeio nvmeio;
struct disk *dp;
uint64_t lba;
uint32_t count;
@@ -401,15 +401,15 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
/* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */
memset(&nvmeio, 0, sizeof(nvmeio));
if (length > 0) {
- xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
- ccb.ccb_h.ccb_state = NDA_CCB_DUMP;
- nda_nvme_write(softc, &ccb.nvmeio, virtual, lba, length, count);
- xpt_polled_action(&ccb);
+ xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
+ nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP;
+ nda_nvme_write(softc, &nvmeio, virtual, lba, length, count);
+ xpt_polled_action((union ccb *)&nvmeio);
- error = cam_periph_error(&ccb,
+ error = cam_periph_error((union ccb *)&nvmeio,
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
- if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
- cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
+ if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0)
+ cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0,
/*reduction*/0, /*timeout*/0, /*getcount_only*/0);
if (error != 0)
printf("Aborting dump due to I/O error.\n");
@@ -419,16 +419,16 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
}
/* Flush */
- xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
+ xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
- ccb.ccb_h.ccb_state = NDA_CCB_DUMP;
- nda_nvme_flush(softc, &ccb.nvmeio);
- xpt_polled_action(&ccb);
+ nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP;
+ nda_nvme_flush(softc, &nvmeio);
+ xpt_polled_action((union ccb *)&nvmeio);
- error = cam_periph_error(&ccb,
+ error = cam_periph_error((union ccb *)&nvmeio,
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
- if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
- cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
+ if ((nvmeio.ccb_h.status & CAM_DEV_QFRZN) != 0)
+ cam_release_devq(nvmeio.ccb_h.path, /*relsim_flags*/0,
/*reduction*/0, /*timeout*/0, /*getcount_only*/0);
if (error != 0)
xpt_print(periph->path, "flush cmd failed\n");
OpenPOWER on IntegriCloud