@@ -6860,6 +6860,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
6860
6860
_cleanup_free_ struct nvme_id_ns * ns = NULL ;
6861
6861
_cleanup_nvme_dev_ struct nvme_dev * dev = NULL ;
6862
6862
__u8 lba_index , sts = 0 , pif = 0 ;
6863
+ __u32 elbaf = 0 ;
6863
6864
__u16 control = 0 ;
6864
6865
int err ;
6865
6866
@@ -6971,8 +6972,11 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
6971
6972
err = nvme_identify_ns_csi (dev_fd (dev ), cfg .namespace_id , 0 , NVME_CSI_NVM , nvm_ns );
6972
6973
if (!err ) {
6973
6974
nvme_id_ns_flbas_to_lbaf_inuse (ns -> flbas , & lba_index );
6974
- sts = nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_STS_MASK ;
6975
- pif = (nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
6975
+ elbaf = le32_to_cpu (nvm_ns -> elbaf [lba_index ]);
6976
+ sts = elbaf & NVME_NVM_ELBAF_STS_MASK ;
6977
+ pif = (elbaf & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
6978
+ if (pif == NVME_NVM_PIF_QTYPE && (nvm_ns -> pic & 0x8 ))
6979
+ pif = (elbaf & NVME_NVM_ELBAF_QPIF_MASK ) >> 9 ;
6976
6980
}
6977
6981
6978
6982
if (invalid_tags (cfg .storage_tag , cfg .ref_tag , sts , pif ))
@@ -7698,7 +7702,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
7698
7702
int flags ;
7699
7703
int mode = 0644 ;
7700
7704
__u16 control = 0 , nblocks = 0 ;
7701
- __u32 dsmgmt = 0 ;
7705
+ __u32 dsmgmt = 0 , elbaf = 0 ;
7702
7706
unsigned int logical_block_size = 0 ;
7703
7707
unsigned long long buffer_size = 0 , mbuffer_size = 0 ;
7704
7708
_cleanup_huge_ struct nvme_mem_huge mh = { 0 , };
@@ -7929,8 +7933,11 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
7929
7933
if (cfg .metadata_size ) {
7930
7934
err = nvme_identify_ns_csi (dev_fd (dev ), 1 , 0 , NVME_CSI_NVM , nvm_ns );
7931
7935
if (!err ) {
7932
- sts = nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_STS_MASK ;
7933
- pif = (nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
7936
+ elbaf = le32_to_cpu (nvm_ns -> elbaf [lba_index ]);
7937
+ sts = elbaf & NVME_NVM_ELBAF_STS_MASK ;
7938
+ pif = (elbaf & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
7939
+ if (pif == NVME_NVM_PIF_QTYPE && (nvm_ns -> pic & 0x8 ))
7940
+ pif = (elbaf & NVME_NVM_ELBAF_QPIF_MASK ) >> 9 ;
7934
7941
}
7935
7942
7936
7943
mbuffer_size = ((unsigned long long )cfg .block_count + 1 ) * ms ;
@@ -8065,11 +8072,12 @@ static int write_cmd(int argc, char **argv, struct command *cmd, struct plugin *
8065
8072
8066
8073
static int verify_cmd (int argc , char * * argv , struct command * cmd , struct plugin * plugin )
8067
8074
{
8068
- __u16 control = 0 ;
8069
- __u8 lba_index , sts = 0 , pif = 0 ;
8070
8075
_cleanup_free_ struct nvme_nvm_id_ns * nvm_ns = NULL ;
8071
8076
_cleanup_free_ struct nvme_id_ns * ns = NULL ;
8072
8077
_cleanup_nvme_dev_ struct nvme_dev * dev = NULL ;
8078
+ __u8 lba_index , sts = 0 , pif = 0 ;
8079
+ __u16 control = 0 ;
8080
+ __u32 elbaf = 0 ;
8073
8081
int err ;
8074
8082
8075
8083
const char * desc = "Verify specified logical blocks on the given device." ;
@@ -8163,8 +8171,11 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
8163
8171
NVME_CSI_NVM , nvm_ns );
8164
8172
if (!err ) {
8165
8173
nvme_id_ns_flbas_to_lbaf_inuse (ns -> flbas , & lba_index );
8166
- sts = nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_STS_MASK ;
8167
- pif = (nvm_ns -> elbaf [lba_index ] & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
8174
+ elbaf = le32_to_cpu (nvm_ns -> elbaf [lba_index ]);
8175
+ sts = elbaf & NVME_NVM_ELBAF_STS_MASK ;
8176
+ pif = (elbaf & NVME_NVM_ELBAF_PIF_MASK ) >> 7 ;
8177
+ if (pif == NVME_NVM_PIF_QTYPE && (nvm_ns -> pic & 0x8 ))
8178
+ pif = (elbaf & NVME_NVM_ELBAF_QPIF_MASK ) >> 9 ;
8168
8179
}
8169
8180
8170
8181
if (invalid_tags (cfg .storage_tag , cfg .ref_tag , sts , pif ))
0 commit comments