[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.