]> err.no Git - linux-2.6/blobdiff - drivers/block/nbd.c
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / drivers / block / nbd.c
index ba9b17e507e000efb3f37c644373f43812eabd2e..018753c59b8e7d22a6e7afbe634e5a4c94986a11 100644 (file)
@@ -54,7 +54,7 @@ static unsigned int debugflags;
 #endif /* NDEBUG */
 
 static unsigned int nbds_max = 16;
-static struct nbd_device nbd_dev[MAX_NBD];
+static struct nbd_device *nbd_dev;
 
 /*
  * Use just one lock (or at most 1 per NIC). Two arguments for this:
@@ -100,17 +100,15 @@ static const char *nbdcmd_to_ascii(int cmd)
 
 static void nbd_end_request(struct request *req)
 {
-       int uptodate = (req->errors == 0) ? 1 : 0;
+       int error = req->errors ? -EIO : 0;
        struct request_queue *q = req->q;
        unsigned long flags;
 
        dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name,
-                       req, uptodate? "done": "failed");
+                       req, error ? "failed" : "done");
 
        spin_lock_irqsave(q->queue_lock, flags);
-       if (!end_that_request_first(req, uptodate, req->nr_sectors)) {
-               end_that_request_last(req, uptodate);
-       }
+       __blk_end_request(req, error, req->nr_sectors << 9);
        spin_unlock_irqrestore(q->queue_lock, flags);
 }
 
@@ -651,11 +649,9 @@ static int __init nbd_init(void)
 
        BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
-       if (nbds_max > MAX_NBD) {
-               printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,
-                               nbds_max);
-               return -EINVAL;
-       }
+       nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+       if (!nbd_dev)
+               return -ENOMEM;
 
        for (i = 0; i < nbds_max; i++) {
                struct gendisk *disk = alloc_disk(1);