From patchwork Tue Nov 26 11:41:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 3238891 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 9D47C9F3A0 for ; Tue, 26 Nov 2013 11:47:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74214203B6 for ; Tue, 26 Nov 2013 11:47:38 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 4E8A4203B5 for ; Tue, 26 Nov 2013 11:47:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAQBiNK2002533; Tue, 26 Nov 2013 06:44:59 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAQBfvha015280 for ; Tue, 26 Nov 2013 06:41:57 -0500 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAQBfvFm005736; Tue, 26 Nov 2013 06:41:57 -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 rAQBfu82029497; Tue, 26 Nov 2013 06:41:56 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3F728A7B62; Tue, 26 Nov 2013 12:41:56 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 26 Nov 2013 12:41:30 +0100 Message-Id: <1385466090-24290-10-git-send-email-hare@suse.de> In-Reply-To: <1385466090-24290-1-git-send-email-hare@suse.de> References: <1385466090-24290-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -6.9 (BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 9/9] 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 b57fa5d..67feb61 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1104,7 +1104,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; @@ -1113,10 +1113,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, @@ -1131,7 +1131,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 @@ -1139,7 +1139,7 @@ check_path (struct vectors * vecs, struct path * pp) */ if (newstate == PATH_PENDING) { pp->tick = 1; - return; + return 0; } /* * Synchronize with kernel state @@ -1177,7 +1177,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){ @@ -1262,6 +1262,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 * @@ -1284,6 +1285,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(); @@ -1292,7 +1298,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) { @@ -1308,6 +1314,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;