On Wed, 2010-09-29 at 08:10 +0900, Jens Axboe wrote:
> It looks like that if we need to restart the requeue, then
> we use the initial position and not the current index. Does
> this help?
>
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index 1bcd208..81ee063 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -162,7 +162,7 @@ struct ubd {
> spinlock_t lock;
> struct scatterlist sg[MAX_SG];
> struct request *request;
> - int start_sg, end_sg;
> + int start_sg, end_sg, rq_off;
> };
>
> #define DEFAULT_COW { \
> @@ -187,6 +187,7 @@ struct ubd {
> .request = NULL, \
> .start_sg = 0, \
> .end_sg = 0, \
> + .rq_off = 0, \
> }
>
> /* Protected by ubd_lock */
> @@ -1241,10 +1242,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_off = 0;
> }
>
> req = dev->request;
> - sector = blk_rq_pos(req);
> + sector = blk_rq_pos(req) + dev->rq_off;
> while(dev->start_sg < dev->end_sg){
> struct scatterlist *sg = &dev->sg[dev->start_sg];
>
> @@ -1273,6 +1275,7 @@ static void do_ubd_request(struct request_queue *q)
> }
>
> dev->start_sg++;
> + dev->rq_off += sg->length >> 9;
> }
> dev->end_sg = 0;
> dev->request = NULL;
>
Yes, this works. I quickly tested it on current git version, and it does
not require the work-around. So far no corruption seen.
Thanks!
-Janjaap
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel