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 06 of 12] blktap2: fix blkback/blktap2 interaction

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 06 of 12] blktap2: fix blkback/blktap2 interaction
From: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Date: Fri, 29 Jan 2010 00:59:37 -0000
Delivery-date: Thu, 28 Jan 2010 17:08:43 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1264726771@xxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <patchbomb.1264726771@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.3.1
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1244108032 -3600
# Node ID d39f82ea033d05bd9cfa4a2fbcfca55f3880498b
# Parent  908662be11ba4e0b92f43097caf7625ef84bf6d9
blktap2: 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>

linux-2.6-git:
 * adjust XEN_BLKBACK_PAGEMAP dependencies
 * rebase against git-fbbc8527 (wean off of use of the BlkBack pageflag)

Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>

diff -r 908662be11ba -r d39f82ea033d 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
@@ -127,6 +127,11 @@
        depends on XEN_PCIDEV_BACKEND
 
 
+config XEN_BLKBACK_PAGEMAP
+       tristate
+       depends on XEN_BLKDEV_BACKEND != n && XEN_BLKDEV_TAP != n
+       default XEN_BLKDEV_BACKEND || XEN_BLKDEV_TAP
+
 config XENFS
        tristate "Xen filesystem"
        depends on XEN
diff -r 908662be11ba -r d39f82ea033d 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) := xen-blkback.o
+obj-$(CONFIG_XEN_BLKBACK_PAGEMAP) += blkback-pagemap.o
 
-xen-blkback-y  := blkback.o xenbus.o interface.o vbd.o blkback-pagemap.o
+xen-blkback-y  := blkback.o xenbus.o interface.o vbd.o
diff -r 908662be11ba -r d39f82ea033d 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_size = pages;
        return 0;
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_init);
 
 void
 blkback_pagemap_set(int idx, struct page *page,
@@ -46,6 +47,7 @@
        entry->busid = busid;
        entry->gref  = gref;
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_set);
 
 void
 blkback_pagemap_clear(struct page *page)
@@ -66,6 +68,7 @@
 
        memset(entry, 0, sizeof(*entry));
 }
+EXPORT_SYMBOL_GPL(blkback_pagemap_clear);
 
 struct blkback_pagemap
 blkback_pagemap_read(struct page *page)
@@ -88,6 +91,8 @@
 }
 EXPORT_SYMBOL(blkback_pagemap_read);
 
+MODULE_LICENSE("Dual BSD/GPL");
+
 int
 blkback_pagemap_contains_page(struct page *page)
 {
diff -r 908662be11ba -r d39f82ea033d 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>
 
@@ -13,8 +14,23 @@
        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 *);
-
 int blkback_pagemap_contains_page(struct page *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) {}
+#define blkback_pagemap_read(_page) ({ BUG(); (struct blkback_pagemap){0}; })
+static inline int blkback_pagemap_contains_page(struct page *page) { return 0; 
}
+
+#endif /* CONFIG_XEN_BLKBACK_PAGEMAP */
+
 #endif
diff -r 908662be11ba -r d39f82ea033d 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
@@ -136,8 +136,4 @@
 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 908662be11ba -r d39f82ea033d drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c       Thu Jun 04 10:32:57 2009 +0100
+++ b/drivers/xen/blktap/device.c       Thu Jun 04 10:33:52 2009 +0100
@@ -17,14 +17,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();
-#define blkback_pagemap_contains_page(page) 0
-#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