@@ -8009,15 +8009,13 @@ unsigned long long elapsed_utime(struct timeval start_time,
80098009
80108010static int submit_io (int opcode , char * command , const char * desc , int argc , char * * argv )
80118011{
8012- struct timeval start_time , end_time ;
80138012 void * buffer ;
80148013 _cleanup_free_ void * mbuffer = NULL ;
80158014 int err = 0 ;
80168015 _cleanup_fd_ int dfd = -1 , mfd = -1 ;
80178016 int flags , pi_size ;
80188017 int mode = 0644 ;
80198018 __u16 control = 0 , nblocks = 0 ;
8020- __u32 dsmgmt = 0 ;
80218019 unsigned int logical_block_size = 0 ;
80228020 unsigned long long buffer_size = 0 , mbuffer_size = 0 ;
80238021 _cleanup_huge_ struct nvme_mem_huge mh = { 0 , };
@@ -8147,7 +8145,6 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
81478145 if (cfg .prinfo > 0xf )
81488146 return err ;
81498147
8150- dsmgmt = cfg .dsmgmt ;
81518148 control |= (cfg .prinfo << 10 );
81528149 if (cfg .limited_retry )
81538150 control |= NVME_IO_LR ;
@@ -8161,7 +8158,6 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
81618158 return - EINVAL ;
81628159 }
81638160 control |= cfg .dtype << 4 ;
8164- dsmgmt |= ((__u32 )cfg .dspec ) << 16 ;
81658161 }
81668162
81678163 if (opcode & 1 ) {
@@ -8285,27 +8281,6 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
82858281 }
82868282 }
82878283
8288- if (cfg .show || nvme_cfg .dry_run ) {
8289- printf ("opcode : %02x\n" , opcode );
8290- printf ("nsid : %02x\n" , cfg .namespace_id );
8291- printf ("flags : %02x\n" , 0 );
8292- printf ("control : %04x\n" , control );
8293- printf ("nblocks : %04x\n" , nblocks );
8294- printf ("metadata : %" PRIx64 "\n" , (uint64_t )(uintptr_t )mbuffer );
8295- printf ("addr : %" PRIx64 "\n" , (uint64_t )(uintptr_t )buffer );
8296- printf ("slba : %" PRIx64 "\n" , (uint64_t )cfg .start_block );
8297- printf ("dsmgmt : %08x\n" , dsmgmt );
8298- printf ("reftag : %" PRIx64 "\n" , (uint64_t )cfg .ref_tag );
8299- printf ("apptag : %04x\n" , cfg .app_tag );
8300- printf ("appmask : %04x\n" , cfg .app_tag_mask );
8301- printf ("storagetagcheck : %04x\n" , cfg .storage_tag_check );
8302- printf ("storagetag : %" PRIx64 "\n" , (uint64_t )cfg .storage_tag );
8303- printf ("pif : %02x\n" , pif );
8304- printf ("sts : %02x\n" , sts );
8305- }
8306- if (nvme_cfg .dry_run )
8307- return 0 ;
8308-
83098284 struct nvme_io_args args = {
83108285 .args_size = sizeof (args ),
83118286 .fd = dev_fd (dev ),
@@ -8329,16 +8304,13 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char
83298304 .timeout = nvme_cfg .timeout ,
83308305 .result = NULL ,
83318306 };
8332- gettimeofday (& start_time , NULL );
8333- err = nvme_io (& args , opcode );
8334- gettimeofday (& end_time , NULL );
8335- if (cfg .latency )
8336- printf (" latency: %s: %llu us\n" , command , elapsed_utime (start_time , end_time ));
8307+
8308+ err = nvme_submit_io (& args , opcode , cfg .show , cfg .latency );
83378309 if (err < 0 ) {
83388310 nvme_show_error ("submit-io: %s" , nvme_strerror (errno ));
83398311 } else if (err ) {
83408312 nvme_show_status (err );
8341- } else {
8313+ } else if (! nvme_cfg . dry_run ) {
83428314 if (!(opcode & 1 ) && write (dfd , (void * )buffer , buffer_size ) < 0 ) {
83438315 nvme_show_error ("write: %s: failed to write buffer to output file" ,
83448316 strerror (errno ));
0 commit comments