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][dom0] Add a module exit function to BLKBACK

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][dom0] Add a module exit function to BLKBACK
From: "Shan, Haitao" <haitao.shan@xxxxxxxxx>
Date: Tue, 22 Jan 2008 13:46:12 +0800
Cc: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Dugger, Donald D" <donald.d.dugger@xxxxxxxxx>
Delivery-date: Mon, 21 Jan 2008 21:47:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AchcuhjlBFKCOTC+SGSbWP5zxuMtLw==
Thread-topic: [PATCH][dom0] Add a module exit function to BLKBACK

Hi, Keir,

This little patch will add a module exit function for block backend. Can you have a look?

Signed-off-by: Dugger Donald D <donald.d.dugger@xxxxxxxxx>
Signed-off-by: Haitao Shan        <haitao.shan@xxxxxxxxx>
diff -r 854690f06ed9 drivers/xen/blkback/blkback.c
--- a/drivers/xen/blkback/blkback.c     Tue Jan 15 15:59:31 2008 +0000
+++ b/drivers/xen/blkback/blkback.c     Mon Jan 21 22:37:54 2008 +0800
@@ -165,6 +165,7 @@ static void fast_flush_area(pending_req_
 {
        struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        unsigned int i, invcount = 0;
+       unsigned long pfn;
        grant_handle_t handle;
        int ret;
 
@@ -176,6 +177,8 @@ static void fast_flush_area(pending_req_
                                    handle);
                pending_handle(req, i) = BLKBACK_INVALID_HANDLE;
                invcount++;
+               pfn = page_to_pfn(pending_pages[vaddr_pagenr(req, i)]);
+               set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
        }
 
        ret = HYPERVISOR_grant_table_op(
@@ -612,6 +615,20 @@ static int __init blkif_init(void)
        return -ENOMEM;
 }
 
+static void __exit blkif_exit(void)
+{
+       int mmap_pages;
+
+       mmap_pages = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
+
+       kfree(pending_reqs);
+       kfree(pending_grant_handles);
+       free_empty_pages_and_pagevec(pending_pages, mmap_pages);
+
+       return;
+}
+
 module_init(blkif_init);
+module_exit(blkif_exit);
 
 MODULE_LICENSE("Dual BSD/GPL");
<<exit.patch>>

Best Regards
Haitao Shan

Attachment: exit.patch
Description: exit.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>