Skip to content

Commit

Permalink
FreeBSD: Add option to rewind checkpoint while importing root pool
Browse files Browse the repository at this point in the history
This option is used by FreeBSD boot loader.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>
Closes openzfs#10738
  • Loading branch information
oshogbo committed Aug 20, 2020
1 parent 5266a07 commit f2c027b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/zfs_context_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ typedef int fstrans_cookie_t;
#define cv_wait_io(cv, mp) cv_wait(cv, mp)
typedef struct opensolaris_utsname utsname_t;
extern utsname_t *utsname(void);
extern int spa_import_rootpool(const char *name);
extern int spa_import_rootpool(const char *name, bool checkpointrewind);
#endif
5 changes: 4 additions & 1 deletion module/os/freebsd/zfs/spa_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ spa_generate_rootconf(const char *name)
}

int
spa_import_rootpool(const char *name)
spa_import_rootpool(const char *name, bool checkpointrewind)
{
spa_t *spa;
vdev_t *rvd;
Expand Down Expand Up @@ -244,6 +244,9 @@ spa_import_rootpool(const char *name)
}
spa->spa_is_root = B_TRUE;
spa->spa_import_flags = ZFS_IMPORT_VERBATIM;
if (checkpointrewind) {
spa->spa_import_flags |= ZFS_IMPORT_CHECKPOINT;
}

/*
* Build up a vdev tree based on the boot device's label config.
Expand Down
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ zfs_mount(vfs_t *vfsp)

error = getpoolname(osname, pname);
if (error == 0)
error = spa_import_rootpool(pname);
error = spa_import_rootpool(pname, false);
if (error)
goto out;
}
Expand Down

0 comments on commit f2c027b

Please sign in to comment.