/* Functions to push and pop a job onto the head of a given job list.  */
static struct kcopyd_job* pop(struct list_head *jobs, struct dm_kcopyd_client *kc)
/* Functions to push and pop a job onto the head of a given job list.  */
static struct kcopyd_job* pop(struct list_head *jobs, struct dm_kcopyd_client *kc)
{
	struct kcopyd_job *job = NULL;
	unsigned long flags;
	spin_lock_irqsave(&kc->job_lock, flags);
	if (!list_empty(jobs)) {
		job = list_entry(jobs->next, struct kcopyd_job, list);
		list_del(&job->list);
	}
	spin_unlock_irqrestore(&kc->job_lock, flags);
	return job;
}