aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ata
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-12-06 23:05:15 +0000
committerWarner Losh <imp@FreeBSD.org>2017-12-06 23:05:15 +0000
commit2b31251a64777c01ede787691954d7d6fbda64c6 (patch)
tree15858e1a947f6ab7946878338cca6ee2af632087 /sys/cam/ata
parentf93a843cd28089c6c4d53273b5a1adf7047c3d0b (diff)
downloadsrc-2b31251a64777c01ede787691954d7d6fbda64c6.tar.gz
src-2b31251a64777c01ede787691954d7d6fbda64c6.zip
Now that cam_periph_runccb() can be called from situations where the
kernel scheduler is stopped, replace the by hand calling of xpt_polled_action() with it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388
Notes
Notes: svn path=/head/; revision=326644
Diffstat (limited to 'sys/cam/ata')
-rw-r--r--sys/cam/ata/ata_da.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index edb338e1e751..f5acdf62b9a3 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -1088,13 +1088,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA,
0, lba, count);
}
- xpt_polled_action(&ccb);
-
- error = adaerror(&ccb,
- 0, SF_NO_RECOVERY | SF_NO_RETRY);
- if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
- cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
- /*reduction*/0, /*timeout*/0, /*getcount_only*/0);
+ error = cam_periph_runccb(&ccb, adaerror,
+ 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
if (error != 0)
printf("Aborting dump due to I/O error.\n");
@@ -1124,13 +1119,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0);
else
ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0);
- xpt_polled_action(&ccb);
-
- error = adaerror(&ccb,
- 0, SF_NO_RECOVERY | SF_NO_RETRY);
- if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
- cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0,
- /*reduction*/0, /*timeout*/0, /*getcount_only*/0);
+ error = cam_periph_runccb(&ccb, adaerror,
+ 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
if (error != 0)
xpt_print(periph->path, "Synchronize cache failed\n");
}
@@ -3510,32 +3500,9 @@ adaspindown(uint8_t cmd, int flags)
0,
ada_default_timeout*1000);
ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0);
-
- if (!SCHEDULER_STOPPED()) {
- /*
- * Not panicing, can just do the normal runccb
- * XXX should make cam_periph_runccb work while
- * XXX panicing... later
- */
- error = cam_periph_runccb((union ccb *)&local_ccb, adaerror,
- /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY,
- softc->disk->d_devstat);
- } else {
- /*
- * Panicing, so we have to do this by hand: do
- * xpt_polled_action to run the request through the SIM,
- * extract the error, and if the queue was frozen,
- * unfreeze it. cam_periph_runccb takes care of these
- * details, but xpt_polled_action doesn't.
- */
- xpt_polled_action((union ccb *)&local_ccb);
- error = adaerror((union ccb *)&local_ccb, 0,
- SF_NO_RECOVERY | SF_NO_RETRY);
- if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
- cam_release_devq(local_ccb.ccb_h.path,
- /*relsim_flags*/0, /*reduction*/0,
- /*timeout*/0, /*getcount_only*/0);
- }
+ error = cam_periph_runccb((union ccb *)&local_ccb, adaerror,
+ /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY,
+ softc->disk->d_devstat);
if (error != 0)
xpt_print(periph->path, "Spin-down disk failed\n");
cam_periph_unlock(periph);