diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-04-29 03:54:36 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-04-29 08:48:55 -0400 |
commit | 992b5bceee447a32ef2d617730ae0d03c063eedd (patch) | |
tree | cf8a457afc939b9d6040b809382e8a45adc9eee1 | |
parent | 4917fa292558593d36b2880977ea206f7727dbe5 (diff) |
block: no need to initialize rq->cmd with blk_get_request
blk_get_request initializes rq->cmd (rq_init does) so the users don't
need to do that.
The purpose of this patch is to remove sizeof(rq->cmd) and &rq->cmd,
as a preparation for large command support, which changes rq->cmd from
the static array to a pointer. sizeof(rq->cmd) will not make sense and
&rq->cmd won't work.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/scsi_ioctl.c | 3 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 2 | ||||
-rw-r--r-- | drivers/cdrom/cdrom.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-emc.c | 2 | ||||
-rw-r--r-- | drivers/md/dm-mpath-hp-sw.c | 1 | ||||
-rw-r--r-- | drivers/md/dm-mpath-rdac.c | 1 |
6 files changed, 0 insertions, 10 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index a2c3a936ebf9..ffa3720e6ca0 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -217,8 +217,6 @@ EXPORT_SYMBOL_GPL(blk_verify_command); | |||
217 | static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, | 217 | static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, |
218 | struct sg_io_hdr *hdr, int has_write_perm) | 218 | struct sg_io_hdr *hdr, int has_write_perm) |
219 | { | 219 | { |
220 | memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */ | ||
221 | |||
222 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) | 220 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) |
223 | return -EFAULT; | 221 | return -EFAULT; |
224 | if (blk_verify_command(rq->cmd, has_write_perm)) | 222 | if (blk_verify_command(rq->cmd, has_write_perm)) |
@@ -531,7 +529,6 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, | |||
531 | rq->data_len = 0; | 529 | rq->data_len = 0; |
532 | rq->extra_len = 0; | 530 | rq->extra_len = 0; |
533 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; | 531 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; |
534 | memset(rq->cmd, 0, sizeof(rq->cmd)); | ||
535 | rq->cmd[0] = cmd; | 532 | rq->cmd[0] = cmd; |
536 | rq->cmd[4] = data; | 533 | rq->cmd[4] = data; |
537 | rq->cmd_len = 6; | 534 | rq->cmd_len = 6; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 18feb1c7c33b..3b806c9fb005 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -776,8 +776,6 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * | |||
776 | 776 | ||
777 | rq->cmd_len = COMMAND_SIZE(cgc->cmd[0]); | 777 | rq->cmd_len = COMMAND_SIZE(cgc->cmd[0]); |
778 | memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); | 778 | memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); |
779 | if (sizeof(rq->cmd) > CDROM_PACKET_SIZE) | ||
780 | memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE); | ||
781 | 779 | ||
782 | rq->timeout = 60*HZ; | 780 | rq->timeout = 60*HZ; |
783 | rq->cmd_type = REQ_TYPE_BLOCK_PC; | 781 | rq->cmd_type = REQ_TYPE_BLOCK_PC; |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index ac3829030ac5..69f26eb6415b 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2194,7 +2194,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2194 | if (ret) | 2194 | if (ret) |
2195 | break; | 2195 | break; |
2196 | 2196 | ||
2197 | memset(rq->cmd, 0, sizeof(rq->cmd)); | ||
2198 | rq->cmd[0] = GPCMD_READ_CD; | 2197 | rq->cmd[0] = GPCMD_READ_CD; |
2199 | rq->cmd[1] = 1 << 2; | 2198 | rq->cmd[1] = 1 << 2; |
2200 | rq->cmd[2] = (lba >> 24) & 0xff; | 2199 | rq->cmd[2] = (lba >> 24) & 0xff; |
diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c index 6b91b9ab1d41..3ea5ad4b7805 100644 --- a/drivers/md/dm-emc.c +++ b/drivers/md/dm-emc.c | |||
@@ -110,8 +110,6 @@ static struct request *get_failover_req(struct emc_handler *h, | |||
110 | memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); | 110 | memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); |
111 | rq->sense_len = 0; | 111 | rq->sense_len = 0; |
112 | 112 | ||
113 | memset(&rq->cmd, 0, BLK_MAX_CDB); | ||
114 | |||
115 | rq->timeout = EMC_FAILOVER_TIMEOUT; | 113 | rq->timeout = EMC_FAILOVER_TIMEOUT; |
116 | rq->cmd_type = REQ_TYPE_BLOCK_PC; | 114 | rq->cmd_type = REQ_TYPE_BLOCK_PC; |
117 | rq->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE; | 115 | rq->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE; |
diff --git a/drivers/md/dm-mpath-hp-sw.c b/drivers/md/dm-mpath-hp-sw.c index 204bf42c9449..b63a0ab37c53 100644 --- a/drivers/md/dm-mpath-hp-sw.c +++ b/drivers/md/dm-mpath-hp-sw.c | |||
@@ -137,7 +137,6 @@ static struct request *hp_sw_get_request(struct dm_path *path) | |||
137 | req->sense = h->sense; | 137 | req->sense = h->sense; |
138 | memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); | 138 | memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); |
139 | 139 | ||
140 | memset(&req->cmd, 0, BLK_MAX_CDB); | ||
141 | req->cmd[0] = START_STOP; | 140 | req->cmd[0] = START_STOP; |
142 | req->cmd[4] = 1; | 141 | req->cmd[4] = 1; |
143 | req->cmd_len = COMMAND_SIZE(req->cmd[0]); | 142 | req->cmd_len = COMMAND_SIZE(req->cmd[0]); |
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c index e04eb5c697fb..95e77734880a 100644 --- a/drivers/md/dm-mpath-rdac.c +++ b/drivers/md/dm-mpath-rdac.c | |||
@@ -284,7 +284,6 @@ static struct request *get_rdac_req(struct rdac_handler *h, | |||
284 | return NULL; | 284 | return NULL; |
285 | } | 285 | } |
286 | 286 | ||
287 | memset(&rq->cmd, 0, BLK_MAX_CDB); | ||
288 | rq->sense = h->sense; | 287 | rq->sense = h->sense; |
289 | memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); | 288 | memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); |
290 | rq->sense_len = 0; | 289 | rq->sense_len = 0; |