mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvcreate: code move
This commit is contained in:
parent
89cec5b65a
commit
7f1f7ad694
@ -1851,30 +1851,28 @@ static int _lvcreate_and_attach_writecache_single(struct cmd_context *cmd,
|
|||||||
int lvcreate_and_attach_writecache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
int lvcreate_and_attach_writecache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct processing_handle *handle = NULL;
|
struct processing_handle *handle = NULL;
|
||||||
struct processing_params pp;
|
|
||||||
struct lvcreate_params lp = {
|
struct lvcreate_params lp = {
|
||||||
.major = -1,
|
.major = -1,
|
||||||
.minor = -1,
|
.minor = -1,
|
||||||
|
/*
|
||||||
|
* Tell lvcreate to ignore --type since we are using lvcreate
|
||||||
|
* to create a linear LV and using lvconvert to add cache.
|
||||||
|
* (Would be better if lvcreate code was split up so we could
|
||||||
|
* call a specific function that just created a linear/striped LV.)
|
||||||
|
*/
|
||||||
|
.ignore_type = 1,
|
||||||
};
|
};
|
||||||
struct lvcreate_cmdline_params lcp = { 0 };
|
struct lvcreate_cmdline_params lcp = { 0 };
|
||||||
|
struct processing_params pp = {
|
||||||
|
.lp = &lp,
|
||||||
|
.lcp = &lcp,
|
||||||
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell lvcreate to ignore --type since we are using lvcreate
|
|
||||||
* to create a linear LV and using lvconvert to add cache.
|
|
||||||
* (Would be better if lvcreate code was split up so we could
|
|
||||||
* call a specific function that just created a linear/striped LV.)
|
|
||||||
*/
|
|
||||||
lp.ignore_type = 1;
|
|
||||||
|
|
||||||
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
|
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
|
||||||
stack;
|
stack;
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp.lp = &lp;
|
|
||||||
pp.lcp = &lcp;
|
|
||||||
|
|
||||||
if (!(handle = init_processing_handle(cmd, NULL))) {
|
if (!(handle = init_processing_handle(cmd, NULL))) {
|
||||||
log_error("Failed to initialize processing handle.");
|
log_error("Failed to initialize processing handle.");
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -1925,30 +1923,29 @@ static int _lvcreate_and_attach_cache_single(struct cmd_context *cmd,
|
|||||||
int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct processing_handle *handle = NULL;
|
struct processing_handle *handle = NULL;
|
||||||
struct processing_params pp;
|
|
||||||
struct lvcreate_params lp = {
|
struct lvcreate_params lp = {
|
||||||
.major = -1,
|
.major = -1,
|
||||||
.minor = -1,
|
.minor = -1,
|
||||||
|
/*
|
||||||
|
* Tell lvcreate to ignore --type since we are using lvcreate
|
||||||
|
* to create a linear LV and using lvconvert to add cache.
|
||||||
|
* (Would be better if lvcreate code was split up so we could
|
||||||
|
* call a specific function that just created a linear/striped LV.)
|
||||||
|
*/
|
||||||
|
.ignore_type = 1,
|
||||||
};
|
};
|
||||||
struct lvcreate_cmdline_params lcp = { 0 };
|
struct lvcreate_cmdline_params lcp = { 0 };
|
||||||
|
struct processing_params pp = {
|
||||||
|
.lp = &lp,
|
||||||
|
.lcp = &lcp,
|
||||||
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell lvcreate to ignore --type since we are using lvcreate
|
|
||||||
* to create a linear LV and using lvconvert to add cache.
|
|
||||||
* (Would be better if lvcreate code was split up so we could
|
|
||||||
* call a specific function that just created a linear/striped LV.)
|
|
||||||
*/
|
|
||||||
lp.ignore_type = 1;
|
|
||||||
|
|
||||||
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
|
if (!_lvcreate_params(cmd, argc, argv, &lp, &lcp)) {
|
||||||
stack;
|
stack;
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp.lp = &lp;
|
|
||||||
pp.lcp = &lcp;
|
|
||||||
|
|
||||||
if (!(handle = init_processing_handle(cmd, NULL))) {
|
if (!(handle = init_processing_handle(cmd, NULL))) {
|
||||||
log_error("Failed to initialize processing handle.");
|
log_error("Failed to initialize processing handle.");
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -1963,4 +1960,3 @@ int lvcreate_and_attach_cache_cmd(struct cmd_context *cmd, int argc, char **argv
|
|||||||
destroy_processing_handle(cmd, handle);
|
destroy_processing_handle(cmd, handle);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user