From patchwork Fri Nov 15 10:29:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 3187661 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A02A29F492 for ; Fri, 15 Nov 2013 10:34:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A829207CF for ; Fri, 15 Nov 2013 10:34:21 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id 2DC9D207DE for ; Fri, 15 Nov 2013 10:34:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAFAVIl2027977; Fri, 15 Nov 2013 05:31:18 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAFAURKR018677 for ; Fri, 15 Nov 2013 05:30:27 -0500 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAFAUQ0t012187 for ; Fri, 15 Nov 2013 05:30:26 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAFAUPjM029948 for ; Fri, 15 Nov 2013 05:30:25 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 40D7EA79B0; Fri, 15 Nov 2013 11:30:25 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Fri, 15 Nov 2013 11:29:43 +0100 Message-Id: <1384511384-27642-13-git-send-email-hare@suse.de> In-Reply-To: <1384511384-27642-1-git-send-email-hare@suse.de> References: <1384511384-27642-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.3 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 12/13] multipathd: measure path check time X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instrument code to measure path check time. Signed-off-by: Hannes Reinecke --- multipathd/main.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index e5b061b..d386e0a 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1102,7 +1102,7 @@ int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh) return 0; } -void +int check_path (struct vectors * vecs, struct path * pp) { int newstate; @@ -1111,10 +1111,10 @@ check_path (struct vectors * vecs, struct path * pp) int oldchkrstate = pp->chkrstate; if (!pp->mpp) - return; + return 0; if (pp->tick && --pp->tick) - return; /* don't check this path yet */ + return 0; /* don't check this path yet */ /* * provision a next check soonest, @@ -1129,7 +1129,7 @@ check_path (struct vectors * vecs, struct path * pp) if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) { condlog(2, "%s: unusable path", pp->dev); pathinfo(pp, conf->hwtable, 0); - return; + return 1; } /* * Async IO in flight. Keep the previous path state @@ -1137,7 +1137,7 @@ check_path (struct vectors * vecs, struct path * pp) */ if (newstate == PATH_PENDING) { pp->tick = 1; - return; + return 0; } /* * Synchronize with kernel state @@ -1175,7 +1175,7 @@ check_path (struct vectors * vecs, struct path * pp) pp->mpp->failback_tick = 0; pp->mpp->stat_path_failures++; - return; + return 1; } if(newstate == PATH_UP || newstate == PATH_GHOST){ @@ -1260,6 +1260,7 @@ check_path (struct vectors * vecs, struct path * pp) (chkr_new_path_up && followover_should_failback(pp))) switch_pathgroup(pp->mpp); } + return 1; } static void * @@ -1282,6 +1283,11 @@ checkerloop (void *ap) } while (1) { + struct timeval diff_time, start_time, end_time; + int num_paths = 0; + + if (gettimeofday(&start_time, NULL) != 0) + start_time.tv_sec = 0; pthread_cleanup_push(cleanup_lock, &vecs->lock); lock(vecs->lock); pthread_testcancel(); @@ -1290,7 +1296,7 @@ checkerloop (void *ap) if (vecs->pathvec) { vector_foreach_slot (vecs->pathvec, pp, i) { - check_path(vecs, pp); + num_paths += check_path(vecs, pp); } } if (vecs->mpvec) { @@ -1306,6 +1312,14 @@ checkerloop (void *ap) } lock_cleanup_pop(vecs->lock); + if (start_time.tv_sec && + gettimeofday(&end_time, NULL) == 0 && + num_paths) { + timersub(&end_time, &start_time, &diff_time); + condlog(3, "checked %d path%s in %lu.%06lu secs", + num_paths, num_paths > 1 ? "s" : "", + diff_time.tv_sec, diff_time.tv_usec); + } sleep(1); } return NULL;