Commit 9564df1f authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] fix pf request handling

Here's the patch from

http://bugzilla.kernel.org/show_bug.cgi?id=4853

It is a feeble attempt at fixing the request handling in pf, it is totally
foobar right now.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ef402268
...@@ -750,6 +750,14 @@ static int pf_ready(void) ...@@ -750,6 +750,14 @@ static int pf_ready(void)
static struct request_queue *pf_queue; static struct request_queue *pf_queue;
static void pf_end_request(int uptodate)
{
if (pf_req) {
end_request(pf_req, uptodate);
pf_req = NULL;
}
}
static void do_pf_request(request_queue_t * q) static void do_pf_request(request_queue_t * q)
{ {
if (pf_busy) if (pf_busy)
...@@ -765,7 +773,7 @@ repeat: ...@@ -765,7 +773,7 @@ repeat:
pf_count = pf_req->current_nr_sectors; pf_count = pf_req->current_nr_sectors;
if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) {
end_request(pf_req, 0); pf_end_request(0);
goto repeat; goto repeat;
} }
...@@ -780,7 +788,7 @@ repeat: ...@@ -780,7 +788,7 @@ repeat:
pi_do_claimed(pf_current->pi, do_pf_write); pi_do_claimed(pf_current->pi, do_pf_write);
else { else {
pf_busy = 0; pf_busy = 0;
end_request(pf_req, 0); pf_end_request(0);
goto repeat; goto repeat;
} }
} }
...@@ -798,9 +806,11 @@ static int pf_next_buf(void) ...@@ -798,9 +806,11 @@ static int pf_next_buf(void)
if (!pf_count) if (!pf_count)
return 1; return 1;
spin_lock_irqsave(&pf_spin_lock, saved_flags); spin_lock_irqsave(&pf_spin_lock, saved_flags);
end_request(pf_req, 1); pf_end_request(1);
if (pf_req) {
pf_count = pf_req->current_nr_sectors; pf_count = pf_req->current_nr_sectors;
pf_buf = pf_req->buffer; pf_buf = pf_req->buffer;
}
spin_unlock_irqrestore(&pf_spin_lock, saved_flags); spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
return 1; return 1;
} }
...@@ -810,7 +820,7 @@ static inline void next_request(int success) ...@@ -810,7 +820,7 @@ static inline void next_request(int success)
unsigned long saved_flags; unsigned long saved_flags;
spin_lock_irqsave(&pf_spin_lock, saved_flags); spin_lock_irqsave(&pf_spin_lock, saved_flags);
end_request(pf_req, success); pf_end_request(success);
pf_busy = 0; pf_busy = 0;
do_pf_request(pf_queue); do_pf_request(pf_queue);
spin_unlock_irqrestore(&pf_spin_lock, saved_flags); spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
......
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