Lines Matching refs:queue

59 int queue_initialise (Queue_t *queue)  in queue_initialise()  argument
64 spin_lock_init(&queue->queue_lock); in queue_initialise()
65 INIT_LIST_HEAD(&queue->head); in queue_initialise()
66 INIT_LIST_HEAD(&queue->free); in queue_initialise()
74 queue->alloc = q = kmalloc_array(nqueues, sizeof(QE_t), GFP_KERNEL); in queue_initialise()
79 list_add(&q->list, &queue->free); in queue_initialise()
83 return queue->alloc != NULL; in queue_initialise()
91 void queue_free (Queue_t *queue) in queue_free() argument
93 if (!list_empty(&queue->head)) in queue_free()
94 printk(KERN_WARNING "freeing non-empty queue %p\n", queue); in queue_free()
95 kfree(queue->alloc); in queue_free()
107 int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head) in __queue_add() argument
114 spin_lock_irqsave(&queue->queue_lock, flags); in __queue_add()
115 if (list_empty(&queue->free)) in __queue_add()
118 l = queue->free.next; in __queue_add()
128 list_add(l, &queue->head); in __queue_add()
130 list_add_tail(l, &queue->head); in __queue_add()
134 spin_unlock_irqrestore(&queue->queue_lock, flags); in __queue_add()
138 static struct scsi_cmnd *__queue_remove(Queue_t *queue, struct list_head *ent) in __queue_remove() argument
150 list_add(ent, &queue->free); in __queue_remove()
162 struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsigned long *exclude) in queue_remove_exclude() argument
168 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_exclude()
169 list_for_each(l, &queue->head) { in queue_remove_exclude()
173 SCpnt = __queue_remove(queue, l); in queue_remove_exclude()
177 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_exclude()
188 struct scsi_cmnd *queue_remove(Queue_t *queue) in queue_remove() argument
193 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove()
194 if (!list_empty(&queue->head)) in queue_remove()
195 SCpnt = __queue_remove(queue, queue->head.next); in queue_remove()
196 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove()
210 struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target, int lun, in queue_remove_tgtluntag() argument
217 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_tgtluntag()
218 list_for_each(l, &queue->head) { in queue_remove_tgtluntag()
222 SCpnt = __queue_remove(queue, l); in queue_remove_tgtluntag()
226 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_tgtluntag()
238 void queue_remove_all_target(Queue_t *queue, int target) in queue_remove_all_target() argument
243 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_all_target()
244 list_for_each(l, &queue->head) { in queue_remove_all_target()
247 __queue_remove(queue, l); in queue_remove_all_target()
249 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_all_target()
261 int queue_probetgtlun (Queue_t *queue, int target, int lun) in queue_probetgtlun() argument
267 spin_lock_irqsave(&queue->queue_lock, flags); in queue_probetgtlun()
268 list_for_each(l, &queue->head) { in queue_probetgtlun()
275 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_probetgtlun()
287 int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt) in queue_remove_cmd() argument
293 spin_lock_irqsave(&queue->queue_lock, flags); in queue_remove_cmd()
294 list_for_each(l, &queue->head) { in queue_remove_cmd()
297 __queue_remove(queue, l); in queue_remove_cmd()
302 spin_unlock_irqrestore(&queue->queue_lock, flags); in queue_remove_cmd()