On 2010-10-05 22:31, Chris Frey wrote:
> On Tue, Oct 05, 2010 at 10:23:19AM +0200, Tejun Heo wrote:
>> Hmmmm, can you please give a shot at the following one?  Thank you.
> 
> I applied this patch on top of stock 2.6.35.5 as usual (no other patches)
> and tested on my maverick image as before.  I ran a fsck.ext3 on the
> filesystem image from the host before my test, just to make sure, and
> there were no errors.
> 
> Unfortunately, this patch does not fix the issue either.  I get errors
> in the guest like the following:

So how about this? Note that I haven't even compiled this. The request
handling logic really should be fixed in there, it's horribly
inefficient.

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1bcd208..c272cf6 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -163,6 +163,7 @@ struct ubd {
        struct scatterlist sg[MAX_SG];
        struct request *request;
        int start_sg, end_sg;
+       unsigned int rq_offset;
 };
 
 #define DEFAULT_COW { \
@@ -187,6 +188,7 @@ struct ubd {
        .request =              NULL, \
        .start_sg =             0, \
        .end_sg =               0, \
+       .rq_offset              0, \
 }
 
 /* Protected by ubd_lock */
@@ -466,6 +468,8 @@ static void ubd_handler(void)
        int n;
 
        while(1){
+               struct ubd *dev;
+
                n = os_read_file(thread_fd, &req,
                                 sizeof(struct io_thread_req *));
                if(n != sizeof(req)){
@@ -476,6 +480,11 @@ static void ubd_handler(void)
                        return;
                }
 
+               /*
+                * Clear internal offset, block core will update request state
+                */
+               dev = req->req->q->queuedata;
+               dev->rq_offset = 0;
                blk_end_request(req->req, 0, req->length);
                kfree(req);
        }
@@ -1241,10 +1250,11 @@ static void do_ubd_request(struct request_queue *q)
                        dev->request = req;
                        dev->start_sg = 0;
                        dev->end_sg = blk_rq_map_sg(q, req, dev->sg);
+                       dev->rq_offset = 0;
                }
 
                req = dev->request;
-               sector = blk_rq_pos(req);
+               sector = blk_rq_pos(req) + dev->rq_offset;
                while(dev->start_sg < dev->end_sg){
                        struct scatterlist *sg = &dev->sg[dev->start_sg];
 
@@ -1272,6 +1282,7 @@ static void do_ubd_request(struct request_queue *q)
                                return;
                        }
 
+                       dev->rq_offset += sg->length >> 9;
                        dev->start_sg++;
                }
                dev->end_sg = 0;

-- 
Jens Axboe


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to