Message ID | 20230523090050.373545-9-chandan.babu@oracle.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | Metadump v2 | expand |
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@oracle.com> > --- > 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. Does each ->write_metadump have to have a ->end_write_metadump? You could probably remove the _metadump suffix too. --D > +}; > + > static struct metadump { > int version; > int show_progress; > @@ -54,6 +62,7 @@ static struct metadump { > xfs_ino_t cur_ino; > /* Metadump file */ > FILE *outf; > + struct metadump_ops *mdops; > /* header + index + buffers */ > struct xfs_metablock *metablock; > __be64 *block_index; > -- > 2.39.1 >
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@oracle.com> >> --- >> 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.
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); +}; + static struct metadump { int version; int show_progress; @@ -54,6 +62,7 @@ static struct metadump { xfs_ino_t cur_ino; /* Metadump file */ FILE *outf; + struct metadump_ops *mdops; /* header + index + buffers */ struct xfs_metablock *metablock; __be64 *block_index;
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@oracle.com> --- db/metadump.c | 9 +++++++++ 1 file changed, 9 insertions(+)