Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: no need to initialize rq->cmd in prepare_flush_fn hook

The block layer initializes rq->cmd (queue_flush calls rq_init) so
prepare_flush_fn hooks don't need to do that.

The purpose of this patch is to remove sizeof(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.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by

FUJITA Tomonori and committed by
Jens Axboe
4917fa29 6f6a036e

-2
-1
drivers/block/ps3disk.c
··· 405 405 406 406 dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); 407 407 408 - memset(req->cmd, 0, sizeof(req->cmd)); 409 408 req->cmd_type = REQ_TYPE_FLUSH; 410 409 } 411 410
-1
drivers/scsi/sd.c
··· 860 860 861 861 static void sd_prepare_flush(struct request_queue *q, struct request *rq) 862 862 { 863 - memset(rq->cmd, 0, sizeof(rq->cmd)); 864 863 rq->cmd_type = REQ_TYPE_BLOCK_PC; 865 864 rq->timeout = SD_TIMEOUT; 866 865 rq->cmd[0] = SYNCHRONIZE_CACHE;