Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3404755ybi; Sun, 26 May 2019 22:42:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK1guXvzbnfz1bXwtP0kv1ru5VkvmfdsGImYgLZF+4t94ebLc+xaOO7pe0thaAADmaMUHS X-Received: by 2002:a62:4e0c:: with SMTP id c12mr7947033pfb.17.1558935734797; Sun, 26 May 2019 22:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558935734; cv=none; d=google.com; s=arc-20160816; b=SZMjCIHFtGpVh9QpqBMapj20pLXXh2gzuRkyijTCr7V5Yd3021NywxlmTZuPfczXPw ei/WR1yKsyKs1ULF1qgf3Uv5eK/MxG/64XBEMpRiY5bjxSmEZPir3j2BClmhpHxUw58r r9gKJ3Xe2TXTyGkuV2eu+y+6u/yvAxUxLG9mAFBF1iJHPakHSDDz5sfkpf/kv7W4vdD9 SR1mEB9k0495kIoMN2BDX2gRoZ/WPdUck4mYj2fQbazqGObWAkzzNcQFazI4mA5LxbzH I/gFLWp5dOi9ws5dtnCaLqPaS9r4jQy1RS2n1bSr1z++bx1Yq7oZuXSEnZRxINgRpS+y /UYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:in-reply-to:references :subject:cc:to:from:date:message-id; bh=9WGymxmDQEplOqhxzZXqYYtMePSOZ9yhwQ7wATI8zhY=; b=Rbn+6cQx2wCTSlSdrRONFOMUaUiklCErb+ZHHv3z1k/TqQL+WiLisTBkZgRY0BjBeh /HSELF2dLi0I4hnP+pbDCBTuMbKNCoBudgH2t9eKyKL9ABxyQTM+8uv2QjOaM7kG2/SB ih89AkRzugj22tLjBcH1aBo1rQ3qQM/px6BBIzWpBvBzVMBo3GP3mGk9eQBjbVQivRq4 EryCVUGewY6lkHsJr2YZQXq2rVTCHwfYC+1QIeqpOhUlyKkoDajlhOKM5wb8QtyluJrN tcbfIlGSp5eXDDPh/NTWIREKgk4TY00De1YMUhZ1j2/WpAFY+9zvJ/mswu9kvCU4wxha XQng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13si16101122pgp.506.2019.05.26.22.41.59; Sun, 26 May 2019 22:42:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726087AbfE0Fk4 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 27 May 2019 01:40:56 -0400 Received: from prv1-mh.provo.novell.com ([137.65.248.33]:50692 "EHLO prv1-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbfE0Fkz (ORCPT ); Mon, 27 May 2019 01:40:55 -0400 Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Sun, 26 May 2019 23:40:54 -0600 Message-Id: <5CEB785F020000F900068371@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.1 Date: Sun, 26 May 2019 23:40:47 -0600 From: "Gang He" To: "Wengang" Cc: , , , , Subject: Re: [Ocfs2-devel] [PATCH V3 2/2] ocfs2: add locking filter debugfs file References: <20190523104047.14794-1-ghe@suse.com> <20190523104047.14794-2-ghe@suse.com> <5CE753AB020000F900067E5D@prv1-mh.provo.novell.com> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Wengang, Another patch will do the thing you mentioned. The patch link is here, https://marc.info/?l=ocfs2-devel&m=155860816602506&w=2 Thanks Gang >>> On 2019/5/25 at 3:52, in message , Wengang Wang wrote: > Hi Gang, > > OK, I was thinking you are dumping the new last access time field too. > > thanks, > wengang > > On 2019/5/23 19:15, Gang He wrote: >> Hello Wengang, >> >> This patch is used to add a filter attribute(the default value is 0), the > kernel module can use this attribute value to filter the lock resources > dumping. >> By default(the value is 0), the kernel module does not filter any lock > resources dumping, the behavior is like before. >> If the user set a value(N) of this attribute, the kernel module will only > dump the latest N seconds active lock resources, this will avoid dumping lots > of inactive lock resources. >> >> Thanks >> Gang >> >>>>> On 2019/5/24 at 0:43, in message >> , Wengang >> wrote: >>> Hi Gang, >>> >>> Could you paste an example of outputs before patch VS that after patch? >>> I think that would directly show what the patch does. >>> >>> thanks, >>> wengang >>> >>> On 05/23/2019 03:40 AM, Gang He wrote: >>>> Add locking filter debugfs file, which is used to filter lock >>>> resources dump from locking_state debugfs file. >>>> We use d_filter_secs field to filter lock resources dump, >>>> the default d_filter_secs(0) value filters nothing, >>>> otherwise, only dump the last N seconds active lock resources. >>>> This enhancement can avoid dumping lots of old records. >>>> The d_filter_secs value can be changed via locking_filter file. >>>> >>>> Compared with v2, ocfs2_dlm_init_debug() returns directly with >>>> error when creating locking filter debugfs file is failed, since >>>> ocfs2_dlm_shutdown_debug() will handle this failure perfectly. >>>> Compared with v1, the main change is to add CONFIG_OCFS2_FS_STATS >>>> macro definition judgment. >>>> >>>> Signed-off-by: Gang He >>>> Reviewed-by: Joseph Qi >>>> --- >>>> fs/ocfs2/dlmglue.c | 36 ++++++++++++++++++++++++++++++++++++ >>>> fs/ocfs2/ocfs2.h | 2 ++ >>>> 2 files changed, 38 insertions(+) >>>> >>>> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c >>>> index dccf4136f8c1..fbe4562cf4fe 100644 >>>> --- a/fs/ocfs2/dlmglue.c >>>> +++ b/fs/ocfs2/dlmglue.c >>>> @@ -3006,6 +3006,8 @@ struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void) >>>> kref_init(&dlm_debug->d_refcnt); >>>> INIT_LIST_HEAD(&dlm_debug->d_lockres_tracking); >>>> dlm_debug->d_locking_state = NULL; >>>> + dlm_debug->d_locking_filter = NULL; >>>> + dlm_debug->d_filter_secs = 0; >>>> out: >>>> return dlm_debug; >>>> } >>>> @@ -3104,11 +3106,33 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, >>> void *v) >>>> { >>>> int i; >>>> char *lvb; >>>> + u32 now, last = 0; >>>> struct ocfs2_lock_res *lockres = v; >>>> + struct ocfs2_dlm_debug *dlm_debug = >>>> + ((struct ocfs2_dlm_seq_priv *)m->private)->p_dlm_debug; >>>> >>>> if (!lockres) >>>> return -EINVAL; >>>> >>>> + if (dlm_debug->d_filter_secs) { >>>> + now = ktime_to_timespec(ktime_get()).tv_sec; >>>> +#ifdef CONFIG_OCFS2_FS_STATS >>>> + if (lockres->l_lock_prmode.ls_last > >>>> + lockres->l_lock_exmode.ls_last) >>>> + last = lockres->l_lock_prmode.ls_last; >>>> + else >>>> + last = lockres->l_lock_exmode.ls_last; >>>> +#endif >>>> + /* >>>> + * Use d_filter_secs field to filter lock resources dump, >>>> + * the default d_filter_secs(0) value filters nothing, >>>> + * otherwise, only dump the last N seconds active lock >>>> + * resources. >>>> + */ >>>> + if ((now - last) > dlm_debug->d_filter_secs) >>>> + return 0; >>>> + } >>>> + >>>> seq_printf(m, "0x%x\t", OCFS2_DLM_DEBUG_STR_VERSION); >>>> >>>> if (lockres->l_type == OCFS2_LOCK_TYPE_DENTRY) >>>> @@ -3258,6 +3282,17 @@ static int ocfs2_dlm_init_debug(struct ocfs2_super >>> *osb) >>>> goto out; >>>> } >>>> >>>> + dlm_debug->d_locking_filter = debugfs_create_u32("locking_filter", >>>> + 0600, >>>> + osb->osb_debug_root, >>>> + &dlm_debug->d_filter_secs); >>>> + if (!dlm_debug->d_locking_filter) { >>>> + ret = -EINVAL; >>>> + mlog(ML_ERROR, >>>> + "Unable to create locking filter debugfs file.\n"); >>>> + goto out; >>>> + } >>>> + >>>> ocfs2_get_dlm_debug(dlm_debug); >>>> out: >>>> return ret; >>>> @@ -3269,6 +3304,7 @@ static void ocfs2_dlm_shutdown_debug(struct >>> ocfs2_super *osb) >>>> >>>> if (dlm_debug) { >>>> debugfs_remove(dlm_debug->d_locking_state); >>>> + debugfs_remove(dlm_debug->d_locking_filter); >>>> ocfs2_put_dlm_debug(dlm_debug); >>>> } >>>> } >>>> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h >>>> index 8efa022684f4..f4da51099889 100644 >>>> --- a/fs/ocfs2/ocfs2.h >>>> +++ b/fs/ocfs2/ocfs2.h >>>> @@ -237,6 +237,8 @@ struct ocfs2_orphan_scan { >>>> struct ocfs2_dlm_debug { >>>> struct kref d_refcnt; >>>> struct dentry *d_locking_state; >>>> + struct dentry *d_locking_filter; >>>> + u32 d_filter_secs; >>>> struct list_head d_lockres_tracking; >>>> }; >>>>