Message ID | 20230523090050.373545-8-chandan.babu@oracle.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | Metadump v2 | expand |
On Tue, May 23, 2023 at 02:30:33PM +0530, Chandan Babu R wrote: > A future commit will require that the metadump file be opened before execution > of init_metadump(). Why is that? --D > Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> > --- > db/metadump.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/db/metadump.c b/db/metadump.c > index 62a36427d..212b484a2 100644 > --- a/db/metadump.c > +++ b/db/metadump.c > @@ -3129,10 +3129,6 @@ metadump_f( > pop_cur(); > } > > - ret = init_metadump(); > - if (ret) > - return 0; > - > start_iocur_sp = iocur_sp; > > if (strcmp(argv[optind], "-") == 0) { > @@ -3177,6 +3173,10 @@ metadump_f( > } > } > > + ret = init_metadump(); > + if (ret) > + return 0; > + > exitcode = 0; > > for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { > @@ -3215,8 +3215,9 @@ metadump_f( > /* cleanup iocur stack */ > while (iocur_sp > start_iocur_sp) > pop_cur(); > -out: > + > release_metadump(); > > +out: > return 0; > } > -- > 2.39.1 >
On Tue, May 23, 2023 at 10:13:42 AM -0700, Darrick J. Wong wrote: > On Tue, May 23, 2023 at 02:30:33PM +0530, Chandan Babu R wrote: >> A future commit will require that the metadump file be opened before execution >> of init_metadump(). > > Why is that? > The metadump v2 initialization function (i.e. init_metadump_v2()) writes the header structure (i.e. struct xfs_metadump_header) into the metadump file. This will require the program to open the metadump file before initialization function has been invoked. I will add the above to the commit description.
diff --git a/db/metadump.c b/db/metadump.c index 62a36427d..212b484a2 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -3129,10 +3129,6 @@ metadump_f( pop_cur(); } - ret = init_metadump(); - if (ret) - return 0; - start_iocur_sp = iocur_sp; if (strcmp(argv[optind], "-") == 0) { @@ -3177,6 +3173,10 @@ metadump_f( } } + ret = init_metadump(); + if (ret) + return 0; + exitcode = 0; for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { @@ -3215,8 +3215,9 @@ metadump_f( /* cleanup iocur stack */ while (iocur_sp > start_iocur_sp) pop_cur(); -out: + release_metadump(); +out: return 0; }
A future commit will require that the metadump file be opened before execution of init_metadump(). Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> --- db/metadump.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)