From f082667807b89ee1b4598e793e6568d7c58348d9 Mon Sep 17 00:00:00 2001 From: Hyunwoo Park Date: Thu, 23 May 2024 07:30:36 +0000 Subject: [PATCH 1/2] fio: enable dataplacement(fdp) while replaying I/Os Add initialization and dataplacement logic to enable dataplacement(fdp) while fio replays I/Os with read_iolog. Signed-off-by: Hyunwoo Park --- iolog.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/iolog.c b/iolog.c index 96af4f33e1..37ad0d2a16 100644 --- a/iolog.c +++ b/iolog.c @@ -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: @@ -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) From e6a96fa85b54eb04e2da874339db9eb166fa3475 Mon Sep 17 00:00:00 2001 From: Hyunwoo Park Date: Mon, 27 May 2024 05:37:41 +0000 Subject: [PATCH 2/2] t/nvmept_fdp: add a test(402) A test(402) checks whether dataplacement(fdp) works fine while replaying iologs Signed-off-by: Hyunwoo Park --- t/nvmept_fdp.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/t/nvmept_fdp.py b/t/nvmept_fdp.py index d6a543f286..c50c14e46a 100755 --- a/t/nvmept_fdp.py +++ b/t/nvmept_fdp.py @@ -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) @@ -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: @@ -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():