1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-26 22:50:36 +03:00

cleanup: more lv_is_ usage

This commit is contained in:
Zdenek Kabelac 2016-12-13 00:09:15 +01:00
parent 47b96c3537
commit a8f5e1f274
13 changed files with 17 additions and 18 deletions

View File

@ -510,7 +510,7 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg,
goto_out;
dm_list_iterate_items(ll, &vg->lvs) {
if (ll->lv->status & SNAPSHOT)
if (lv_is_snapshot(ll->lv))
continue;
if (!(lvdl = dm_pool_alloc(dl->mem, sizeof(*lvdl))))

View File

@ -56,7 +56,7 @@ static struct dm_hash_table *_create_lv_maps(struct dm_pool *mem,
}
dm_list_iterate_items(ll, &vg->lvs) {
if (ll->lv->status & SNAPSHOT)
if (lv_is_snapshot(ll->lv))
continue;
if (!(lvm = dm_pool_alloc(mem, sizeof(*lvm))))

View File

@ -267,7 +267,7 @@ int import_pool_segments(struct dm_list *lvs, struct dm_pool *mem,
dm_list_iterate_items(lvl, lvs) {
lv = lvl->lv;
if (lv->status & SNAPSHOT)
if (lv_is_snapshot(lv))
continue;
for (i = 0; i < subpools; i++) {

View File

@ -512,7 +512,7 @@ static int _read_segments(struct logical_volume *lv, const struct dm_config_node
count++;
}
/* FIXME Remove this restriction */
if ((lv->status & SNAPSHOT) && count > 1) {
if (lv_is_snapshot(lv) && count > 1) {
log_error("Only one segment permitted for snapshot");
return 0;
}

View File

@ -2651,7 +2651,7 @@ int lockd_lv_uses_lock(struct logical_volume *lv)
if (lv_is_cow(lv))
return 0;
if (lv->status & SNAPSHOT)
if (lv_is_snapshot(lv))
return 0;
/* FIXME: lv_is_virtual_origin ? */

View File

@ -971,7 +971,7 @@ int lv_mirror_image_in_sync(const struct logical_volume *lv)
struct lv_segment *seg = first_seg(lv);
struct lv_segment *mirror_seg;
if (!(lv->status & MIRROR_IMAGE) || !seg ||
if (!lv_is_mirror_image(lv) || !seg ||
!(mirror_seg = find_mirror_seg(seg))) {
log_error(INTERNAL_ERROR "Cannot find mirror segment.");
return 0;

View File

@ -1139,7 +1139,8 @@ int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
display_lvname(seg->lv), seg->le, area_num,
display_lvname(lv), le);
if (status & RAID_META) {
lv->status |= status;
if (lv_is_raid_metadata(lv)) {
seg->meta_areas[area_num].type = AREA_LV;
seg_metalv(seg, area_num) = lv;
if (le) {
@ -1152,7 +1153,6 @@ int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
seg_lv(seg, area_num) = lv;
seg_le(seg, area_num) = le;
}
lv->status |= status;
if (!add_seg_to_segs_using_this_lv(lv, seg))
return_0;
@ -4678,8 +4678,7 @@ static int _lvresize_check(struct logical_volume *lv,
if (lv_is_raid_image(lv) || lv_is_raid_metadata(lv)) {
log_error("Cannot resize a RAID %s directly",
(lv->status & RAID_IMAGE) ? "image" :
"metadata area");
lv_is_raid_image(lv) ? "image" : "metadata area");
return 0;
}

View File

@ -135,7 +135,7 @@ static int _lv_is_raid_with_tracking(const struct logical_volume *lv,
*tracking = NULL;
if (!(lv->status & RAID))
if (!lv_is_raid(lv))
return 0;
for (s = 0; s < seg->area_count; s++)

View File

@ -121,7 +121,7 @@ int lv_is_visible(const struct logical_volume *lv)
if (lv_is_historical(lv))
return 1;
if (lv->status & SNAPSHOT)
if (lv_is_snapshot(lv))
return 0;
if (lv_is_cow(lv)) {

View File

@ -2402,7 +2402,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
goto_out;
}
if (lvl->lv->status & SNAPSHOT)
if (lv_is_snapshot(lvl->lv))
continue;
/* Skip availability change for non-virt snaps when processing all LVs */

View File

@ -107,11 +107,11 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
lv = origin_from_cow(lv);
/* Only request activation of snapshot origin devices */
if ((lv->status & SNAPSHOT) || lv_is_cow(lv))
if (lv_is_snapshot(lv) || lv_is_cow(lv))
continue;
/* Only request activation of mirror LV */
if ((lv->status & MIRROR_IMAGE) || (lv->status & MIRROR_LOG))
if (lv_is_mirror_image(lv) || lv_is_mirror_log(lv))
continue;
/* Only request activation of the first replicator-dev LV */

View File

@ -97,7 +97,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
if (cmd->fmt->features & FMT_RESTRICTED_LVIDS) {
dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (lv->status & SNAPSHOT)
if (lv_is_snapshot(lv))
continue;
if (lvnum_from_lvid(&lv->lvid) < MAX_RESTRICTED_LVS)
continue;

View File

@ -112,7 +112,7 @@ static int _move_lvs(struct volume_group *vg_from, struct volume_group *vg_to)
dm_list_iterate_safe(lvh, lvht, &vg_from->lvs) {
lv = dm_list_item(lvh, struct lv_list)->lv;
if ((lv->status & SNAPSHOT))
if (lv_is_snapshot(lv))
continue;
if (lv_is_raid(lv))
@ -193,7 +193,7 @@ static int _move_snapshots(struct volume_group *vg_from,
dm_list_iterate_safe(lvh, lvht, &vg_from->lvs) {
lv = dm_list_item(lvh, struct lv_list)->lv;
if (!(lv->status & SNAPSHOT))
if (!lv_is_snapshot(lv))
continue;
dm_list_iterate_items(seg, &lv->segments) {