hd: clean up request completion paths
hd read/write_intr() functions manually manipulate request to incrementally complete it, which block layer already supports. Simply use block layer completion routines instead of manual partial completion. While at it, clear unnecessary elv_next_request() check at the tail of read_intr(). This also makes read and write_intr() more consistent. [ Impact: cleanup ] Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
f81f2f7c9f
commit
e091eb67af
|
@ -452,32 +452,25 @@ static void read_intr(void)
|
||||||
bad_rw_intr();
|
bad_rw_intr();
|
||||||
hd_request();
|
hd_request();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ok_to_read:
|
ok_to_read:
|
||||||
req = CURRENT;
|
req = CURRENT;
|
||||||
insw(HD_DATA, req->buffer, 256);
|
insw(HD_DATA, req->buffer, 256);
|
||||||
req->sector++;
|
|
||||||
req->buffer += 512;
|
|
||||||
req->errors = 0;
|
|
||||||
i = --req->nr_sectors;
|
|
||||||
--req->current_nr_sectors;
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n",
|
printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n",
|
||||||
req->rq_disk->disk_name, req->sector, req->nr_sectors,
|
req->rq_disk->disk_name, req->sector + 1, req->nr_sectors - 1,
|
||||||
req->buffer+512);
|
req->buffer+512);
|
||||||
#endif
|
#endif
|
||||||
if (req->current_nr_sectors <= 0)
|
if (__blk_end_request(req, 0, 512)) {
|
||||||
__blk_end_request_cur(req, 0);
|
|
||||||
if (i > 0) {
|
|
||||||
SET_HANDLER(&read_intr);
|
SET_HANDLER(&read_intr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) inb_p(HD_STATUS);
|
(void) inb_p(HD_STATUS);
|
||||||
#if (HD_DELAY > 0)
|
#if (HD_DELAY > 0)
|
||||||
last_req = read_timer();
|
last_req = read_timer();
|
||||||
#endif
|
#endif
|
||||||
if (elv_next_request(QUEUE))
|
hd_request();
|
||||||
hd_request();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_intr(void)
|
static void write_intr(void)
|
||||||
|
@ -499,23 +492,18 @@ static void write_intr(void)
|
||||||
bad_rw_intr();
|
bad_rw_intr();
|
||||||
hd_request();
|
hd_request();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ok_to_write:
|
ok_to_write:
|
||||||
req->sector++;
|
if (__blk_end_request(req, 0, 512)) {
|
||||||
i = --req->nr_sectors;
|
|
||||||
--req->current_nr_sectors;
|
|
||||||
req->buffer += 512;
|
|
||||||
if (!i || (req->bio && req->current_nr_sectors <= 0))
|
|
||||||
__blk_end_request_cur(req, 0);
|
|
||||||
if (i > 0) {
|
|
||||||
SET_HANDLER(&write_intr);
|
SET_HANDLER(&write_intr);
|
||||||
outsw(HD_DATA, req->buffer, 256);
|
outsw(HD_DATA, req->buffer, 256);
|
||||||
} else {
|
return;
|
||||||
#if (HD_DELAY > 0)
|
|
||||||
last_req = read_timer();
|
|
||||||
#endif
|
|
||||||
hd_request();
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
#if (HD_DELAY > 0)
|
||||||
|
last_req = read_timer();
|
||||||
|
#endif
|
||||||
|
hd_request();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void recal_intr(void)
|
static void recal_intr(void)
|
||||||
|
|
Loading…
Reference in New Issue