mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Remove VG arg from lv_is_cow() and lv_is_origin() - use lv->vg instead.
This commit is contained in:
parent
a45f546fe0
commit
b6afcf6458
@ -613,7 +613,7 @@ int import_snapshots(struct pool *mem, struct volume_group *vg,
|
||||
}
|
||||
|
||||
/* we may have already added this snapshot */
|
||||
if (lv_is_cow(vg, cow))
|
||||
if (lv_is_cow(cow))
|
||||
continue;
|
||||
|
||||
/* insert the snapshot */
|
||||
|
@ -335,8 +335,8 @@ int lv_merge_segments(struct logical_volume *lv);
|
||||
/*
|
||||
* Useful functions for managing snapshots.
|
||||
*/
|
||||
int lv_is_origin(struct volume_group *vg, struct logical_volume *lv);
|
||||
int lv_is_cow(struct volume_group *vg, struct logical_volume *lv);
|
||||
int lv_is_origin(struct logical_volume *lv);
|
||||
int lv_is_cow(struct logical_volume *lv);
|
||||
|
||||
int vg_add_snapshot(struct volume_group *vg,
|
||||
struct logical_volume *origin,
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "metadata.h"
|
||||
#include "toolcontext.h"
|
||||
|
||||
int lv_is_origin(struct volume_group *vg, struct logical_volume *lv)
|
||||
int lv_is_origin(struct logical_volume *lv)
|
||||
{
|
||||
struct list *slh;
|
||||
struct snapshot *s;
|
||||
|
||||
list_iterate (slh, &vg->snapshots) {
|
||||
list_iterate (slh, &lv->vg->snapshots) {
|
||||
s = list_item(slh, struct snapshot_list)->snapshot;
|
||||
if (s->origin == lv)
|
||||
return 1;
|
||||
@ -22,12 +22,12 @@ int lv_is_origin(struct volume_group *vg, struct logical_volume *lv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lv_is_cow(struct volume_group *vg, struct logical_volume *lv)
|
||||
int lv_is_cow(struct logical_volume *lv)
|
||||
{
|
||||
struct list *slh;
|
||||
struct snapshot *s;
|
||||
|
||||
list_iterate (slh, &vg->snapshots) {
|
||||
list_iterate (slh, &lv->vg->snapshots) {
|
||||
s = list_item(slh, struct snapshot_list)->snapshot;
|
||||
if (s->cow == lv)
|
||||
return 1;
|
||||
@ -49,7 +49,7 @@ int vg_add_snapshot(struct volume_group *vg,
|
||||
/*
|
||||
* Is the cow device already being used ?
|
||||
*/
|
||||
if (lv_is_cow(vg, cow)) {
|
||||
if (lv_is_cow(cow)) {
|
||||
log_err("'%s' is already in use as a snapshot.", cow->name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,13 +67,13 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (lv_is_origin(lv->vg, lv)) {
|
||||
if (lv_is_origin(lv)) {
|
||||
log_error("Can't change logical volume \"%s\" under snapshot",
|
||||
lv->name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (lv_is_cow(lv->vg, lv)) {
|
||||
if (lv_is_cow(lv)) {
|
||||
log_error("Can't change snapshot logical volume \"%s\"",
|
||||
lv->name);
|
||||
return ECMD_FAILED;
|
||||
|
@ -44,7 +44,7 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv)
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (lv_is_origin(lv->vg, lv)) {
|
||||
if (lv_is_origin(lv)) {
|
||||
log_error("Can't remove logical volume \"%s\" under snapshot",
|
||||
lv->name);
|
||||
return ECMD_FAILED;
|
||||
|
@ -70,9 +70,9 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv)
|
||||
} else
|
||||
active_str = "inactive ";
|
||||
|
||||
if (lv_is_origin(lv->vg, lv))
|
||||
if (lv_is_origin(lv))
|
||||
snapshot_str = "Original";
|
||||
else if (lv_is_cow(lv->vg, lv))
|
||||
else if (lv_is_cow(lv))
|
||||
snapshot_str = "Snapshot";
|
||||
else
|
||||
snapshot_str = " ";
|
||||
|
Loading…
Reference in New Issue
Block a user