528
529
530
531
532static void do_nbd_request(struct request_queue * q)
533{
534 struct request *req;
535
536 while ((req = elv_next_request(q)) != NULL) {
537 struct nbd_device *lo;
538
539 blkdev_dequeue_request(req);
540
541 spin_unlock_irq(q->queue_lock);
542
543 dprintk(DBG_BLKDEV, "%s: request %p: dequeued (flags=%x)\n",
544 req->rq_disk->disk_name, req, req->cmd_type);
545
546 lo = req->rq_disk->private_data;
547
548 BUG_ON(lo->magic != LO_MAGIC);
549
550 spin_lock_irq(&lo->queue_lock);
551 list_add_tail(&req->queuelist, &lo->waiting_queue);
552 spin_unlock_irq(&lo->queue_lock);
553
554 wake_up(&lo->waiting_wq);
555
556 spin_lock_irq(q->queue_lock);
557 }
558}
559
560static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
561 unsigned int cmd, unsigned long arg)
562{
563 struct nbd_device *lo = bdev->bd_disk->private_data;
564 struct file *file;
565 int error;
566 struct request sreq ;
567 struct task_struct *thread;
568