Commit b7819b92 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove the blk_execute_rq return value

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarBart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 75a500ef
...@@ -92,11 +92,10 @@ EXPORT_SYMBOL_GPL(blk_execute_rq_nowait); ...@@ -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 * Insert a fully prepared request at the back of the I/O scheduler queue
* for execution and wait for completion. * 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) struct request *rq, int at_head)
{ {
DECLARE_COMPLETION_ONSTACK(wait); DECLARE_COMPLETION_ONSTACK(wait);
int err = 0;
unsigned long hang_check; unsigned long hang_check;
rq->end_io_data = &wait; rq->end_io_data = &wait;
...@@ -108,10 +107,5 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, ...@@ -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))); while (!wait_for_completion_io_timeout(&wait, hang_check * (HZ/2)));
else else
wait_for_completion_io(&wait); wait_for_completion_io(&wait);
if (rq->errors)
err = -EIO;
return err;
} }
EXPORT_SYMBOL(blk_execute_rq); EXPORT_SYMBOL(blk_execute_rq);
...@@ -547,7 +547,8 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, ...@@ -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[0] = cmd;
scsi_req(rq)->cmd[4] = data; scsi_req(rq)->cmd[4] = data;
scsi_req(rq)->cmd_len = 6; 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); blk_put_request(rq);
return err; return err;
......
...@@ -310,7 +310,8 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) ...@@ -310,7 +310,8 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str)
if (err) if (err)
goto out; 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: out:
blk_put_request(req); blk_put_request(req);
return err; return err;
......
...@@ -2218,7 +2218,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, ...@@ -2218,7 +2218,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
rq->timeout = 60 * HZ; rq->timeout = 60 * HZ;
bio = rq->bio; 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; struct request_sense *s = req->sense;
ret = -EIO; ret = -EIO;
cdi->last_sense = s->sense_key; cdi->last_sense = s->sense_key;
......
...@@ -107,7 +107,8 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, ...@@ -107,7 +107,8 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
memcpy(scsi_req(rq)->cmd, pc->c, 12); memcpy(scsi_req(rq)->cmd, pc->c, 12);
if (drive->media == ide_tape) if (drive->media == ide_tape)
scsi_req(rq)->cmd[13] = REQ_IDETAPE_PC1; 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: put_req:
blk_put_request(rq); blk_put_request(rq);
return error; return error;
......
...@@ -452,7 +452,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, ...@@ -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) if (buffer)
*bufflen = scsi_req(rq)->resid_len; *bufflen = scsi_req(rq)->resid_len;
......
...@@ -307,7 +307,8 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) ...@@ -307,7 +307,8 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
scsi_req_init(rq); scsi_req_init(rq);
ide_req(rq)->type = ATA_PRIV_MISC; ide_req(rq)->type = ATA_PRIV_MISC;
rq->rq_flags = RQF_QUIET; 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); blk_put_request(rq);
/* /*
* A reset will unlock the door. If it was previously locked, * A reset will unlock the door. If it was previously locked,
......
...@@ -173,7 +173,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, ...@@ -173,7 +173,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
*(int *)&scsi_req(rq)->cmd[1] = arg; *(int *)&scsi_req(rq)->cmd[1] = arg;
rq->special = setting->set; rq->special = setting->set;
if (blk_execute_rq(q, NULL, rq, 0)) blk_execute_rq(q, NULL, rq, 0);
ret = rq->errors; ret = rq->errors;
blk_put_request(rq); blk_put_request(rq);
......
...@@ -470,7 +470,6 @@ ide_devset_get(multcount, mult_count); ...@@ -470,7 +470,6 @@ ide_devset_get(multcount, mult_count);
static int set_multcount(ide_drive_t *drive, int arg) static int set_multcount(ide_drive_t *drive, int arg)
{ {
struct request *rq; struct request *rq;
int error;
if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff)) if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff))
return -EINVAL; return -EINVAL;
...@@ -484,7 +483,7 @@ static int set_multcount(ide_drive_t *drive, int arg) ...@@ -484,7 +483,7 @@ static int set_multcount(ide_drive_t *drive, int arg)
drive->mult_req = arg; drive->mult_req = arg;
drive->special_flags |= IDE_SFLAG_SET_MULTMODE; 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); blk_put_request(rq);
return (drive->mult_count == arg) ? 0 : -EIO; return (drive->mult_count == arg) ? 0 : -EIO;
......
...@@ -128,7 +128,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -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); rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
scsi_req_init(rq); scsi_req_init(rq);
ide_req(rq)->type = ATA_PRIV_TASKFILE; 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); blk_put_request(rq);
return err; return err;
...@@ -227,7 +228,7 @@ static int generic_drive_reset(ide_drive_t *drive) ...@@ -227,7 +228,7 @@ static int generic_drive_reset(ide_drive_t *drive)
ide_req(rq)->type = ATA_PRIV_MISC; ide_req(rq)->type = ATA_PRIV_MISC;
scsi_req(rq)->cmd_len = 1; scsi_req(rq)->cmd_len = 1;
scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET;
if (blk_execute_rq(drive->queue, NULL, rq, 1)) blk_execute_rq(drive->queue, NULL, rq, 1);
ret = rq->errors; ret = rq->errors;
blk_put_request(rq); blk_put_request(rq);
return ret; return ret;
......
...@@ -37,7 +37,8 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) ...@@ -37,7 +37,8 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
scsi_req(rq)->cmd_len = 1; scsi_req(rq)->cmd_len = 1;
ide_req(rq)->type = ATA_PRIV_MISC; ide_req(rq)->type = ATA_PRIV_MISC;
rq->special = &timeout; 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); blk_put_request(rq);
if (rc) if (rc)
goto out; goto out;
......
...@@ -27,7 +27,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) ...@@ -27,7 +27,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
mesg.event = PM_EVENT_FREEZE; mesg.event = PM_EVENT_FREEZE;
rqpm.pm_state = mesg.event; 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); blk_put_request(rq);
if (ret == 0 && ide_port_acpi(hwif)) { if (ret == 0 && ide_port_acpi(hwif)) {
......
...@@ -452,8 +452,8 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, ...@@ -452,8 +452,8 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
rq->special = cmd; rq->special = cmd;
cmd->rq = rq; 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: put_req:
blk_put_request(rq); blk_put_request(rq);
return error; return error;
......
...@@ -489,7 +489,10 @@ static void _set_error_resid(struct osd_request *or, struct request *req, ...@@ -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 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); _set_error_resid(or, or->request, error);
return error; return error;
......
...@@ -242,10 +242,11 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev, ...@@ -242,10 +242,11 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
req->cmd[4] = bufflen & 0xff; req->cmd[4] = bufflen & 0xff;
req->cmd_len = COMMAND_SIZE(INQUIRY); req->cmd_len = COMMAND_SIZE(INQUIRY);
error = blk_execute_rq(rq->q, NULL, rq, 1); blk_execute_rq(rq->q, NULL, rq, 1);
if (error) { if (rq->errors) {
pr_err("pNFS: INQUIRY 0x83 failed with: %x\n", pr_err("pNFS: INQUIRY 0x83 failed with: %x\n",
rq->errors); rq->errors);
error = -EIO;
goto out_put_request; goto out_put_request;
} }
......
...@@ -970,7 +970,7 @@ extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, uns ...@@ -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 *, extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
struct rq_map_data *, const struct iov_iter *, struct rq_map_data *, const struct iov_iter *,
gfp_t); 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); struct request *, int);
extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
struct request *, int, rq_end_io_fn *); struct request *, int, rq_end_io_fn *);
......
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