mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cleanup: use dm_list_empty
Check for empty list directly.
This commit is contained in:
parent
8bd67f9e5a
commit
20187fc190
@ -430,7 +430,7 @@ int backup_to_file(const char *file, const char *desc, struct volume_group *vg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!dm_list_size(&tf->metadata_areas_in_use)) {
|
||||
if (dm_list_empty(&tf->metadata_areas_in_use)) {
|
||||
log_error(INTERNAL_ERROR "No in use metadata areas to write.");
|
||||
tf->fmt->ops->destroy_instance(tf);
|
||||
return 0;
|
||||
|
@ -2411,7 +2411,7 @@ int lv_add_segment(struct alloc_handle *ah,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((status & MIRROR_LOG) && dm_list_size(&lv->segments)) {
|
||||
if ((status & MIRROR_LOG) && !dm_list_empty(&lv->segments)) {
|
||||
log_error("Log segments can only be added to an empty LV");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
|
||||
* this means checking every VG by scanning every PV on the
|
||||
* system.
|
||||
*/
|
||||
if (pv && is_orphan(pv) && !dm_list_size(&pv->fid->metadata_areas_in_use)) {
|
||||
if (pv && is_orphan(pv) && dm_list_empty(&pv->fid->metadata_areas_in_use)) {
|
||||
free_pv_fid(pv);
|
||||
if (!scan_vgs_for_pvs(cmd, 0))
|
||||
return_0;
|
||||
@ -1831,7 +1831,7 @@ struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (is_orphan_vg(pv->vg_name) && !dm_list_size(&pv->fid->metadata_areas_in_use)) {
|
||||
if (is_orphan_vg(pv->vg_name) && dm_list_empty(&pv->fid->metadata_areas_in_use)) {
|
||||
/* If a PV has no MDAs - need to search all VGs for it */
|
||||
if (!scan_vgs_for_pvs(cmd, 1))
|
||||
goto_bad;
|
||||
@ -4527,7 +4527,7 @@ int mdas_empty_or_ignored(struct dm_list *mdas)
|
||||
{
|
||||
struct metadata_area *mda;
|
||||
|
||||
if (!dm_list_size(mdas))
|
||||
if (dm_list_empty(mdas))
|
||||
return 1;
|
||||
dm_list_iterate_items(mda, mdas) {
|
||||
if (mda_is_ignored(mda))
|
||||
|
@ -687,8 +687,8 @@ static int pvremove_check(struct cmd_context *cmd, const char *name,
|
||||
* means checking every VG by scanning every
|
||||
* PV on the system.
|
||||
*/
|
||||
if (is_orphan(pv) && !dm_list_size(&pv->fid->metadata_areas_in_use) &&
|
||||
!dm_list_size(&pv->fid->metadata_areas_ignored)) {
|
||||
if (is_orphan(pv) && dm_list_empty(&pv->fid->metadata_areas_in_use) &&
|
||||
dm_list_empty(&pv->fid->metadata_areas_ignored)) {
|
||||
if (!scan_vgs_for_pvs(cmd, 0)) {
|
||||
log_error("Rescan for PVs without metadata areas "
|
||||
"failed.");
|
||||
|
@ -770,7 +770,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
||||
* PV on the system.
|
||||
*/
|
||||
if (!scanned && is_orphan(pv) &&
|
||||
!dm_list_size(&pv->fid->metadata_areas_in_use)) {
|
||||
dm_list_empty(&pv->fid->metadata_areas_in_use)) {
|
||||
if (!scan_label_only &&
|
||||
!scan_vgs_for_pvs(cmd, 1)) {
|
||||
stack;
|
||||
|
Loading…
x
Reference in New Issue
Block a user