Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6219215rwi; Tue, 18 Oct 2022 09:30:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hpL8Np0hRCj2Pl8/jr7ogANfgV0iSrUoCdt5G5JWOqUnyj4uGiM2Oo9rg8zyBGguykjKW X-Received: by 2002:a05:6402:5291:b0:45c:3f6a:d4bc with SMTP id en17-20020a056402529100b0045c3f6ad4bcmr3367854edb.285.1666110600800; Tue, 18 Oct 2022 09:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666110600; cv=none; d=google.com; s=arc-20160816; b=TMjlBWz4tg1CDe/SZcHO1e6+9ys/YhiFFBrXaxQFOvpnsd3vnFAc3gNjix+1WTC0Su 2b2pfnLYZOhrBR4yB7cYLSh6QVKZoUmCiGD5M1e0VivnhV7Fn9AHYj0Ex8Ygd092TSf5 pQpwllCzpcXjEyxw/Lj9lwAhCmpa1rtH7at7y6MQcz9PdPKI/9hL0fUGTkzH8+X19dmV RPfUWwVM14sLvK4cA4bB+J5aSgKrPIMnaDyXhogkpMqrmdNObL4/SEK3pJWfy1ZyjbJ0 kwGoqRye5cenGBSpf8k/XARp6qM429zdSLoV9OuNTjXN90bKPe65h70ygvr8KkeLw7DL jSEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9umXzzWtQP5eYE7XZAmxOba2FRKQNp21/wLkLXTZbzI=; b=u/5S4R30VY6mXH0OyWRoduqfPxikux6C1Ffj/z4FMUg08tXcbr0Es141TzeHMCtYfl qaEwOKU177518jXRVtORZX933xKbrzqKV61ZvKIuuh1bvy44i1zyIqKXiE5UGk1lZdQd 2QaSYOB9D3VL8UpoX6UqTGTqIqOyUAfYojeBePmdgITrOzNdQjHP3qA7dBm0z1ivnrWw FTk+I8wCWSKvKWHgxv08gFkg+PYxvtL8vZ6esjZw2TZZozLzFMXoQm+/uxkhVDHO+ZPl /RrwpLLfXWi2Eul773OJCWs9vvO3yJ5q5KM4W+l/zG2eg2hnV2COVguySet/NuAAOePE yt4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=q+bre3PY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a056402518d00b0045e00384e8asi1818425edd.380.2022.10.18.09.29.35; Tue, 18 Oct 2022 09:30:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=q+bre3PY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbiJRPxR (ORCPT + 99 others); Tue, 18 Oct 2022 11:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbiJRPxO (ORCPT ); Tue, 18 Oct 2022 11:53:14 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E934D73D5; Tue, 18 Oct 2022 08:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9umXzzWtQP5eYE7XZAmxOba2FRKQNp21/wLkLXTZbzI=; b=q+bre3PY/IaynCNmu9+CDAXFPu 66x3n4XJAYUXU+noAFfIBD+b/V8CdP1uO1YiIt3cdRkxltS0VzeS5bqv6J/sxsLcRVmatWXpGCI7s Kt7o8tMivZVS9r5fEsjq1QHSaxKZC563F9VBvaDHqJ55WF+wpi2YB7Sih+R1Of/CsKqFrwTEDN1jR 2nltCkpsCduuEap77qlPXShT0C1lA7xAefbwdZOiKhbA9McLkJqbEPPggv8W3pRJvZWcCtHvhjwgn OcjmCHsUPKsj/6viOFKb9EClogeuhfggJovRw8+l3hKdylhC4f5MYmkOhcdf/qMAH/Btc+SwXM2eC lr5TAIHg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1okotL-0081B2-J8; Tue, 18 Oct 2022 15:52:31 +0000 Date: Tue, 18 Oct 2022 08:52:31 -0700 From: Christoph Hellwig To: Ye Bin Cc: axboe@kernel.dk, rostedt@goodmis.org, mhiramat@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] blktrace: introduce 'blk_trace_{start,stop}' helper Message-ID: References: <20221018145135.932240-1-yebin@huaweicloud.com> <20221018145135.932240-2-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221018145135.932240-2-yebin@huaweicloud.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int blk_trace_start(struct blk_trace *bt) > +{ > + /* > + * For starting a trace, we can transition from a setup or stopped > + * trace. > + */ That's pretty obvious from the check, isn't it? > + if (bt->trace_state == Blktrace_setup || > + bt->trace_state == Blktrace_stopped) { I'd invert the check and return early from the function for the error case so that the real starting code is in the main path. > +static int blk_trace_stop(struct blk_trace *bt) > +{ > + /* > + * For stopping a trace, the state must be running > + */ > + if (bt->trace_state == Blktrace_running) { The same two comments apply here as well.