On Tue, May 23, 2023 at 10:15:25 AM -0700, Darrick J. Wong wrote: > On Tue, May 23, 2023 at 02:30:34PM +0530, Chandan Babu R wrote: >> We will need two sets of functions to implement two versions of metadump. This >> commit adds the definition for 'struct metadump_ops' to hold pointers to >> version specific metadump functions. >> >> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> >> --- >> db/metadump.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/db/metadump.c b/db/metadump.c >> index 212b484a2..56d8c3bdf 100644 >> --- a/db/metadump.c >> +++ b/db/metadump.c >> @@ -40,6 +40,14 @@ static const cmdinfo_t metadump_cmd = >> N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"), >> N_("dump metadata to a file"), metadump_help }; >> >> +struct metadump_ops { >> + int (*init_metadump)(void); >> + int (*write_metadump)(enum typnm type, char *data, int64_t off, >> + int len); >> + int (*end_write_metadump)(void); >> + void (*release_metadump)(void); > > Needs comments describing what each of these do. Sure. I will add the comments to describe each function pointer. > Does each ->write_metadump have to have a ->end_write_metadump? No. The v1 format code collects metadata blocks in memory and writes them to the disk after sufficient number of blocks have been collected. We might not have reached this limit for the final set of 512 byte metadata blocks. Hence, a write operation has to be explicitly issued for such metadata blocks. > > You could probably remove the _metadump suffix too. Yes, I will remove them. -- chandan