[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 7 of 7] blktap: Remove passthrough mode



blktap: Remove passthrough mode.

Signed-off-by: Jake Wires <jake.wires@xxxxxxxxxx>
Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/blktap.h
--- a/drivers/xen/blktap/blktap.h       Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/blktap.h       Wed Jun 02 19:45:25 2010 -0700
@@ -9,8 +9,6 @@
 #include <xen/blkif.h>
 #include <xen/grant_table.h>
 
-//#define ENABLE_PASSTHROUGH
-
 extern int blktap_debug_level;
 
 #define BTPRINTK(level, tag, force, _f, _a...)                         \
diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c       Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/device.c       Wed Jun 02 19:45:25 2010 -0700
@@ -646,98 +646,6 @@
        return err;
 }
 
-#ifdef ENABLE_PASSTHROUGH
-#define rq_for_each_bio_safe(_bio, _tmp, _req)                         \
-       if ((_req)->bio)                                                \
-               for (_bio = (_req)->bio;                                \
-                    _bio && ((_tmp = _bio->bi_next) || 1);             \
-                    _bio = _tmp)
-
-static void
-blktap_device_forward_request(struct blktap *tap, struct request *req)
-{
-       struct bio *bio, *tmp;
-       struct blktap_device *dev;
-
-       dev = &tap->device;
-
-       rq_for_each_bio_safe(bio, tmp, req) {
-               bio->bi_bdev = dev->bdev;
-               submit_bio(bio->bi_rw, bio);
-       }
-}
-
-static void
-blktap_device_close_bdev(struct blktap *tap)
-{
-       struct blktap_device *dev;
-
-       dev = &tap->device;
-
-       if (dev->bdev)
-               blkdev_put(dev->bdev);
-
-       dev->bdev = NULL;
-       clear_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse);
-}
-
-static int
-blktap_device_open_bdev(struct blktap *tap, u32 pdev)
-{
-       struct block_device *bdev;
-       struct blktap_device *dev;
-
-       dev = &tap->device;
-
-       bdev = open_by_devnum(pdev, FMODE_WRITE);
-       if (IS_ERR(bdev)) {
-               BTERR("opening device %x:%x failed: %ld\n",
-                     MAJOR(pdev), MINOR(pdev), PTR_ERR(bdev));
-               return PTR_ERR(bdev);
-       }
-
-       if (!bdev->bd_disk) {
-               BTERR("device %x:%x doesn't exist\n",
-                     MAJOR(pdev), MINOR(pdev));
-               blkdev_put(dev->bdev);
-               return -ENOENT;
-       }
-
-       dev->bdev = bdev;
-       set_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse);
-
-       /* TODO: readjust queue parameters */
-
-       BTINFO("set device %d to passthrough on %x:%x\n",
-              tap->minor, MAJOR(pdev), MINOR(pdev));
-
-       return 0;
-}
-
-int
-blktap_device_enable_passthrough(struct blktap *tap,
-                                unsigned major, unsigned minor)
-{
-       u32 pdev;
-       struct blktap_device *dev;
-
-       dev  = &tap->device;
-       pdev = MKDEV(major, minor);
-
-       if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
-               return -EINVAL;
-
-       if (dev->bdev) {
-               if (pdev)
-                       return -EINVAL;
-               blktap_device_close_bdev(tap);
-               return 0;
-       }
-
-       return blktap_device_open_bdev(tap, pdev);
-}
-#endif
-
 /*
  * called from tapdisk context
  */
@@ -769,14 +677,6 @@
                        continue;
                }
 
-#ifdef ENABLE_PASSTHROUGH
-               if (test_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse)) {
-                       blkdev_dequeue_request(req);
-                       blktap_device_forward_request(tap, req);
-                       continue;
-               }
-#endif
-
                if (RING_FULL(&ring->ring)) {
                wait:
                        /* Avoid pointless unplugs. */
@@ -927,11 +827,6 @@
        dev->gd = NULL;
        spin_unlock_irq(&dev->lock);
 
-#ifdef ENABLE_PASSTHROUGH
-       if (dev->bdev)
-               blktap_device_close_bdev(tap);
-#endif
-
        del_gendisk(gd);
        blk_cleanup_queue(gd->queue);
        put_disk(gd);
diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/sysfs.c
--- a/drivers/xen/blktap/sysfs.c        Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/sysfs.c        Wed Jun 02 19:45:25 2010 -0700
@@ -114,50 +114,6 @@
 }
 CLASS_DEVICE_ATTR(remove, S_IWUSR, NULL, blktap_sysfs_remove_device);
 
-#ifdef ENABLE_PASSTHROUGH
-static ssize_t
-blktap_sysfs_enable_passthrough(struct device *dev,
-                               const char *buf, size_t size)
-{
-       int err;
-       unsigned major, minor;
-       struct blktap *tap = (struct blktap *)dev_get_drvdata(dev);
-
-       BTINFO("passthrough request enabled\n");
-
-       blktap_sysfs_enter(tap);
-
-       if (!tap->ring.dev ||
-           test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse)) {
-               err = -ENODEV;
-               goto out;
-       }
-
-       if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse)) {
-               err = -EINVAL;
-               goto out;
-       }
-
-       if (test_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse)) {
-               err = -EINVAL;
-               goto out;
-       }
-
-       err = sscanf(buf, "%x:%x", &major, &minor);
-       if (err != 2) {
-               err = -EINVAL;
-               goto out;
-       }
-
-       err = blktap_device_enable_passthrough(tap, major, minor);
-
-out:
-       blktap_sysfs_exit(tap);
-       BTDBG("returning %d\n", (err ? err : size));
-       return (err ? err : size);
-}
-#endif
-
 static ssize_t
 blktap_sysfs_debug_device(struct device *dev, struct device_attribute *attr, 
char *buf)
 {
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.