Lines Matching defs:queue
17 * struct iopf_queue - IO Page Fault queue
19 * @devices: devices attached to this queue
31 * @queue: IOPF queue
32 * @queue_list: index into queue->devices
38 struct iopf_queue *queue;
160 * As long as we're holding param->lock, the queue can't be unlinked
204 queue_work(iopf_param->queue->wq, &group->work);
225 * that no new fault is added to the queue. In particular it must flush its
226 * low-level queue before calling this function.
242 flush_workqueue(iopf_param->queue->wq);
253 * @queue: the queue whose partial faults need to be discarded
255 * When the hardware queue overflows, last page faults in a group may have been
257 * driver shouldn't be adding new faults to this queue concurrently.
261 int iopf_queue_discard_partial(struct iopf_queue *queue)
266 if (!queue)
269 mutex_lock(&queue->lock);
270 list_for_each_entry(iopf_param, &queue->devices, queue_list) {
277 mutex_unlock(&queue->lock);
283 * iopf_queue_add_device - Add producer to the fault queue
284 * @queue: IOPF queue
289 int iopf_queue_add_device(struct iopf_queue *queue, struct device *dev)
303 iopf_param->queue = queue;
306 mutex_lock(&queue->lock);
309 list_add(&iopf_param->queue_list, &queue->devices);
314 mutex_unlock(&queue->lock);
324 * iopf_queue_remove_device - Remove producer from fault queue
325 * @queue: IOPF queue
332 int iopf_queue_remove_device(struct iopf_queue *queue, struct device *dev)
339 if (!param || !queue)
342 mutex_lock(&queue->lock);
345 if (iopf_param && iopf_param->queue == queue) {
351 mutex_unlock(&queue->lock);
366 * iopf_queue_alloc - Allocate and initialize a fault queue
367 * @name: a unique string identifying the queue (for workqueue)
369 * Return: the queue on success and NULL on error.
373 struct iopf_queue *queue;
375 queue = kzalloc(sizeof(*queue), GFP_KERNEL);
376 if (!queue)
385 queue->wq = alloc_workqueue("iopf_queue/%s", WQ_UNBOUND, 0, name);
386 if (!queue->wq) {
387 kfree(queue);
391 INIT_LIST_HEAD(&queue->devices);
392 mutex_init(&queue->lock);
394 return queue;
399 * iopf_queue_free - Free IOPF queue
400 * @queue: queue to free
403 * adding/removing devices on this queue anymore.
405 void iopf_queue_free(struct iopf_queue *queue)
409 if (!queue)
412 list_for_each_entry_safe(iopf_param, next, &queue->devices, queue_list)
413 iopf_queue_remove_device(queue, iopf_param->dev);
415 destroy_workqueue(queue->wq);
416 kfree(queue);