Commit ea6f06f416347448645e60294d92c0c19aba8589
Committed by
Jens Axboe
1 parent
3daeea29f9
Exists in
master
and in
7 other branches
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". Cc: Mike Miller <mike.miller@hp.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Showing 1 changed file with 7 additions and 29 deletions Side-by-side Diff
drivers/block/cpqarray.c
... | ... | @@ -167,7 +167,6 @@ |
167 | 167 | |
168 | 168 | static inline void addQ(cmdlist_t **Qptr, cmdlist_t *c); |
169 | 169 | static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c); |
170 | -static inline void complete_buffers(struct bio *bio, int ok); | |
171 | 170 | static inline void complete_command(cmdlist_t *cmd, int timeout); |
172 | 171 | |
173 | 172 | static irqreturn_t do_ida_intr(int irq, void *dev_id); |
174 | 173 | |
... | ... | @@ -980,26 +979,13 @@ |
980 | 979 | } |
981 | 980 | } |
982 | 981 | |
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 | -} | |
996 | 982 | /* |
997 | 983 | * Mark all buffers that cmd was responsible for |
998 | 984 | */ |
999 | 985 | static inline void complete_command(cmdlist_t *cmd, int timeout) |
1000 | 986 | { |
1001 | 987 | struct request *rq = cmd->rq; |
1002 | - int ok=1; | |
988 | + int error = 0; | |
1003 | 989 | int i, ddir; |
1004 | 990 | |
1005 | 991 | if (cmd->req.hdr.rcode & RCODE_NONFATAL && |
1006 | 992 | |
1007 | 993 | |
... | ... | @@ -1011,16 +997,17 @@ |
1011 | 997 | if (cmd->req.hdr.rcode & RCODE_FATAL) { |
1012 | 998 | printk(KERN_WARNING "Fatal error on ida/c%dd%d\n", |
1013 | 999 | cmd->ctlr, cmd->hdr.unit); |
1014 | - ok = 0; | |
1000 | + error = -EIO; | |
1015 | 1001 | } |
1016 | 1002 | if (cmd->req.hdr.rcode & RCODE_INVREQ) { |
1017 | 1003 | printk(KERN_WARNING "Invalid request on ida/c%dd%d = (cmd=%x sect=%d cnt=%d sg=%d ret=%x)\n", |
1018 | 1004 | cmd->ctlr, cmd->hdr.unit, cmd->req.hdr.cmd, |
1019 | 1005 | cmd->req.hdr.blk, cmd->req.hdr.blk_cnt, |
1020 | 1006 | cmd->req.hdr.sg_cnt, cmd->req.hdr.rcode); |
1021 | - ok = 0; | |
1007 | + error = -EIO; | |
1022 | 1008 | } |
1023 | - if (timeout) ok = 0; | |
1009 | + if (timeout) | |
1010 | + error = -EIO; | |
1024 | 1011 | /* unmap the DMA mapping for all the scatter gather elements */ |
1025 | 1012 | if (cmd->req.hdr.cmd == IDA_READ) |
1026 | 1013 | ddir = PCI_DMA_FROMDEVICE; |
1027 | 1014 | |
... | ... | @@ -1030,18 +1017,9 @@ |
1030 | 1017 | pci_unmap_page(hba[cmd->ctlr]->pci_dev, cmd->req.sg[i].addr, |
1031 | 1018 | cmd->req.sg[i].size, ddir); |
1032 | 1019 | |
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 | - | |
1043 | 1020 | 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(); | |
1045 | 1023 | } |
1046 | 1024 | |
1047 | 1025 | /* |