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-changelog

[Xen-changelog] [linux-2.6.18-xen] linux: fix blkback/blktap2 interactio

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] linux: fix blkback/blktap2 interaction
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Jun 2009 18:00:16 -0700
Delivery-date: Thu, 04 Jun 2009 18:00:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108032 -3600
# Node ID 4e5cd2fc45a7c4be4a6d0eb48fdd803fdbd0a28d
# Parent  f994bfe9b93ba834e1815a307617f35b9e213b40
linux: fix blkback/blktap2 interaction

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.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/xen/Kconfig                   |    5 +++++
 drivers/xen/blkback/Makefile          |    3 ++-
 drivers/xen/blkback/blkback-pagemap.c |    7 ++++++-
 drivers/xen/blkback/blkback-pagemap.h |   20 ++++++++++++++++++++
 drivers/xen/blkback/common.h          |    4 ----
 drivers/xen/blktap2/device.c          |    6 ------
 6 files changed, 33 insertions(+), 12 deletions(-)

diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/Kconfig
--- a/drivers/xen/Kconfig       Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/Kconfig       Thu Jun 04 10:33:52 2009 +0100
@@ -74,6 +74,11 @@ config XEN_BLKDEV_TAP2
           high-performance block backends, where disk images may be implemented
           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"
diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/blkback/Makefile
--- a/drivers/xen/blkback/Makefile      Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blkback/Makefile      Thu Jun 04 10:33:52 2009 +0100
@@ -1,3 +1,4 @@ obj-$(CONFIG_XEN_BLKDEV_BACKEND) := blkb
 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
diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/blkback/blkback-pagemap.c
--- a/drivers/xen/blkback/blkback-pagemap.c     Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blkback/blkback-pagemap.c     Thu Jun 04 10:33:52 2009 +0100
@@ -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");
diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/blkback/blkback-pagemap.h
--- a/drivers/xen/blkback/blkback-pagemap.h     Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blkback/blkback-pagemap.h     Thu Jun 04 10:33:52 2009 +0100
@@ -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
diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/blkback/common.h
--- a/drivers/xen/blkback/common.h      Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blkback/common.h      Thu Jun 04 10:33:52 2009 +0100
@@ -138,8 +138,4 @@ int blkback_barrier(struct xenbus_transa
 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__ */
diff -r f994bfe9b93b -r 4e5cd2fc45a7 drivers/xen/blktap2/device.c
--- a/drivers/xen/blktap2/device.c      Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blktap2/device.c      Thu Jun 04 10:33:52 2009 +0100
@@ -13,13 +13,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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] linux: fix blkback/blktap2 interaction, Xen patchbot-linux-2.6.18-xen <=