WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux: fix blkback/blktap2 interaction

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux: fix blkback/blktap2 interaction
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 03 Jun 2009 17:05:51 +0100
Delivery-date: Wed, 03 Jun 2009 09:06:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
blkback's page map code needs to be accessible to both blkback and
blktap2, irrespective of whether either or both are modules. The
most immediate solution is to break it out into a separate, library-
like component that doesn't need building if either of the two
consumers is configured off, and that gets built as a module if both
consumers are modules.

Also fix the dummy implementation of blkback_pagemap_read(), since
using BUG() there doesn't compile.

This patch will only apply cleanly on top of the previously sent patch
allowing blktap2 to build as a module.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- head-2009-05-29.orig/drivers/xen/Kconfig    2009-06-03 16:12:43.000000000 
+0200
+++ head-2009-05-29/drivers/xen/Kconfig 2009-06-03 10:26:22.000000000 +0200
@@ -76,6 +76,11 @@ config XEN_BLKDEV_TAP2
           as files, in memory, or on other hosts across the network.  This 
          driver can safely coexist with the existing blockback driver.
 
+config XEN_BLKBACK_PAGEMAP
+       tristate
+       depends on XEN_BLKDEV_BACKEND != n && XEN_BLKDEV_TAP2 != n
+       default XEN_BLKDEV_BACKEND || XEN_BLKDEV_TAP2
+
 config XEN_NETDEV_BACKEND
        tristate "Network-device backend driver"
         depends on XEN_BACKEND && NET
--- head-2009-05-29.orig/drivers/xen/blkback/Makefile   2009-06-03 
16:12:43.000000000 +0200
+++ head-2009-05-29/drivers/xen/blkback/Makefile        2009-06-03 
09:50:42.000000000 +0200
@@ -1,3 +1,4 @@
 obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkbk.o
+obj-$(CONFIG_XEN_BLKBACK_PAGEMAP) += blkback-pagemap.o
 
-blkbk-y        := blkback.o xenbus.o interface.o vbd.o blkback-pagemap.o
+blkbk-y        := blkback.o xenbus.o interface.o vbd.o
--- head-2009-05-29.orig/drivers/xen/blkback/blkback-pagemap.c  2009-06-03 
16:12:43.000000000 +0200
+++ head-2009-05-29/drivers/xen/blkback/blkback-pagemap.c       2009-06-03 
16:02:40.000000000 +0200
@@ -1,4 +1,4 @@
-#include "common.h"
+#include <linux/module.h>
 #include "blkback-pagemap.h"
 
 static int blkback_pagemap_size;
@@ -22,6 +22,7 @@ blkback_pagemap_init(int pages)
        blkback_pagemap_size = pages;
        return 0;
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_init);
 
 void
 blkback_pagemap_set(int idx, struct page *page,
@@ -46,6 +47,7 @@ blkback_pagemap_set(int idx, struct page
        entry->busid = busid;
        entry->gref  = gref;
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_set);
 
 void
 blkback_pagemap_clear(struct page *page)
@@ -67,6 +69,7 @@ blkback_pagemap_clear(struct page *page)
 
        memset(entry, 0, sizeof(*entry));
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_clear);
 
 struct blkback_pagemap
 blkback_pagemap_read(struct page *page)
@@ -89,3 +92,5 @@ blkback_pagemap_read(struct page *page)
        return *entry;
 }
 EXPORT_SYMBOL(blkback_pagemap_read);
+
+MODULE_LICENSE("Dual BSD/GPL");
--- head-2009-05-29.orig/drivers/xen/blkback/blkback-pagemap.h  2009-06-03 
16:12:43.000000000 +0200
+++ head-2009-05-29/drivers/xen/blkback/blkback-pagemap.h       2009-06-03 
16:13:17.000000000 +0200
@@ -1,6 +1,7 @@
 #ifndef _BLKBACK_PAGEMAP_H_
 #define _BLKBACK_PAGEMAP_H_
 
+#include <linux/mm.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 
@@ -12,6 +13,25 @@ struct blkback_pagemap {
        grant_ref_t      gref;
 };
 
+#if defined(CONFIG_XEN_BLKBACK_PAGEMAP) || 
defined(CONFIG_XEN_BLKBACK_PAGEMAP_MODULE)
+
+int blkback_pagemap_init(int);
+void blkback_pagemap_set(int, struct page *, domid_t, busid_t, grant_ref_t);
+void blkback_pagemap_clear(struct page *);
 struct blkback_pagemap blkback_pagemap_read(struct page *);
 
+#else /* CONFIG_XEN_BLKBACK_PAGEMAP */
+
+static inline int blkback_pagemap_init(int pages) { return 0; }
+static inline void blkback_pagemap_set(int idx, struct page *page, domid_t dom,
+                                      busid_t bus, grant_ref_t gnt) {}
+static inline void blkback_pagemap_clear(struct page *page) {}
+static inline struct blkback_pagemap blkback_pagemap_read(struct page *page)
+{
+       BUG();
+       return (struct blkback_pagemap){-1, -1, -1};
+}
+
+#endif /* CONFIG_XEN_BLKBACK_PAGEMAP */
+
 #endif
--- head-2009-05-29.orig/drivers/xen/blkback/common.h   2009-06-03 
16:12:43.000000000 +0200
+++ head-2009-05-29/drivers/xen/blkback/common.h        2009-06-03 
09:55:06.000000000 +0200
@@ -150,8 +150,4 @@ int blkif_schedule(void *arg);
 int blkback_barrier(struct xenbus_transaction xbt,
                    struct backend_info *be, int state);
 
-int blkback_pagemap_init(int);
-void blkback_pagemap_set(int, struct page *, domid_t, busid_t, grant_ref_t);
-void blkback_pagemap_clear(struct page *);
-
 #endif /* __BLKIF__BACKEND__COMMON_H__ */
--- head-2009-05-29.orig/drivers/xen/blktap2/device.c   2009-06-03 
16:12:43.000000000 +0200
+++ head-2009-05-29/drivers/xen/blktap2/device.c        2009-06-03 
15:40:39.000000000 +0200
@@ -14,13 +14,7 @@
 
 #include "blktap.h"
 
-#if defined(CONFIG_XEN_BLKDEV_BACKEND) || \
-    (defined(CONFIG_XEN_BLKDEV_BACKEND_MODULE) && defined(MODULE))
 #include "../blkback/blkback-pagemap.h"
-#else
-struct blkback_pagemap { };
-#define blkback_pagemap_read(page) BUG();
-#endif
 
 #if 0
 #define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a)



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux: fix blkback/blktap2 interaction, Jan Beulich <=