net/9p: Add multi channel support.
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 15 Feb 2010 17:27:00 +0000 (17:27 +0000)
committerEric Van Hensbergen <ericvh@gmail.com>
Fri, 5 Mar 2010 21:04:41 +0000 (15:04 -0600)
This is needed for supporting multiple mount points.

We can find out the device names to be used with mount by checking

/sys/devices/virtio-pci/virtio*/device file

if the device file have value 9 then the specific virtio device can
be used for mounting.

ex:
 #cat /sys/devices/virtio-pci/virtio1/device
 9

now we can mount using
# mount -t 9p -o trans=virtio virtio1  /mnt/

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
include/linux/virtio_9p.h
net/9p/trans_virtio.c

index 095e10d148b40d32780621dec6f259a5c90c22e1..7a615c3f5e3d51bd99fb7a3c4665c48f17968741 100644 (file)
@@ -6,6 +6,6 @@
 #include <linux/virtio_config.h>
 
 /* Maximum number of virtio channels per partition (1 for now) */
-#define MAX_9P_CHAN    1
+#define MAX_9P_CHAN    10
 
 #endif /* _LINUX_VIRTIO_9P_H */
index cb50f4ae5eefa1f5cde720f43daaf6f19e9034eb..df924e5657d34ecdfa785f9ce94e41b1fb7f27de 100644 (file)
@@ -296,13 +296,15 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
 
        mutex_lock(&virtio_9p_lock);
        while (index < MAX_9P_CHAN) {
-               if (chan->initialized && !chan->inuse) {
-                       chan->inuse = true;
-                       break;
-               } else {
-                       index++;
-                       chan = &channels[index];
+               if (chan->initialized &&
+                       !strcmp(devname, dev_name(&chan->vdev->dev))) {
+                       if (!chan->inuse) {
+                               chan->inuse = true;
+                               break;
+                       }
                }
+               index++;
+               chan = &channels[index];
        }
        mutex_unlock(&virtio_9p_lock);