nvmet: use NVME_IDENTIFY_DATA_SIZE
Use NVME_IDENTIFY_DATA_SIZE define instead of hard coding the magic 4096 value. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Hannes Reinecke <hare@suse.com> [hch: converted three more users] Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
0945e56994
commit
0add5e8e58
5 changed files with 8 additions and 6 deletions
|
@ -242,7 +242,7 @@ static inline void _nvme_nvm_check_size(void)
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_nvm_erase_blk) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_nvm_erase_blk) != 64);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_nvm_id_group) != 960);
|
BUILD_BUG_ON(sizeof(struct nvme_nvm_id_group) != 960);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_nvm_addr_format) != 16);
|
BUILD_BUG_ON(sizeof(struct nvme_nvm_addr_format) != 16);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_nvm_id) != 4096);
|
BUILD_BUG_ON(sizeof(struct nvme_nvm_id) != NVME_IDENTIFY_DATA_SIZE);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_nvm_bb_tbl) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_nvm_bb_tbl) != 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,8 @@ static inline void _nvme_check_size(void)
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_format_cmd) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_format_cmd) != 64);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_abort_cmd) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_abort_cmd) != 64);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_command) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_command) != 64);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096);
|
BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != NVME_IDENTIFY_DATA_SIZE);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096);
|
BUILD_BUG_ON(sizeof(struct nvme_id_ns) != NVME_IDENTIFY_DATA_SIZE);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512);
|
BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512);
|
||||||
BUILD_BUG_ON(sizeof(struct nvme_dbbuf) != 64);
|
BUILD_BUG_ON(sizeof(struct nvme_dbbuf) != 64);
|
||||||
|
|
|
@ -336,7 +336,7 @@ out:
|
||||||
|
|
||||||
static void nvmet_execute_identify_nslist(struct nvmet_req *req)
|
static void nvmet_execute_identify_nslist(struct nvmet_req *req)
|
||||||
{
|
{
|
||||||
static const int buf_size = 4096;
|
static const int buf_size = NVME_IDENTIFY_DATA_SIZE;
|
||||||
struct nvmet_ctrl *ctrl = req->sq->ctrl;
|
struct nvmet_ctrl *ctrl = req->sq->ctrl;
|
||||||
struct nvmet_ns *ns;
|
struct nvmet_ns *ns;
|
||||||
u32 min_nsid = le32_to_cpu(req->cmd->identify.nsid);
|
u32 min_nsid = le32_to_cpu(req->cmd->identify.nsid);
|
||||||
|
@ -504,7 +504,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nvme_admin_identify:
|
case nvme_admin_identify:
|
||||||
req->data_len = 4096;
|
req->data_len = NVME_IDENTIFY_DATA_SIZE;
|
||||||
switch (cmd->identify.cns) {
|
switch (cmd->identify.cns) {
|
||||||
case NVME_ID_CNS_NS:
|
case NVME_ID_CNS_NS:
|
||||||
req->execute = nvmet_execute_identify_ns;
|
req->execute = nvmet_execute_identify_ns;
|
||||||
|
|
|
@ -185,7 +185,7 @@ u16 nvmet_parse_discovery_cmd(struct nvmet_req *req)
|
||||||
return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
|
return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
|
||||||
}
|
}
|
||||||
case nvme_admin_identify:
|
case nvme_admin_identify:
|
||||||
req->data_len = 4096;
|
req->data_len = NVME_IDENTIFY_DATA_SIZE;
|
||||||
switch (cmd->identify.cns) {
|
switch (cmd->identify.cns) {
|
||||||
case NVME_ID_CNS_CTRL:
|
case NVME_ID_CNS_CTRL:
|
||||||
req->execute =
|
req->execute =
|
||||||
|
|
|
@ -665,6 +665,8 @@ struct nvme_identify {
|
||||||
__u32 rsvd11[5];
|
__u32 rsvd11[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NVME_IDENTIFY_DATA_SIZE 4096
|
||||||
|
|
||||||
struct nvme_features {
|
struct nvme_features {
|
||||||
__u8 opcode;
|
__u8 opcode;
|
||||||
__u8 flags;
|
__u8 flags;
|
||||||
|
|
Loading…
Add table
Reference in a new issue