Skip to content

Commit

Permalink
Merge branch 'enable-dataplacement-while-replaying-io' of https://git…
Browse files Browse the repository at this point in the history
…hub.com/parkvibes/fio

* 'enable-dataplacement-while-replaying-io' of https://github.com/parkvibes/fio:
  t/nvmept_fdp: add a test(402)
  fio: enable dataplacement(fdp) while replaying I/Os
  • Loading branch information
vincentkfu committed May 28, 2024
2 parents dfccaca + e6a96fa commit d5fbe84
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
14 changes: 13 additions & 1 deletion iolog.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ static int ipo_special(struct thread_data *td, struct io_piece *ipo)
break;
}
ret = td_io_open_file(td, f);
if (!ret)
if (!ret) {
if (td->o.dp_type != FIO_DP_NONE) {
int dp_init_ret = dp_init(td);

if (dp_init_ret != 0) {
td_verror(td, dp_init_ret, "dp_init");
return -1;
}
}
break;
}
td_verror(td, ret, "iolog open file");
return -1;
case FIO_LOG_CLOSE_FILE:
Expand Down Expand Up @@ -233,6 +242,9 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u)
usec_sleep(td, (ipo->delay - elapsed) * 1000);
}

if (td->o.dp_type != FIO_DP_NONE)
dp_fill_dspec_data(td, io_u);

free(ipo);

if (io_u->ddir != DDIR_WAIT)
Expand Down
30 changes: 29 additions & 1 deletion t/nvmept_fdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def setup(self, parameters):
'size', 'rate', 'bs', 'bssplit', 'bsrange', 'randrepeat',
'buffer_pattern', 'verify_pattern', 'offset', 'fdp',
'fdp_pli', 'fdp_pli_select', 'dataplacement', 'plid_select',
'plids', 'dp_scheme', 'number_ios']:
'plids', 'dp_scheme', 'number_ios', 'read_iolog']:
if opt in self.fio_opts:
option = f"--{opt}={self.fio_opts[opt]}"
fio_args.append(option)
Expand Down Expand Up @@ -148,6 +148,18 @@ def setup(self, parameters):
with open(scheme_path, mode='w') as f:
for i in range(mapping['nios_for_scheme']):
f.write(f'{mapping["hole_size"] * 2 * i}, {mapping["hole_size"] * 2 * (i+1)}, {i}\n')

if 'read_iolog' in self.fio_opts:
read_iolog_path = os.path.join(self.paths['test_dir'], self.fio_opts['read_iolog'])
with open(read_iolog_path, mode='w') as f:
f.write('fio version 2 iolog\n')
f.write(f'{self.fio_opts["filename"]} add\n')
f.write(f'{self.fio_opts["filename"]} open\n')

for i in range(mapping['nios_for_scheme']):
f.write(f'{self.fio_opts["filename"]} write {mapping["hole_size"] * 2 * i} {mapping["hole_size"]}\n')

f.write(f'{self.fio_opts["filename"]} close')

def _check_result(self):
if 'fdp_pli' in self.fio_opts:
Expand Down Expand Up @@ -789,6 +801,22 @@ def check_all_ruhs(dut):
},
"test_class": FDPMultiplePLIDTest,
},
# check whether dataplacement works while replaying iologs
{
"test_id": 402,
"fio_opts": {
"rw": "write:{hole_size}",
"bs": "{hole_size}",
"number_ios": "{nios_for_scheme}",
"verify": "crc32c",
"read_iolog": "iolog",
"dataplacement": "fdp",
"plid_select": "scheme",
"dp_scheme": "lba.scheme",
"output-format": "json",
},
"test_class": FDPMultiplePLIDTest,
},
]

def parse_args():
Expand Down

0 comments on commit d5fbe84

Please sign in to comment.