mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 12:28:58 +00:00
Add '-p' option for 'insert' command which allows to specify priority
of the new component. Version number wasn't bumped (it should be), because I think there are no geom_mirror users yet.
This commit is contained in:
parent
ff9160f5f3
commit
55d6eb9fef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132909
@ -46,6 +46,7 @@ uint32_t version = G_MIRROR_VERSION;
|
||||
|
||||
static char label_balance[] = "split", configure_balance[] = "none";
|
||||
static intmax_t label_slice = 4096, configure_slice = -1;
|
||||
static intmax_t insert_priority = 0;
|
||||
|
||||
static void mirror_main(struct gctl_req *req, unsigned f);
|
||||
static void mirror_activate(struct gctl_req *req);
|
||||
@ -79,6 +80,7 @@ struct g_command class_commands[] = {
|
||||
{ "insert", G_FLAG_VERBOSE, NULL,
|
||||
{
|
||||
{ 'i', "inactive", NULL, G_TYPE_NONE },
|
||||
{ 'p', "priority", &insert_priority, G_TYPE_NUMBER },
|
||||
G_OPT_SENTINEL
|
||||
}
|
||||
},
|
||||
@ -105,7 +107,7 @@ usage(const char *comm)
|
||||
" %s dump dev1 [dev2 [...]]\n"
|
||||
" %s configure [-anv] [-b balance] [-s slice] name\n"
|
||||
" %s rebuild [-v] name dev1 [dev2 [...]]\n"
|
||||
" %s insert [-iv] name dev1 [dev2 [...]]\n"
|
||||
" %s insert [-iv] [-p priority] name dev1 [dev2 [...]]\n"
|
||||
" %s remove [-v] name dev1 [dev2 [...]]\n"
|
||||
" %s activate [-v] name dev1 [dev2 [...]]\n"
|
||||
" %s deactivate [-v] name dev1 [dev2 [...]]\n"
|
||||
|
@ -252,6 +252,7 @@ g_mirror_ctl_insert(struct gctl_req *req, struct g_class *mp)
|
||||
struct g_mirror_metadata md;
|
||||
struct g_provider *pp;
|
||||
struct g_consumer *cp;
|
||||
intmax_t *priority;
|
||||
const char *name;
|
||||
char param[16];
|
||||
u_char *sector;
|
||||
@ -272,6 +273,11 @@ g_mirror_ctl_insert(struct gctl_req *req, struct g_class *mp)
|
||||
gctl_error(req, "Too few arguments.");
|
||||
return;
|
||||
}
|
||||
priority = gctl_get_paraml(req, "priority", sizeof(*priority));
|
||||
if (priority == NULL) {
|
||||
gctl_error(req, "No '%s' argument.", "priority");
|
||||
return;
|
||||
}
|
||||
inactive = gctl_get_paraml(req, "inactive", sizeof(*inactive));
|
||||
if (inactive == NULL) {
|
||||
gctl_error(req, "No '%s' argument.", "inactive");
|
||||
@ -346,6 +352,7 @@ again:
|
||||
if (disks[i].consumer == NULL)
|
||||
continue;
|
||||
g_mirror_fill_metadata(sc, NULL, &md);
|
||||
md.md_priority = *priority;
|
||||
if (*inactive)
|
||||
md.md_dflags |= G_MIRROR_DISK_FLAG_INACTIVE;
|
||||
pp = disks[i].provider;
|
||||
|
Loading…
Reference in New Issue
Block a user