diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-18 14:53:51 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-18 14:53:51 -0400 |
| commit | d3dc366bbaf07c125561e90d6da4bb147741101a (patch) | |
| tree | 6eb7e79a8ec9df1fa705393c6d15ccea3d104661 /include/scsi | |
| parent | 511c41d9e6665a07aca94eb00983cf6d77dd87ff (diff) | |
| parent | e19a8a0ad2d255316830ead05b59c5a704434cbb (diff) | |
Merge branch 'for-3.18/core' of git://git.kernel.dk/linux-block
Pull core block layer changes from Jens Axboe:
"This is the core block IO pull request for 3.18. Apart from the new
and improved flush machinery for blk-mq, this is all mostly bug fixes
and cleanups.
- blk-mq timeout updates and fixes from Christoph.
- Removal of REQ_END, also from Christoph. We pass it through the
->queue_rq() hook for blk-mq instead, freeing up one of the request
bits. The space was overly tight on 32-bit, so Martin also killed
REQ_KERNEL since it's no longer used.
- blk integrity updates and fixes from Martin and Gu Zheng.
- Update to the flush machinery for blk-mq from Ming Lei. Now we
have a per hardware context flush request, which both cleans up the
code should scale better for flush intensive workloads on blk-mq.
- Improve the error printing, from Rob Elliott.
- Backing device improvements and cleanups from Tejun.
- Fixup of a misplaced rq_complete() tracepoint from Hannes.
- Make blk_get_request() return error pointers, fixing up issues
where we NULL deref when a device goes bad or missing. From Joe
Lawrence.
- Prep work for drastically reducing the memory consumption of dm
devices from Junichi Nomura. This allows creating clone bio sets
without preallocating a lot of memory.
- Fix a blk-mq hang on certain combinations of queue depths and
hardware queues from me.
- Limit memory consumption for blk-mq devices for crash dump
scenarios and drivers that use crazy high depths (certain SCSI
shared tag setups). We now just use a single queue and limited
depth for that"
* 'for-3.18/core' of git://git.kernel.dk/linux-block: (58 commits)
block: Remove REQ_KERNEL
blk-mq: allocate cpumask on the home node
bio-integrity: remove the needless fail handle of bip_slab creating
block: include func name in __get_request prints
block: make blk_update_request print prefix match ratelimited prefix
blk-merge: don't compute bi_phys_segments from bi_vcnt for cloned bio
block: fix alignment_offset math that assumes io_min is a power-of-2
blk-mq: Make bt_clear_tag() easier to read
blk-mq: fix potential hang if rolling wakeup depth is too high
block: add bioset_create_nobvec()
block: use bio_clone_fast() in blk_rq_prep_clone()
block: misplaced rq_complete tracepoint
sd: Honor block layer integrity handling flags
block: Replace strnicmp with strncasecmp
block: Add T10 Protection Information functions
block: Don't merge requests if integrity flags differ
block: Integrity checksum flag
block: Relocate bio integrity flags
block: Add a disk flag to block integrity profile
block: Add prefix to block integrity profile flags
...
Diffstat (limited to 'include/scsi')
| -rw-r--r-- | include/scsi/scsi_cmnd.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 73f349044941..522a5f27f553 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
| @@ -10,9 +10,10 @@ | |||
| 10 | #include <scsi/scsi_device.h> | 10 | #include <scsi/scsi_device.h> |
| 11 | 11 | ||
| 12 | struct Scsi_Host; | 12 | struct Scsi_Host; |
| 13 | struct scsi_device; | ||
| 14 | struct scsi_driver; | 13 | struct scsi_driver; |
| 15 | 14 | ||
| 15 | #include <scsi/scsi_device.h> | ||
| 16 | |||
| 16 | /* | 17 | /* |
| 17 | * MAX_COMMAND_SIZE is: | 18 | * MAX_COMMAND_SIZE is: |
| 18 | * The longest fixed-length SCSI CDB as per the SCSI standard. | 19 | * The longest fixed-length SCSI CDB as per the SCSI standard. |
| @@ -81,6 +82,7 @@ struct scsi_cmnd { | |||
| 81 | 82 | ||
| 82 | unsigned char prot_op; | 83 | unsigned char prot_op; |
| 83 | unsigned char prot_type; | 84 | unsigned char prot_type; |
| 85 | unsigned char prot_flags; | ||
| 84 | 86 | ||
| 85 | unsigned short cmd_len; | 87 | unsigned short cmd_len; |
| 86 | enum dma_data_direction sc_data_direction; | 88 | enum dma_data_direction sc_data_direction; |
| @@ -252,6 +254,14 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd) | |||
| 252 | return scmd->prot_op; | 254 | return scmd->prot_op; |
| 253 | } | 255 | } |
| 254 | 256 | ||
| 257 | enum scsi_prot_flags { | ||
| 258 | SCSI_PROT_TRANSFER_PI = 1 << 0, | ||
| 259 | SCSI_PROT_GUARD_CHECK = 1 << 1, | ||
| 260 | SCSI_PROT_REF_CHECK = 1 << 2, | ||
| 261 | SCSI_PROT_REF_INCREMENT = 1 << 3, | ||
| 262 | SCSI_PROT_IP_CHECKSUM = 1 << 4, | ||
| 263 | }; | ||
| 264 | |||
| 255 | /* | 265 | /* |
| 256 | * The controller usually does not know anything about the target it | 266 | * The controller usually does not know anything about the target it |
| 257 | * is communicating with. However, when DIX is enabled the controller | 267 | * is communicating with. However, when DIX is enabled the controller |
| @@ -280,6 +290,17 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd) | |||
| 280 | return blk_rq_pos(scmd->request); | 290 | return blk_rq_pos(scmd->request); |
| 281 | } | 291 | } |
| 282 | 292 | ||
| 293 | static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd) | ||
| 294 | { | ||
| 295 | return scmd->device->sector_size; | ||
| 296 | } | ||
| 297 | |||
| 298 | static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd) | ||
| 299 | { | ||
| 300 | return blk_rq_pos(scmd->request) >> | ||
| 301 | (ilog2(scsi_prot_interval(scmd)) - 9) & 0xffffffff; | ||
| 302 | } | ||
| 303 | |||
| 283 | static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) | 304 | static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) |
| 284 | { | 305 | { |
| 285 | return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; | 306 | return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; |
| @@ -316,17 +337,12 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) | |||
| 316 | static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) | 337 | static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) |
| 317 | { | 338 | { |
| 318 | unsigned int xfer_len = scsi_out(scmd)->length; | 339 | unsigned int xfer_len = scsi_out(scmd)->length; |
| 319 | unsigned int prot_op = scsi_get_prot_op(scmd); | 340 | unsigned int prot_interval = scsi_prot_interval(scmd); |
| 320 | unsigned int sector_size = scmd->device->sector_size; | ||
| 321 | 341 | ||
| 322 | switch (prot_op) { | 342 | if (scmd->prot_flags & SCSI_PROT_TRANSFER_PI) |
| 323 | case SCSI_PROT_NORMAL: | 343 | xfer_len += (xfer_len >> ilog2(prot_interval)) * 8; |
| 324 | case SCSI_PROT_WRITE_STRIP: | ||
| 325 | case SCSI_PROT_READ_INSERT: | ||
| 326 | return xfer_len; | ||
| 327 | } | ||
| 328 | 344 | ||
| 329 | return xfer_len + (xfer_len >> ilog2(sector_size)) * 8; | 345 | return xfer_len; |
| 330 | } | 346 | } |
| 331 | 347 | ||
| 332 | #endif /* _SCSI_SCSI_CMND_H */ | 348 | #endif /* _SCSI_SCSI_CMND_H */ |
