Lines Matching full:queue

3  *  linux/drivers/acorn/scsi/queue.c: queue handling primitives
46 #include "queue.h"
51 * Function: void queue_initialise (Queue_t *queue)
52 * Purpose : initialise a queue
53 * Params : queue - queue to initialise
55 int queue_initialise (Queue_t *queue) in queue_initialise() argument
60 spin_lock_init(&queue->queue_lock); in queue_initialise()
61 INIT_LIST_HEAD(&queue->head); in queue_initialise()
62 INIT_LIST_HEAD(&queue->free); in queue_initialise()
70 queue->alloc = q = kmalloc_array(nqueues, sizeof(QE_t), GFP_KERNEL); in queue_initialise()
75 list_add(&q->list, &queue->free); in queue_initialise()
79 return queue->alloc != NULL; in queue_initialise()
83 * Function: void queue_free (Queue_t *queue)
84 * Purpose : free a queue
85 * Params : queue - queue to free
87 void queue_free (Queue_t *queue) in queue_free() argument
89 if (!list_empty(&queue->head)) in queue_free()
90 printk(KERN_WARNING "freeing non-empty queue %p\n", queue); in queue_free()
91 kfree(queue->alloc); in queue_free()
96 * Function: int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head)
97 * Purpose : Add a new command onto a queue, adding REQUEST_SENSE to head.
98 * Params : queue - destination queue
100 * head - add command to head of queue
103 int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head) in __queue_add() argument
110 spin_lock_irqsave(&queue->queue_lock, flags); in __queue_add()
111 if (list_empty(&queue->free)) in __queue_add()
114 l = queue->free.next; in __queue_add()
124 list_add(l, &queue->head); in __queue_add()
126 list_add_tail(l, &queue->head); in __queue_add()
130 spin_unlock_irqrestore(&queue->queue_lock, flags); in __queue_add()
134 static struct scsi_cmnd *__queue_remove(Queue_t *queue, struct list_head *ent) in __queue_remove() argument
146 list_add(ent, &queue->free); in __queue_remove()
152 * Function: struct scsi_cmnd *queue_remove_exclude (queue, exclude)
153 * Purpose : remove a SCSI command from a queue
154 * Params : queue - queue to remove command from
158 struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsigned long *exclude) in queue_remove_exclude() argument
164 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_exclude()
165 list_for_each(l, &queue->head) { in queue_remove_exclude()
169 SCpnt = __queue_remove(queue, l); in queue_remove_exclude()
173 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_exclude()
179 * Function: struct scsi_cmnd *queue_remove (queue)
180 * Purpose : removes first SCSI command from a queue
181 * Params : queue - queue to remove command from
184 struct scsi_cmnd *queue_remove(Queue_t *queue) in queue_remove() argument
189 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove()
190 if (!list_empty(&queue->head)) in queue_remove()
191 SCpnt = __queue_remove(queue, queue->head.next); in queue_remove()
192 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove()
198 * Function: struct scsi_cmnd *queue_remove_tgtluntag (queue, target, lun, tag)
199 * Purpose : remove a SCSI command from the queue for a specified target/lun/tag
200 * Params : queue - queue to remove command from
206 struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target, int lun, in queue_remove_tgtluntag() argument
213 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_tgtluntag()
214 list_for_each(l, &queue->head) { in queue_remove_tgtluntag()
218 SCpnt = __queue_remove(queue, l); in queue_remove_tgtluntag()
222 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_tgtluntag()
228 * Function: queue_remove_all_target(queue, target)
229 * Purpose : remove all SCSI commands from the queue for a specified target
230 * Params : queue - queue to remove command from
234 void queue_remove_all_target(Queue_t *queue, int target) in queue_remove_all_target() argument
239 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_all_target()
240 list_for_each(l, &queue->head) { in queue_remove_all_target()
243 __queue_remove(queue, l); in queue_remove_all_target()
245 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_all_target()
249 * Function: int queue_probetgtlun (queue, target, lun)
250 * Purpose : check to see if we have a command in the queue for the specified
252 * Params : queue - queue to look in
257 int queue_probetgtlun (Queue_t *queue, int target, int lun) in queue_probetgtlun() argument
263 spin_lock_irqsave(&queue->queue_lock, flags); in queue_probetgtlun()
264 list_for_each(l, &queue->head) { in queue_probetgtlun()
271 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_probetgtlun()
277 * Function: int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt)
279 * Params : queue - queue to look in
283 int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt) in queue_remove_cmd() argument
289 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_cmd()
290 list_for_each(l, &queue->head) { in queue_remove_cmd()
293 __queue_remove(queue, l); in queue_remove_cmd()
298 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_cmd()