Commit f81f2f7c authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

ubd: drop unnecessary rq->sector manipulation

ubd curiously updates rq->sector while issuing the request in multiple
pieces.  Don't do it and simply use local copy of sector.

[ Impact: cleanup ]
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 4d6c84d9
...@@ -1222,7 +1222,8 @@ static void do_ubd_request(struct request_queue *q) ...@@ -1222,7 +1222,8 @@ static void do_ubd_request(struct request_queue *q)
{ {
struct io_thread_req *io_req; struct io_thread_req *io_req;
struct request *req; struct request *req;
int n, last_sectors; sector_t sector;
int n;
while(1){ while(1){
struct ubd *dev = q->queuedata; struct ubd *dev = q->queuedata;
...@@ -1238,11 +1239,10 @@ static void do_ubd_request(struct request_queue *q) ...@@ -1238,11 +1239,10 @@ static void do_ubd_request(struct request_queue *q)
} }
req = dev->request; req = dev->request;
last_sectors = 0; sector = req->sector;
while(dev->start_sg < dev->end_sg){ while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg]; struct scatterlist *sg = &dev->sg[dev->start_sg];
req->sector += last_sectors;
io_req = kmalloc(sizeof(struct io_thread_req), io_req = kmalloc(sizeof(struct io_thread_req),
GFP_ATOMIC); GFP_ATOMIC);
if(io_req == NULL){ if(io_req == NULL){
...@@ -1251,10 +1251,10 @@ static void do_ubd_request(struct request_queue *q) ...@@ -1251,10 +1251,10 @@ static void do_ubd_request(struct request_queue *q)
return; return;
} }
prepare_request(req, io_req, prepare_request(req, io_req,
(unsigned long long) req->sector << 9, (unsigned long long)sector << 9,
sg->offset, sg->length, sg_page(sg)); sg->offset, sg->length, sg_page(sg));
last_sectors = sg->length >> 9; sector += sg->length >> 9;
n = os_write_file(thread_fd, &io_req, n = os_write_file(thread_fd, &io_req,
sizeof(struct io_thread_req *)); sizeof(struct io_thread_req *));
if(n != sizeof(struct io_thread_req *)){ if(n != sizeof(struct io_thread_req *)){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment