History

blk_end_request: changing cpqarray (take 4)

This patch converts cpqarray to use blk_end_request interfaces. Related 'ok' arguments are converted to 'error'. cpqarray is a little bit different from "normal" drivers. cpqarray directly calls bio_endio() and disk_stat_add() when completing request. But those can be replaced with __end_that_request_first(). After the replacement, request completion procedures of those drivers become like the following: o end_that_request_first() o add_disk_randomness() o end_that_request_last() This can be converted to __blk_end_request() by following the rule (b) mentioned in the patch subject "[PATCH 01/30] blk_end_request: add new request completion interface".

Kiyoshi Ueda committed 18 years ago

Commit ea6f06f1 parent 3daeea21 file · +7 −29Browse files

Unified · Split

drivers/block/cpqarray.c+7−29
@@ -167,7 +167,6 @@ static void start_io(ctlr_info_t *h); · 166 unmodified lines
167167
168168 static inline void addQ(cmdlist_t **Qptr, cmdlist_t *c);
169169 static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c);
170−static inline void complete_buffers(struct bio *bio, int ok);
171170 static inline void complete_command(cmdlist_t *cmd, int timeout);
172171
173172 static irqreturn_t do_ida_intr(int irq, void *dev_id);
@@ -980,26 +979,13 @@ static void start_io(ctlr_info_t *h) · 806 unmodified lines
980979 }
981980 }
982981
983−static inline void complete_buffers(struct bio *bio, int ok)
984−{
985− struct bio *xbh;
986−
987− while (bio) {
988− xbh = bio->bi_next;
989− bio->bi_next = NULL;
990−
991− bio_endio(bio, ok ? 0 : -EIO);
992−
993− bio = xbh;
994− }
995−}
996982 /*
997983 * Mark all buffers that cmd was responsible for
998984 */
999985 static inline void complete_command(cmdlist_t *cmd, int timeout)
1000986 {
1001987 struct request *rq = cmd->rq;
1002− int ok=1;
988+ int error = 0;
1003989 int i, ddir;
1004990
1005991 if (cmd->req.hdr.rcode & RCODE_NONFATAL &&
@@ -1011,16 +997,17 @@ static inline void complete_command(cmdlist_t *cmd, int timeout) · 5 unmodified lines
1011997 if (cmd->req.hdr.rcode & RCODE_FATAL) {
1012998 printk(KERN_WARNING "Fatal error on ida/c%dd%d\n",
1013999 cmd->ctlr, cmd->hdr.unit);
1014− ok = 0;
1000+ error = -EIO;
10151001 }
10161002 if (cmd->req.hdr.rcode & RCODE_INVREQ) {
10171003 printk(KERN_WARNING "Invalid request on ida/c%dd%d = (cmd=%x sect=%d cnt=%d sg=%d ret=%x)\n",
10181004 cmd->ctlr, cmd->hdr.unit, cmd->req.hdr.cmd,
10191005 cmd->req.hdr.blk, cmd->req.hdr.blk_cnt,
10201006 cmd->req.hdr.sg_cnt, cmd->req.hdr.rcode);
1021− ok = 0;
1007+ error = -EIO;
10221008 }
1023− if (timeout) ok = 0;
1009+ if (timeout)
1010+ error = -EIO;
10241011 /* unmap the DMA mapping for all the scatter gather elements */
10251012 if (cmd->req.hdr.cmd == IDA_READ)
10261013 ddir = PCI_DMA_FROMDEVICE;
@@ -1030,18 +1017,9 @@ static inline void complete_command(cmdlist_t *cmd, int timeout) · 3 unmodified lines
10301017 pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr,
10311018 cmd->req.sg[i].size, ddir);
10321019
1033− complete_buffers(rq->bio, ok);
1034−
1035− if (blk_fs_request(rq)) {
1036− const int rw = rq_data_dir(rq);
1037−
1038− disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
1039− }
1040−
1041− add_disk_randomness(rq->rq_disk);
1042−
10431020 DBGPX(printk("Done with %p\n", rq););
1044− end_that_request_last(rq, ok ? 1 : -EIO);
1021+ if (__blk_end_request(rq, error, blk_rq_bytes(rq)))
1022+ BUG();
10451023 }
10461024
10471025 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t