/* * If life was easier, then SCpnt would have a * host-available list head, and we wouldn't * need to keep free lists or allocate this * memory.
*/
queue->alloc = q = kmalloc_array(nqueues, sizeof(QE_t), GFP_KERNEL); if (q) { for (; nqueues; q++, nqueues--) {
SET_MAGIC(q, QUEUE_MAGIC_FREE);
q->SCpnt = NULL;
list_add(&q->list, &queue->free);
}
}
/* * Function: int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head) * Purpose : Add a new command onto a queue, adding REQUEST_SENSE to head. * Params : queue - destination queue * SCpnt - command to add * head - add command to head of queue * Returns : 0 on error, !0 on success
*/ int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head)
{ unsignedlong flags; struct list_head *l;
QE_t *q; int ret = 0;
spin_lock_irqsave(&queue->queue_lock, flags); if (list_empty(&queue->free)) goto empty;
/* * Move the entry from the "used" list onto the "free" list
*/
list_del(ent);
q = list_entry(ent, QE_t, list);
BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_USED));
/* * Function: struct scsi_cmnd *queue_remove_exclude (queue, exclude) * Purpose : remove a SCSI command from a queue * Params : queue - queue to remove command from * exclude - bit array of target&lun which is busy * Returns : struct scsi_cmnd if successful (and a reference), or NULL if no command available
*/ struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsignedlong *exclude)
{ unsignedlong flags; struct list_head *l; struct scsi_cmnd *SCpnt = NULL;
/* * Function: struct scsi_cmnd *queue_remove (queue) * Purpose : removes first SCSI command from a queue * Params : queue - queue to remove command from * Returns : struct scsi_cmnd if successful (and a reference), or NULL if no command available
*/ struct scsi_cmnd *queue_remove(Queue_t *queue)
{ unsignedlong flags; struct scsi_cmnd *SCpnt = NULL;
spin_lock_irqsave(&queue->queue_lock, flags); if (!list_empty(&queue->head))
SCpnt = __queue_remove(queue, queue->head.next);
spin_unlock_irqrestore(&queue->queue_lock, flags);
return SCpnt;
}
/* * Function: struct scsi_cmnd *queue_remove_tgtluntag (queue, target, lun, tag) * Purpose : remove a SCSI command from the queue for a specified target/lun/tag * Params : queue - queue to remove command from * target - target that we want * lun - lun on device * tag - tag on device * Returns : struct scsi_cmnd if successful, or NULL if no command satisfies requirements
*/ struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target, int lun, int tag)
{ unsignedlong flags; struct list_head *l; struct scsi_cmnd *SCpnt = NULL;
/* * Function: int queue_probetgtlun (queue, target, lun) * Purpose : check to see if we have a command in the queue for the specified * target/lun. * Params : queue - queue to look in * target - target we want to probe * lun - lun on target * Returns : 0 if not found, != 0 if found
*/ int queue_probetgtlun (Queue_t *queue, int target, int lun)
{ unsignedlong flags; struct list_head *l; int found = 0;
/* * Function: int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt) * Purpose : remove a specific command from the queues * Params : queue - queue to look in * SCpnt - command to find * Returns : 0 if not found
*/ int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt)
{ unsignedlong flags; struct list_head *l; int found = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.