Re: [PATCH 36/50] xfs_mdrestore: restore rt group superblocks to realtime device

Darrick J. Wong
2024-12-11T22:09:31Z

On Mon, Dec 09, 2024 at 09:53:00PM -0800, Christoph Hellwig wrote:
> > +++ b/mdrestore/xfs_mdrestore.c
> > @@ -19,8 +19,9 @@ struct mdrestore_ops {
> > void (*read_header)(union mdrestore_headers *header, FILE *md_fp);
> > void (*show_info)(union mdrestore_headers *header, const char *md_file);
> > void (*restore)(union mdrestore_headers *header, FILE *md_fp,
> > - int ddev_fd, bool is_data_target_file, int logdev_fd,
> > - bool is_log_target_file);
> > + int ddev_fd, bool is_data_target_file,
> > + int logdev_fd, bool is_log_target_file,
> > + int rtdev_fd, bool is_rt_target_file);
>
> This almost feels like adding a little struct nicely clean up the
> interface here:
>
> struct mdrestore_dev {
> int fd;
> bool is_file;
> }
>
>
> void (*restore)(union mdrestore_headers *header, FILE *md_fp,
> struct mdrestore_dev *ddev,
> struct mdrestore_dev *logdev,
> struct mdrestore_dev *rtdev);
>
> and also be useful for at least verify_device_size.

Yeah, that callsite only gets uglier with this patch. I'll add a prep
patch to refactor the fd/is_file parameters into mdrestore_dev.

--D