Skip to content

Commit 9ee6596

Browse files
committed
short path for "zfs/zpool upgrade -v" befor libzfs_init
In freebsd, there will no kernel auto-load for this two commands. zpool upgrade still need kernel in linux. Signed-off-by: tiehexue <tiehexue@hotmail.com>
1 parent c0f62d4 commit 9ee6596

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

cmd/zfs/zfs_main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9394,6 +9394,21 @@ main(int argc, char **argv)
93949394
if (strcmp(cmdname, "help") == 0)
93959395
return (zfs_do_help(argc, argv));
93969396

9397+
/*
9398+
* Special case 'upgrade -v' — userspace only, no kernel needed.
9399+
*/
9400+
if (strcmp(cmdname, "upgrade") == 0) {
9401+
for (int i = 2; i < argc; i++) {
9402+
if (strcmp(argv[i], "-v") == 0) {
9403+
int idx;
9404+
if (find_command_idx("upgrade", &idx) == 0)
9405+
current_command = &command_table[idx];
9406+
return (zfs_do_upgrade(argc - 1,
9407+
argv + 1));
9408+
}
9409+
}
9410+
}
9411+
93979412
if ((g_zfs = libzfs_init()) == NULL) {
93989413
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
93999414
return (1);

cmd/zpool/zpool_main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13890,6 +13890,23 @@ main(int argc, char **argv)
1389013890
}
1389113891
}
1389213892

13893+
/*
13894+
* Special case 'upgrade -v',
13895+
* userspace only in "freebsd", no kernel needed.
13896+
*/
13897+
if (strcmp(cmdname, "upgrade") == 0) {
13898+
for (int i = 2; i < argc; i++) {
13899+
if (strcmp(argv[i], "-v") == 0) {
13900+
int idx;
13901+
if (find_command_idx("upgrade", &idx) == 0)
13902+
current_command = &command_table[idx];
13903+
zpool_feature_init();
13904+
return (zpool_do_upgrade(argc - 1,
13905+
argv + 1));
13906+
}
13907+
}
13908+
}
13909+
1389313910
if ((g_zfs = libzfs_init()) == NULL) {
1389413911
(void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
1389513912
return (1);

0 commit comments

Comments
 (0)