block: remove the blk_execute_rq return value
authorChristoph Hellwig <hch@lst.de>
Thu, 20 Apr 2017 14:02:55 +0000 (16:02 +0200)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 18:16:10 +0000 (12:16 -0600)
The function only returns -EIO if rq->errors is non-zero, which is not
very useful and lets a large number of callers ignore the return value.

Just let the callers figure out their error themselves.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
16 files changed:
block/blk-exec.c
block/scsi_ioctl.c
drivers/block/virtio_blk.c
drivers/cdrom/cdrom.c
drivers/ide/ide-atapi.c
drivers/ide/ide-cd.c
drivers/ide/ide-cd_ioctl.c
drivers/ide/ide-devsets.c
drivers/ide/ide-disk.c
drivers/ide/ide-ioctls.c
drivers/ide/ide-park.c
drivers/ide/ide-pm.c
drivers/ide/ide-taskfile.c
drivers/scsi/osd/osd_initiator.c
fs/nfsd/blocklayout.c
include/linux/blkdev.h

index 8cd0e9bc8dc89b7bde4e4ab56aa7752677618f72..afa383248c7c5124d3c853e27c182b679f029251 100644 (file)
@@ -92,11 +92,10 @@ EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
  *    Insert a fully prepared request at the back of the I/O scheduler queue
  *    for execution and wait for completion.
  */
-int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk,
+void blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk,
                   struct request *rq, int at_head)
 {
        DECLARE_COMPLETION_ONSTACK(wait);
-       int err = 0;
        unsigned long hang_check;
 
        rq->end_io_data = &wait;
@@ -108,10 +107,5 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk,
                while (!wait_for_completion_io_timeout(&wait, hang_check * (HZ/2)));
        else
                wait_for_completion_io(&wait);
-
-       if (rq->errors)
-               err = -EIO;
-
-       return err;
 }
 EXPORT_SYMBOL(blk_execute_rq);
index 82a43bb199671e4b53f2b607d86fb5d6d8ae669e..b1352143f12f0670dc07cfa80599f9c754d99d73 100644 (file)
@@ -547,7 +547,8 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
        scsi_req(rq)->cmd[0] = cmd;
        scsi_req(rq)->cmd[4] = data;
        scsi_req(rq)->cmd_len = 6;
-       err = blk_execute_rq(q, bd_disk, rq, 0);
+       blk_execute_rq(q, bd_disk, rq, 0);
+       err = rq->errors ? -EIO : 0;
        blk_put_request(rq);
 
        return err;
index 2d82901692714225c5212a530693e5128e041e93..eaf99022bdc693ea35f044aa275f51e7d5401cc8 100644 (file)
@@ -310,7 +310,8 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
        if (err)
                goto out;
 
-       err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
+       blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
+       err = req->errors ? -EIO : 0;
 out:
        blk_put_request(req);
        return err;
index 87739649eac21a6c3688c5c60956280746babd70..308501730ab33e2cf6977d7fbf13d816585be000 100644 (file)
@@ -2218,7 +2218,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
                rq->timeout = 60 * HZ;
                bio = rq->bio;
 
-               if (blk_execute_rq(q, cdi->disk, rq, 0)) {
+               blk_execute_rq(q, cdi->disk, rq, 0);
+               if (rq->errors) {
                        struct request_sense *s = req->sense;
                        ret = -EIO;
                        cdi->last_sense = s->sense_key;
index feb30061123bc07c14b7d1ae0b5b7ce19d533790..1524797e1776db4eb54b7922fb0e858bfc705856 100644 (file)
@@ -107,7 +107,8 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
        memcpy(scsi_req(rq)->cmd, pc->c, 12);
        if (drive->media == ide_tape)
                scsi_req(rq)->cmd[13] = REQ_IDETAPE_PC1;
-       error = blk_execute_rq(drive->queue, disk, rq, 0);
+       blk_execute_rq(drive->queue, disk, rq, 0);
+       error = rq->errors ? -EIO : 0;
 put_req:
        blk_put_request(rq);
        return error;
index 74f1b7dc03f73c444ec2a6d4728304134d88c92a..95c40afa9120dcb7771db06827ec4c9dc5562800 100644 (file)
@@ -452,7 +452,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
                        }
                }
 
-               error = blk_execute_rq(drive->queue, info->disk, rq, 0);
+               blk_execute_rq(drive->queue, info->disk, rq, 0);
+               error = rq->errors ? -EIO : 0;
 
                if (buffer)
                        *bufflen = scsi_req(rq)->resid_len;
index 9fcefbc8425e748cf27b4967f2a16fcc67605965..f1ab726bd430cde4ded143314ea5b075414c4157 100644 (file)
@@ -307,7 +307,8 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
        scsi_req_init(rq);
        ide_req(rq)->type = ATA_PRIV_MISC;
        rq->rq_flags = RQF_QUIET;
-       ret = blk_execute_rq(drive->queue, cd->disk, rq, 0);
+       blk_execute_rq(drive->queue, cd->disk, rq, 0);
+       ret = rq->errors ? -EIO : 0;
        blk_put_request(rq);
        /*
         * A reset will unlock the door. If it was previously locked,
index a45dda5386e4403206ee73a18b8bb8b16b012e65..eea6a7cb80b5c5eda324d94df4c4c61040ff5432 100644 (file)
@@ -173,8 +173,8 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
        *(int *)&scsi_req(rq)->cmd[1] = arg;
        rq->special = setting->set;
 
-       if (blk_execute_rq(q, NULL, rq, 0))
-               ret = rq->errors;
+       blk_execute_rq(q, NULL, rq, 0);
+       ret = rq->errors;
        blk_put_request(rq);
 
        return ret;
index 186159715b71c6fd7a01eb11bc92239487c4dc7e..7c06237f3479521e083b76469392c8a489ff2dcc 100644 (file)
@@ -470,7 +470,6 @@ ide_devset_get(multcount, mult_count);
 static int set_multcount(ide_drive_t *drive, int arg)
 {
        struct request *rq;
-       int error;
 
        if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff))
                return -EINVAL;
@@ -484,7 +483,7 @@ static int set_multcount(ide_drive_t *drive, int arg)
 
        drive->mult_req = arg;
        drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
-       error = blk_execute_rq(drive->queue, NULL, rq, 0);
+       blk_execute_rq(drive->queue, NULL, rq, 0);
        blk_put_request(rq);
 
        return (drive->mult_count == arg) ? 0 : -EIO;
index 248a3e0ceb468bdb57e896425a642375e77355be..3e96e531b367b9e360bb03ed5647fdf6bf192a34 100644 (file)
@@ -128,7 +128,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
                rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
                scsi_req_init(rq);
                ide_req(rq)->type = ATA_PRIV_TASKFILE;
-               err = blk_execute_rq(drive->queue, NULL, rq, 0);
+               blk_execute_rq(drive->queue, NULL, rq, 0);
+               err = rq->errors ? -EIO : 0;
                blk_put_request(rq);
 
                return err;
@@ -227,8 +228,8 @@ static int generic_drive_reset(ide_drive_t *drive)
        ide_req(rq)->type = ATA_PRIV_MISC;
        scsi_req(rq)->cmd_len = 1;
        scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET;
-       if (blk_execute_rq(drive->queue, NULL, rq, 1))
-               ret = rq->errors;
+       blk_execute_rq(drive->queue, NULL, rq, 1);
+       ret = rq->errors;
        blk_put_request(rq);
        return ret;
 }
index 101aed9a61ca319439d825c6e433a53175e0ed64..b4f577016f5a28daf1b1f98beabaf2b26ab1a6b1 100644 (file)
@@ -37,7 +37,8 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
        scsi_req(rq)->cmd_len = 1;
        ide_req(rq)->type = ATA_PRIV_MISC;
        rq->special = &timeout;
-       rc = blk_execute_rq(q, NULL, rq, 1);
+       blk_execute_rq(q, NULL, rq, 1);
+       rc = rq->errors ? -EIO : 0;
        blk_put_request(rq);
        if (rc)
                goto out;
index ec951be4b0c8ab0950ca31dbeb070520c925230e..bf513f886f3c73bdee3235ff4658a91193a58d9a 100644 (file)
@@ -27,7 +27,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
                mesg.event = PM_EVENT_FREEZE;
        rqpm.pm_state = mesg.event;
 
-       ret = blk_execute_rq(drive->queue, NULL, rq, 0);
+       blk_execute_rq(drive->queue, NULL, rq, 0);
+       ret = rq->errors ? -EIO : 0;
        blk_put_request(rq);
 
        if (ret == 0 && ide_port_acpi(hwif)) {
index 4c0007cb74e378d7088a33261ecd0afd8cacb4ea..78924c7c94787b0de0e08d724471170b52d6f5bd 100644 (file)
@@ -452,8 +452,8 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
        rq->special = cmd;
        cmd->rq = rq;
 
-       error = blk_execute_rq(drive->queue, NULL, rq, 0);
-
+       blk_execute_rq(drive->queue, NULL, rq, 0);
+       error = rq->errors ? -EIO : 0;
 put_req:
        blk_put_request(rq);
        return error;
index 9d0727b2bdec7cab822de20f3c383257af10c9a7..5eeab7047d1e7424e29566922bf88dd06c0070ce 100644 (file)
@@ -489,7 +489,10 @@ static void _set_error_resid(struct osd_request *or, struct request *req,
 
 int osd_execute_request(struct osd_request *or)
 {
-       int error = blk_execute_rq(or->request->q, NULL, or->request, 0);
+       int error;
+
+       blk_execute_rq(or->request->q, NULL, or->request, 0);
+       error = or->request->errors ? -EIO : 0;
 
        _set_error_resid(or, or->request, error);
        return error;
index 92b4b41d19d2a2e23b469ce993e3a9f159f5f578..9f618b77ffee3d59b4b63d83d57472da1a65e6fe 100644 (file)
@@ -242,10 +242,11 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
        req->cmd[4] = bufflen & 0xff;
        req->cmd_len = COMMAND_SIZE(INQUIRY);
 
-       error = blk_execute_rq(rq->q, NULL, rq, 1);
-       if (error) {
+       blk_execute_rq(rq->q, NULL, rq, 1);
+       if (rq->errors) {
                pr_err("pNFS: INQUIRY 0x83 failed with: %x\n",
                        rq->errors);
+               error = -EIO;
                goto out_put_request;
        }
 
index 51c9e391798e68422649f95fc21b4bbf4645a35d..e2064ed3c7038f7b4270d9db96b64ef234b7d6ab 100644 (file)
@@ -970,7 +970,7 @@ extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, uns
 extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
                               struct rq_map_data *, const struct iov_iter *,
                               gfp_t);
-extern int blk_execute_rq(struct request_queue *, struct gendisk *,
+extern void blk_execute_rq(struct request_queue *, struct gendisk *,
                          struct request *, int);
 extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
                                  struct request *, int, rq_end_io_fn *);