Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp621816pxb; Tue, 2 Feb 2021 13:29:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkVHrHFk8ot4BQq3ixKwSc+2r+XME7Y1OaL3PgYABuSOsMImjrSdvMqRxXEgWudh9DlAPw X-Received: by 2002:a17:906:b217:: with SMTP id p23mr5242ejz.126.1612301342236; Tue, 02 Feb 2021 13:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612301342; cv=none; d=google.com; s=arc-20160816; b=P/BeB0T8sy/luz7Cs3zI3lqIsUPdSAjgS0JIBIeZzgfZf6vYIClroUCf9Gxo1+2NAC ag7UWe4B+QfptH1uo0y6vE5ttRV9Lld1wbmUgvAFZ4Mv6TjC3fHI6gLFjg70HXIdEc9O Ud6jpJ92HtAcRWocb/6xgU+3iUr/NDEAJ+WNC4WWvMJBS/SQxlkixSR2PGcJ2MT5AF4x dPIqSE9seRoTKKwzR2tOBv2JQLS+oxT/IlQPY8w080mKHJPC5bMbB7rfRdaUr9MHcKFv iHRVzOG7eeaVtTlePaz9EY/TrEiGgr5a/1lSE9l7d0Br2ozG+QjBzECKUxScNOLLfLTY 17+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=+i28XBtp7s4u5MHeHuTFzqTe9Xz7oyBpBVqBDirYg00=; b=VRzU32AJywhp4n8/XijAgGIftvKa/BSIX1uBdWglMGSZDiCpMoaP5yIYWnfy6nLjKO UmhV4ArL4oMBEqgE+KeybknRkAYuZn4p9zTvF6RbamNzmguenSM5Iez7axAWCTLEqHzJ svaQffPh11JQoLlXNffs5hg+HP0lcU2CHMIOAU8bvKkUTJXp8+d5oYafSOow666SMcal bC/BlxYbBym9EdgvaLjJ3LrCGSsWCb0xkM4NhHjgQ1IwD7327E/hmyT6nVVC+XAkZGAD AuR47J+aPR77EBNJ11p2xYrLWiWiMWvQM+jOgZvLdl6BmJRf1foN7E74V8esFtTxoN1p dnPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iKlS6sT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si12272641edd.134.2021.02.02.13.28.37; Tue, 02 Feb 2021 13:29:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iKlS6sT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231389AbhBBMsT (ORCPT + 99 others); Tue, 2 Feb 2021 07:48:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:49896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbhBBMpq (ORCPT ); Tue, 2 Feb 2021 07:45:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EED7A64F45; Tue, 2 Feb 2021 12:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612269905; bh=6HA5I9g54CWrnRgluc9jlCXT97+bsnUCbtvbzOw3A1s=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iKlS6sT8hoWT/xzA4jWsdm6Q2yM/2gkw92EXQ8XN7o21TV8e9xRJCPBY5TFENSpIV 7wUxffoUHCECK6QtPmCtYJVNqsGCNaRgKmE72Zl0fKXhC1rEImwQlVYG8x1z+6q21i H5+LW9EW0i1Luudlf5B68ptEsTR2vQX5eV/6+zb4J6z49C051Fj16P1821LGIgVKt+ MdcyzK7YAmBfvTGwRLV1kW2rWoD9Aoifn3Bu6k5LIpgBHM+sC938en4ww//asb4Fpx QTvDI5kRSv42O65NBKUQZb/C+pXy9g2LhCtm7tInaTenOq7IzgTtkp7W0djjxuT+zT dHj+MfsC9Erog== Message-ID: Subject: Re: [PATCH] ceph: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE From: Jeff Layton To: Ilya Dryomov , Jiapeng Chong Cc: Ceph Development , LKML Date: Tue, 02 Feb 2021 07:45:03 -0500 In-Reply-To: References: <1612165930-110076-1-git-send-email-jiapeng.chong@linux.alibaba.com> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.38.3 (3.38.3-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-02-02 at 13:07 +0100, Ilya Dryomov wrote: > On Mon, Feb 1, 2021 at 8:52 AM Jiapeng Chong > wrote: > > > > Fix the following coccicheck warning: > > > > ./fs/ceph/debugfs.c:347:0-23: WARNING: congestion_kb_fops should be > > defined with DEFINE_DEBUGFS_ATTRIBUTE. > > > > Reported-by: Abaci Robot > > Signed-off-by: Jiapeng Chong > > --- > > ?fs/ceph/debugfs.c | 4 ++-- > > ?1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c > > index 66989c8..617327e 100644 > > --- a/fs/ceph/debugfs.c > > +++ b/fs/ceph/debugfs.c > > @@ -344,8 +344,8 @@ static int congestion_kb_get(void *data, u64 *val) > > ????????return 0; > > ?} > > > > -DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get, > > - congestion_kb_set, "%llu\n"); > > +DEFINE_DEBUGFS_ATTRIBUTE(congestion_kb_fops, congestion_kb_get, > > + congestion_kb_set, "%llu\n"); > > > > > > ?void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) > > Hi Jiapeng, > > What is the benefit of this conversion? > > From a quick look, with DEFINE_DEBUGFS_ATTRIBUTE writeback_congestion_kb > file would no longer be seekable. It may not matter much, but something > that should have been mentioned. > > Futher, debugfs_create_file() creates a full proxy for fops, protecting > against removal races. DEFINE_DEBUGFS_ATTRIBUTE adds its own protection > but just for ->read() and ->write(). I don't think we need both. > The coccinelle script clarifies some of this. See the commit log here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5103068eaca290f890a30aae70085fac44cecaf6 That said, it also mentions that the file should be converted to use debugfs_create_file_unsafe now as well, and that wasn't done in this patch. Jiapeng, was that intentional? If so, why? -- Jeff Layton