mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
block: split scsi_request out of struct request
And require all drivers that want to support BLOCK_PC to allocate it as the first thing of their private data. To support this the legacy IDE and BSG code is switched to set cmd_size on their queues to let the block layer allocate the additional space. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
8ae94eb65b
commit
82ed4db499
49 changed files with 458 additions and 410 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <linux/timer.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <scsi/scsi_device.h>
|
||||
#include <scsi/scsi_request.h>
|
||||
|
||||
struct Scsi_Host;
|
||||
struct scsi_driver;
|
||||
|
|
@ -57,6 +58,7 @@ struct scsi_pointer {
|
|||
#define SCMD_TAGGED (1 << 0)
|
||||
|
||||
struct scsi_cmnd {
|
||||
struct scsi_request req;
|
||||
struct scsi_device *device;
|
||||
struct list_head list; /* scsi_cmnd participates in queue lists */
|
||||
struct list_head eh_entry; /* entry for the host eh_cmd_q */
|
||||
|
|
|
|||
30
include/scsi/scsi_request.h
Normal file
30
include/scsi/scsi_request.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef _SCSI_SCSI_REQUEST_H
|
||||
#define _SCSI_SCSI_REQUEST_H
|
||||
|
||||
#include <linux/blk-mq.h>
|
||||
|
||||
#define BLK_MAX_CDB 16
|
||||
|
||||
struct scsi_request {
|
||||
unsigned char __cmd[BLK_MAX_CDB];
|
||||
unsigned char *cmd;
|
||||
unsigned short cmd_len;
|
||||
unsigned int sense_len;
|
||||
unsigned int resid_len; /* residual count */
|
||||
void *sense;
|
||||
};
|
||||
|
||||
static inline struct scsi_request *scsi_req(struct request *rq)
|
||||
{
|
||||
return blk_mq_rq_to_pdu(rq);
|
||||
}
|
||||
|
||||
static inline void scsi_req_free_cmd(struct scsi_request *req)
|
||||
{
|
||||
if (req->cmd != req->__cmd)
|
||||
kfree(req->cmd);
|
||||
}
|
||||
|
||||
void scsi_req_init(struct request *);
|
||||
|
||||
#endif /* _SCSI_SCSI_REQUEST_H */
|
||||
Loading…
Reference in a new issue