1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

MFprojects/camlock r249542:

Remove ADA_FLAG_PACK_INVALID flag. Since ATA disks have no concept of media
change it only duplicates CAM_PERIPH_INVALID flag, so we can use last one.

Slightly cleanup DA_FLAG_PACK_INVALID use.
This commit is contained in:
Alexander Motin 2013-04-27 12:46:04 +00:00
parent d38c0e53a8
commit 7338ef1a6b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249981
2 changed files with 10 additions and 43 deletions

View File

@ -74,7 +74,6 @@ typedef enum {
} ada_state; } ada_state;
typedef enum { typedef enum {
ADA_FLAG_PACK_INVALID = 0x0001,
ADA_FLAG_CAN_48BIT = 0x0002, ADA_FLAG_CAN_48BIT = 0x0002,
ADA_FLAG_CAN_FLUSHCACHE = 0x0004, ADA_FLAG_CAN_FLUSHCACHE = 0x0004,
ADA_FLAG_CAN_NCQ = 0x0008, ADA_FLAG_CAN_NCQ = 0x0008,
@ -538,16 +537,11 @@ adaopen(struct disk *dp)
return (error); return (error);
} }
softc = (struct ada_softc *)periph->softc;
softc->flags |= ADA_FLAG_OPEN;
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH,
("adaopen\n")); ("adaopen\n"));
if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { softc = (struct ada_softc *)periph->softc;
/* Invalidate our pack information. */ softc->flags |= ADA_FLAG_OPEN;
softc->flags &= ~ADA_FLAG_PACK_INVALID;
}
cam_periph_unhold(periph); cam_periph_unhold(periph);
cam_periph_unlock(periph); cam_periph_unlock(periph);
@ -576,7 +570,7 @@ adaclose(struct disk *dp)
/* We only sync the cache if the drive is capable of it. */ /* We only sync the cache if the drive is capable of it. */
if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 &&
(softc->flags & ADA_FLAG_PACK_INVALID) == 0) { (periph->flags & CAM_PERIPH_INVALID) == 0) {
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
cam_fill_ataio(&ccb->ataio, cam_fill_ataio(&ccb->ataio,
@ -651,7 +645,7 @@ adastrategy(struct bio *bp)
/* /*
* If the device has been made invalid, error out * If the device has been made invalid, error out
*/ */
if ((softc->flags & ADA_FLAG_PACK_INVALID)) { if ((periph->flags & CAM_PERIPH_INVALID) != 0) {
cam_periph_unlock(periph); cam_periph_unlock(periph);
biofinish(bp, NULL, ENXIO); biofinish(bp, NULL, ENXIO);
return; return;
@ -702,7 +696,7 @@ adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len
lba = offset / secsize; lba = offset / secsize;
count = length / secsize; count = length / secsize;
if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { if ((periph->flags & CAM_PERIPH_INVALID) != 0) {
cam_periph_unlock(periph); cam_periph_unlock(periph);
return (ENXIO); return (ENXIO);
} }
@ -827,8 +821,6 @@ adaoninvalidate(struct cam_periph *periph)
*/ */
xpt_register_async(0, adaasync, periph, periph->path); xpt_register_async(0, adaasync, periph, periph->path);
softc->flags |= ADA_FLAG_PACK_INVALID;
/* /*
* Return all queued I/O with ENXIO. * Return all queued I/O with ENXIO.
* XXX Handle any transactions queued to the card * XXX Handle any transactions queued to the card
@ -990,7 +982,7 @@ adasysctlinit(void *context, int pending)
periph = (struct cam_periph *)context; periph = (struct cam_periph *)context;
/* periph was held for us when this task was enqueued */ /* periph was held for us when this task was enqueued */
if (periph->flags & CAM_PERIPH_INVALID) { if ((periph->flags & CAM_PERIPH_INVALID) != 0) {
cam_periph_release(periph); cam_periph_release(periph);
return; return;
} }
@ -1597,10 +1589,9 @@ adastart(struct cam_periph *periph, union ccb *start_ccb)
case ADA_STATE_RAHEAD: case ADA_STATE_RAHEAD:
case ADA_STATE_WCACHE: case ADA_STATE_WCACHE:
{ {
if (softc->flags & ADA_FLAG_PACK_INVALID) { if ((periph->flags & CAM_PERIPH_INVALID) != 0) {
softc->state = ADA_STATE_NORMAL; softc->state = ADA_STATE_NORMAL;
xpt_release_ccb(start_ccb); xpt_release_ccb(start_ccb);
adaschedule(periph);
cam_periph_release_locked(periph); cam_periph_release_locked(periph);
return; return;
} }
@ -1660,19 +1651,6 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
return; return;
} }
if (error != 0) { if (error != 0) {
if (error == ENXIO &&
(softc->flags & ADA_FLAG_PACK_INVALID) == 0) {
/*
* Catastrophic error. Mark our pack as
* invalid.
*/
/*
* XXX See if this is really a media
* XXX change first?
*/
xpt_print(path, "Invalidating pack\n");
softc->flags |= ADA_FLAG_PACK_INVALID;
}
bp->bio_error = error; bp->bio_error = error;
bp->bio_resid = bp->bio_bcount; bp->bio_resid = bp->bio_bcount;
bp->bio_flags |= BIO_ERROR; bp->bio_flags |= BIO_ERROR;

View File

@ -1007,7 +1007,6 @@ daopen(struct disk *dp)
{ {
struct cam_periph *periph; struct cam_periph *periph;
struct da_softc *softc; struct da_softc *softc;
int unit;
int error; int error;
periph = (struct cam_periph *)dp->d_drv1; periph = (struct cam_periph *)dp->d_drv1;
@ -1022,17 +1021,12 @@ daopen(struct disk *dp)
return (error); return (error);
} }
unit = periph->unit_number;
softc = (struct da_softc *)periph->softc;
softc->flags |= DA_FLAG_OPEN;
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH,
("daopen\n")); ("daopen\n"));
if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { softc = (struct da_softc *)periph->softc;
/* Invalidate our pack information. */ softc->flags |= DA_FLAG_OPEN;
softc->flags &= ~DA_FLAG_PACK_INVALID; softc->flags &= ~DA_FLAG_PACK_INVALID;
}
dareprobe(periph); dareprobe(periph);
@ -2684,11 +2678,6 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
if (softc->outstanding_cmds == 0) if (softc->outstanding_cmds == 0)
softc->flags |= DA_FLAG_WENT_IDLE; softc->flags |= DA_FLAG_WENT_IDLE;
if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) {
xpt_print(periph->path, "oustanding %d\n",
softc->outstanding_cmds);
}
if (state == DA_CCB_DELETE) { if (state == DA_CCB_DELETE) {
while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) while ((bp1 = bioq_takefirst(&softc->delete_run_queue))
!= NULL) { != NULL) {