From patchwork Tue Jun 16 14:47:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 6618821 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 22D629F1C1 for ; Tue, 16 Jun 2015 14:49:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45200207DF for ; Tue, 16 Jun 2015 14:49:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 384EB207DC for ; Tue, 16 Jun 2015 14:49:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754639AbbFPOtI (ORCPT ); Tue, 16 Jun 2015 10:49:08 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33975 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756628AbbFPOtH (ORCPT ); Tue, 16 Jun 2015 10:49:07 -0400 Received: by pacgb13 with SMTP id gb13so14272385pac.1 for ; Tue, 16 Jun 2015 07:49:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ilSijAHzx7grUUMQRT01PVK8jnWJvImZSwK7uE814DI=; b=Rh+MStmEUlpp5gytnInF8dLD1j6U7tvhiUrmGMmSYNySBAqA0ZYG42CCdAy8/vhMtv DGTkoXCWXXMIQlxvQjQO5+0MU1SvsVyExHZ1tEvBulBoF7BhptTik/F38x//fgtgDPCX 21KA4GmCOP4E7cdjpL+zf6RbRVFyLndiNf2Hvh120wjHIXlbAAJz76AC66lu+RnE73+8 3mZlPnp+vSMVcaqujVa237nwxoHNSNNbduryaVc6B9iRw13OJe5sIoFTwtGYf2juiJ3D OedLlsxYAqU456rSWsH5t9JTAAWjq5YRvN/A4s7nDgKXnNRK0wLuuaNjaIawe5GlAs68 G/KA== X-Gm-Message-State: ALoCoQnNX4aonYAAbvmKK1wO1XVXWs6i1Bj2mRWp2j+Ro7Eq3i3fXgtwaWACnl8NgvhbxmZGlJkX X-Received: by 10.68.65.102 with SMTP id w6mr1422644pbs.10.1434466147081; Tue, 16 Jun 2015 07:49:07 -0700 (PDT) Received: from lear.localdomain (ec2-54-65-164-9.ap-northeast-1.compute.amazonaws.com. [54.65.164.9]) by mx.google.com with ESMTPSA id wa4sm1698677pab.17.2015.06.16.07.49.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2015 07:49:06 -0700 (PDT) From: Peng Tao To: linux-nfs Cc: Peng Tao Subject: [PATCH 06/11] pNFS/flexfiles: track when layout is first used Date: Tue, 16 Jun 2015 22:47:27 +0800 Message-Id: <1434466052-10491-7-git-send-email-tao.peng@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1434466052-10491-1-git-send-email-tao.peng@primarydata.com> References: <1434466052-10491-1-git-send-email-tao.peng@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 So that we can report cumulative time since the beginning of statistics collection of the layout. Signed-off-by: Peng Tao --- fs/nfs/flexfilelayout/flexfilelayout.c | 10 +++++++--- fs/nfs/flexfilelayout/flexfilelayout.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index acbe677..42f79c6 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -453,9 +453,13 @@ nfs4_ff_layout_calc_completion_time(struct rpc_task *task) } static void -nfs4_ff_layoutstat_start_io(struct nfs4_ff_layoutstat *layoutstat) +nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, + struct nfs4_ff_layoutstat *layoutstat) { + static const ktime_t notime = {0}; + nfs4_ff_start_busy_timer(&layoutstat->busy_timer); + cmpxchg(&mirror->start_time, notime, ktime_get()); } static void @@ -493,7 +497,7 @@ nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror, __u64 requested) { spin_lock(&mirror->lock); - nfs4_ff_layoutstat_start_io(&mirror->read_stat); + nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat); nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); spin_unlock(&mirror->lock); } @@ -516,7 +520,7 @@ nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror, __u64 requested) { spin_lock(&mirror->lock); - nfs4_ff_layoutstat_start_io(&mirror->write_stat); + nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat); nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); spin_unlock(&mirror->lock); } diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h index f7493f7..0e7366f 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.h +++ b/fs/nfs/flexfilelayout/flexfilelayout.h @@ -74,6 +74,7 @@ struct nfs4_ff_layout_mirror { spinlock_t lock; struct nfs4_ff_layoutstat read_stat; struct nfs4_ff_layoutstat write_stat; + ktime_t start_time; }; struct nfs4_ff_layout_segment {