1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

snapshot: skip monitor for large cows

If snapshot cow device is already big enough to
cover whole origin, do not monitor it.
This commit is contained in:
Zdenek Kabelac 2013-05-27 10:20:06 +02:00
parent 77952151af
commit 9966842810
3 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Skip monitoring of snapshots that are already bigger then origin.
Add lv_is_cow_covering_origin() to check if cow covers origin size.
Use libdm dm_get_status_snapshot() to parse snapshot status.
Add detection of mounted fs also for vgchange deactivation.

View File

@ -1456,6 +1456,13 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}
/* Do not monitor snapshot that already covers origin */
if (monitor && lv_is_cow_covering_origin(lv)) {
log_debug_activation("Skipping monitor of snapshot larger "
"then origin %s.", lv->name);
return 1;
}
/*
* In case of a snapshot device, we monitor lv->snapshot->lv,
* not the actual LV itself.

View File

@ -148,6 +148,8 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
// log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));
if (!segm->segtype->ops->target_monitored)
/* Nothing to do, monitoring not supported */;
else if (lv_is_cow_covering_origin(seg->lv))
/* Nothing to do, snapshot already covers origin */;
else if (!seg_monitored(segm) || (segm->status & PVMOVE))
s = "not monitored";
else if (lv_info(seg->lv->vg->cmd, seg->lv, 1, &info, 0, 0) && info.exists) {