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

To: "Shan, Haitao" <haitao.shan@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH][dom0] Add a module exit function to BLKBACK
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Tue, 22 Jan 2008 07:48:45 +0000
Cc: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Dugger, Donald D" <donald.d.dugger@xxxxxxxxx>
Delivery-date: Mon, 21 Jan 2008 23:49:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <823A93EED437D048963A3697DB0E35DE010F0729@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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+SGSbWP5zxuMtLwAER4Pp
Thread-topic: [PATCH][dom0] Add a module exit function to BLKBACK
User-agent: Microsoft-Entourage/11.3.6.070618
Looks to completely ignore that you may have blkfronts connected and I/Os still in flight. This will only work for a totally quiescent blkback.

 -- Keir

On 22/1/08 05:46, "Shan, Haitao" <haitao.shan@xxxxxxxxx> wrote:

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


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