From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE7E5C43387 for ; Fri, 4 Jan 2019 13:45:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C82BD2070C for ; Fri, 4 Jan 2019 13:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbfADNpU (ORCPT ); Fri, 4 Jan 2019 08:45:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:41148 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725939AbfADNpU (ORCPT ); Fri, 4 Jan 2019 08:45:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5E2B1AEF5; Fri, 4 Jan 2019 13:45:19 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 263C7DA7CE; Fri, 4 Jan 2019 14:44:50 +0100 (CET) Date: Fri, 4 Jan 2019 14:44:49 +0100 From: David Sterba To: Greg Kroah-Hartman Cc: Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org Subject: Re: [PATCH] btrfs: no need to check return value of debugfs_create functions Message-ID: <20190104134449.GL23615@suse.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Greg Kroah-Hartman , Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org References: <20190104132520.GA22613@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190104132520.GA22613@kroah.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Jan 04, 2019 at 02:25:20PM +0100, Greg Kroah-Hartman wrote: > When calling debugfs functions, there is no need to ever check the > return value. The function can work or not, but the code logic should > never do something different based on this. > > Cc: Chris Mason > Cc: Josef Bacik > Cc: David Sterba > Cc: linux-btrfs@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman > --- > fs/btrfs/sysfs.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > Meta-comment, why is there a btrfs debugfs directory at all? All you > have here is a single "test" file that doesn't do anything except expose > a variable that never changes. What is this directory and single file > for? Can I just delete the whole thing? As explained in the commit that introduces the function (1bae30982bc86ab66d61ccb): Help during debugging to export various interesting infromation and tunables without the need of extra mount options or ioctls. Usage: * declare your variable in sysfs.h, and include where you need it * define the variable in sysfs.c and make it visible via debugfs_create_TYPE Depends on CONFIG_DEBUG_FS. It's there for developers, so don't delete it. Which also means the error code should be handled and not ignored. I can enhance the comment so it's explained in-place and not too tempting to remove it. This is not the first time somebody wants to remove it (https://lore.kernel.org/linux-btrfs/d6715b5b-0aa3-3032-43c6-eccd907a60b8@redhat.com/),