Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fio: enable dataplacement(fdp) while replaying I/Os #1762

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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