From patchwork Mon Nov 2 14:20:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zdenek Kabelac X-Patchwork-Id: 57027 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA2EKlOj029902 for ; Mon, 2 Nov 2009 14:20:51 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id F022B619DB7; Mon, 2 Nov 2009 09:20:41 -0500 (EST) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nA2EKaYG012334 for ; Mon, 2 Nov 2009 09:20:36 -0500 Received: from dhcp-0-185.brq.redhat.com (dhcp-0-185.brq.redhat.com [10.34.0.185]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA2EKYqR020017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Nov 2009 09:20:35 -0500 Received: from dhcp-0-185.brq.redhat.com (dhcp-0-185.brq.redhat.com [127.0.0.1]) by dhcp-0-185.brq.redhat.com (8.14.3/8.14.3) with ESMTP id nA2EKYAv008485; Mon, 2 Nov 2009 15:20:34 +0100 Received: (from kabi@localhost) by dhcp-0-185.brq.redhat.com (8.14.3/8.14.3/Submit) id nA2EKYTH008484; Mon, 2 Nov 2009 15:20:34 +0100 From: Zdenek Kabelac To: dm-devel@redhat.com Date: Mon, 2 Nov 2009 15:20:15 +0100 Message-Id: <1257171622-8380-12-git-send-email-zkabelac@redhat.com> In-Reply-To: <1257171622-8380-11-git-send-email-zkabelac@redhat.com> References: <1257171622-8380-1-git-send-email-zkabelac@redhat.com> <1257171622-8380-2-git-send-email-zkabelac@redhat.com> <1257171622-8380-3-git-send-email-zkabelac@redhat.com> <1257171622-8380-4-git-send-email-zkabelac@redhat.com> <1257171622-8380-5-git-send-email-zkabelac@redhat.com> <1257171622-8380-6-git-send-email-zkabelac@redhat.com> <1257171622-8380-7-git-send-email-zkabelac@redhat.com> <1257171622-8380-8-git-send-email-zkabelac@redhat.com> <1257171622-8380-9-git-send-email-zkabelac@redhat.com> <1257171622-8380-10-git-send-email-zkabelac@redhat.com> <1257171622-8380-11-git-send-email-zkabelac@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Zdenek Kabelac Subject: [dm-devel] [PATCH 11/18] Replicator: update _create_partial_dtree() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index a4ae9e0..1f1d645 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -731,6 +731,9 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi struct dm_list *snh, *snht; struct lv_segment *seg; uint32_t s; + struct replicator_device *rdev; + struct replicator_site *rsite; + const char *replicator_dlid; if (!(dtree = dm_tree_create())) { log_error("Partial dtree creation failed for %s.", lv->name); @@ -746,12 +749,34 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi goto_bad; /* Add any LVs used by segments in this LV */ - dm_list_iterate_items(seg, &lv->segments) + dm_list_iterate_items(seg, &lv->segments) { for (s = 0; s < seg->area_count; s++) if (seg_type(seg, s) == AREA_LV && seg_lv(seg, s)) { if (!_add_lv_to_dtree(dm, dtree, seg_lv(seg, s))) goto_bad; } + if (seg->replicator) { + /* Add all replicator-dev from same replicator */ + dm_list_iterate_items(rsite, &seg->replicator->rsites) { + dm_list_iterate_items(rdev, &rsite->rdevices) { + if (rsite->state == REPLICATOR_STATE_ACTIVE) { + if (!rdev->replicator_dev->lv) + goto_bad; + if (lv == rdev->replicator_dev->lv) + continue; + /* Add replicator-dev LV */ + if (!_add_lv_to_dtree(dm, dtree, rdev->replicator_dev->lv)) + goto_bad; + } + } + } + + if (!(replicator_dlid = build_dlid(dm, seg->replicator->lvid.s, NULL))) + goto_bad; + if (!dm_tree_set_replicator_suspend(dtree, replicator_dlid)) + goto_bad; + } + } return dtree;