]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/block/lguest_blk.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / drivers / block / lguest_blk.c
index 93e3c4001bf51f299a21bf04eff813b88adfaec6..fa8e42341b87ba9f938b1b67f9b2a5b301c9f54c 100644 (file)
@@ -142,25 +142,23 @@ static irqreturn_t lgb_irq(int irq, void *_bd)
  * return the total length. */
 static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
 {
-       unsigned int i = 0, idx, len = 0;
-       struct bio *bio;
-
-       rq_for_each_bio(bio, req) {
-               struct bio_vec *bvec;
-               bio_for_each_segment(bvec, bio, idx) {
-                       /* We told the block layer not to give us too many. */
-                       BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
-                       /* If we had a zero-length segment, it would look like
-                        * the end of the data referred to by the "struct
-                        * lguest_dma", so make sure that doesn't happen. */
-                       BUG_ON(!bvec->bv_len);
-                       /* Convert page & offset to a physical address */
-                       dma->addr[i] = page_to_phys(bvec->bv_page)
-                               + bvec->bv_offset;
-                       dma->len[i] = bvec->bv_len;
-                       len += bvec->bv_len;
-                       i++;
-               }
+       unsigned int i = 0, len = 0;
+       struct req_iterator iter;
+       struct bio_vec *bvec;
+
+       rq_for_each_segment(bvec, req, iter) {
+               /* We told the block layer not to give us too many. */
+               BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
+               /* If we had a zero-length segment, it would look like
+                * the end of the data referred to by the "struct
+                * lguest_dma", so make sure that doesn't happen. */
+               BUG_ON(!bvec->bv_len);
+               /* Convert page & offset to a physical address */
+               dma->addr[i] = page_to_phys(bvec->bv_page)
+                       + bvec->bv_offset;
+               dma->len[i] = bvec->bv_len;
+               len += bvec->bv_len;
+               i++;
        }
        /* If the array isn't full, we mark the end with a 0 length */
        if (i < LGUEST_MAX_DMA_SECTIONS)
@@ -308,9 +306,12 @@ static int lguestblk_probe(struct lguest_device *lgdev)
        }
 
        /* This allocates a "struct gendisk" where we pack all the information
-        * about the disk which the rest of Linux sees.  We ask for one minor
-        * number; I do wonder if we should be asking for more. */
-       bd->disk = alloc_disk(1);
+        * about the disk which the rest of Linux sees.  The argument is the
+        * number of minor devices desired: we need one minor for the main
+        * disk, and one for each partition.  Of course, we can't possibly know
+        * how many partitions are on the disk (add_disk does that).
+        */
+       bd->disk = alloc_disk(16);
        if (!bd->disk) {
                err = -ENOMEM;
                goto out_unregister_blkdev;