aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2012-11-09 18:33:05 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2013-03-26 14:18:58 -0400
commit0e5e4f0e56aca0df1d5648db0be9028bd573b25c (patch)
treea83ab74e90bae5e0a20e6fd9dd03924cac1f3db9 /include/linux
parenta12183c62717ac4579319189a00f5883a18dff08 (diff)
NVMe: Add discard support for capable devices
This adds discard support to block queues if the nvme device is capable of deallocating blocks as indicated by the controller's optional command support. A discard flagged bio request will submit an NVMe deallocate Data Set Management command for the requested blocks. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/nvme.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 4fa3b0b9b071..bde44c1fd213 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -107,6 +107,12 @@ struct nvme_id_ctrl {
107 __u8 vs[1024]; 107 __u8 vs[1024];
108}; 108};
109 109
110enum {
111 NVME_CTRL_ONCS_COMPARE = 1 << 0,
112 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
113 NVME_CTRL_ONCS_DSM = 1 << 2,
114};
115
110struct nvme_lbaf { 116struct nvme_lbaf {
111 __le16 ms; 117 __le16 ms;
112 __u8 ds; 118 __u8 ds;
@@ -246,6 +252,31 @@ enum {
246 NVME_RW_DSM_COMPRESSED = 1 << 7, 252 NVME_RW_DSM_COMPRESSED = 1 << 7,
247}; 253};
248 254
255struct nvme_dsm_cmd {
256 __u8 opcode;
257 __u8 flags;
258 __u16 command_id;
259 __le32 nsid;
260 __u64 rsvd2[2];
261 __le64 prp1;
262 __le64 prp2;
263 __le32 nr;
264 __le32 attributes;
265 __u32 rsvd12[4];
266};
267
268enum {
269 NVME_DSMGMT_IDR = 1 << 0,
270 NVME_DSMGMT_IDW = 1 << 1,
271 NVME_DSMGMT_AD = 1 << 2,
272};
273
274struct nvme_dsm_range {
275 __le32 cattr;
276 __le32 nlb;
277 __le64 slba;
278};
279
249/* Admin commands */ 280/* Admin commands */
250 281
251enum nvme_admin_opcode { 282enum nvme_admin_opcode {
@@ -372,6 +403,7 @@ struct nvme_command {
372 struct nvme_create_sq create_sq; 403 struct nvme_create_sq create_sq;
373 struct nvme_delete_queue delete_queue; 404 struct nvme_delete_queue delete_queue;
374 struct nvme_download_firmware dlfw; 405 struct nvme_download_firmware dlfw;
406 struct nvme_dsm_cmd dsm;
375 }; 407 };
376}; 408};
377 409