block: use blk_rq_init() to initialize the request
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 29 Apr 2008 07:54:37 +0000 (09:54 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 29 Apr 2008 12:48:55 +0000 (14:48 +0200)
Any path needs to call it to initialize the request.

This is a preparation for large command support, which needs to
initialize the request in a proper way (that is, just doing a memset()
will not work).

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/block/nbd.c
drivers/block/paride/pd.c
drivers/scsi/scsi_error.c

index 60cc54368b66eaa1c7888ab905f7c9b83c92bd41..f75bda16a1fc3820fb6021cd7cbb23145f90fc94 100644 (file)
@@ -537,6 +537,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
        switch (cmd) {
        case NBD_DISCONNECT:
                printk(KERN_INFO "%s: NBD_DISCONNECT\n", lo->disk->disk_name);
+               blk_rq_init(NULL, &sreq);
                sreq.cmd_type = REQ_TYPE_SPECIAL;
                nbd_cmd(&sreq) = NBD_CMD_DISC;
                /*
index df819f8a95a6d0db78e95153e0194deea4730e88..570f3b70dce795afc8e1beabd104de3dc31e26ad 100644 (file)
@@ -716,10 +716,8 @@ static int pd_special_command(struct pd_unit *disk,
        struct request rq;
        int err = 0;
 
-       memset(&rq, 0, sizeof(rq));
-       rq.errors = 0;
+       blk_rq_init(NULL, &rq);
        rq.rq_disk = disk->gd;
-       rq.ref_count = 1;
        rq.end_io_data = &wait;
        rq.end_io = blk_end_sync_rq;
        blk_insert_request(disk->gd->queue, &rq, 0, func);
index 221f31e36d26e5c4f7bfe88b7abde0b2996c982e..1eaba6cd80f411735b390a984a3f61837e377432 100644 (file)
@@ -1771,6 +1771,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
        unsigned long flags;
        int rtn;
 
+       blk_rq_init(NULL, &req);
        scmd->request = &req;
        memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));