Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2375107ioo; Sat, 28 May 2022 11:41:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGcpO7M4HIKcCtoQmod7EwCjt6xWKP23qqczcJgV6vbOkkVS4Wb+qTXrFfqeyiiAm5mfOj X-Received: by 2002:a17:90a:5d03:b0:1e0:90f5:3799 with SMTP id s3-20020a17090a5d0300b001e090f53799mr14611273pji.227.1653763287605; Sat, 28 May 2022 11:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653763287; cv=none; d=google.com; s=arc-20160816; b=w1GSU9jFWDcqEE8NscDjdH4xTU0CBgNjM2CzaOz/b2qgUbHCRz7NqQjmPxx/a7bLFL EU72JS2IPQa0rPZ8WcvqupaD5BuGDPtX5G92ZTPmribYenwXg2/MebcXrjHsdoXmbJJA rq6AkgdPh73mTJ1YtP2vNTYDibJ0XOJT0dDIy4VJhqurD6bdLBeYlzFkkYZP0LBGmgCA Ylv0RDThbsq2w07D7e7FQbqCI21Px6p0Umn6O6d1TteY/WZYORVC0z1nNt6i5HNtMvGy +kAt7R4mNJ+C4091Qzm021U7RH+V3HSLaU49fEjFm1/yF+oJUL6xjJSO2SCx0vNiTDhT jFmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=Xz/ptxTKTJCLxkr0IElwZvEFQqaNyWCnMwdRwRMPBtg=; b=CvtPZ11h3JRMtqjYATzJqzp5fyEtQ3qPfHzH9D6WeYXnlWuqLKuVngfXi4VYaN58uq eK5BSh6BS+YvghnrML7y5+znAiOqgLPJNABHTqB2PoDX3yzF4ar5E/6tS4HjOsTYYfOC Gbqw/naj2BaBndrODs73G1bveeQEG/stYRyPBAUeCBJiVI91HYjmduGihGHLY/d3z0BO Qq6MygfLMipsrkky9OI3Hxrm9+rIgvvEI91nysDBZWlYv50WIm7WQfiZ9zRpb4bx088N beE1hvpYTGqiLTOtaCdgJ+LIeSzWwHI7mW/8Tf+lKA/tNW/ZeuBtX7vXqyjgX6S+yG9H IUtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s21-20020a17090ae69500b001da3cfee1bdsi2510730pjy.25.2022.05.28.11.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:41:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 580A12A72E; Sat, 28 May 2022 11:34:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349059AbiE0QHi convert rfc822-to-8bit (ORCPT + 99 others); Fri, 27 May 2022 12:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235082AbiE0QHg (ORCPT ); Fri, 27 May 2022 12:07:36 -0400 Received: from relay4.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA10C3D0B for ; Fri, 27 May 2022 09:07:35 -0700 (PDT) Received: from omf14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 54528336CD; Fri, 27 May 2022 16:07:34 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id 39B3D32; Fri, 27 May 2022 16:07:33 +0000 (UTC) Message-ID: <94dd870e498e89e0998dee4dd0dbaaa4b4497929.camel@perches.com> Subject: Re: [PATCH 1/3] fs/ntfs3: Refactoring of indx_find function From: Joe Perches To: Almaz Alexandrovich , ntfs3@lists.linux.dev Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Date: Fri, 27 May 2022 09:07:30 -0700 In-Reply-To: <0f9648cc-66af-077c-88e6-8650fd78f44c@paragon-software.com> References: <75a1215a-eda2-d0dc-b962-0334356eef7c@paragon-software.com> <0f9648cc-66af-077c-88e6-8650fd78f44c@paragon-software.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.1-0ubuntu1 MIME-Version: 1.0 X-Stat-Signature: dckefw6kzm5u1pwrkyhcm45kktryhqqf X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: 39B3D32 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19VwBNuG8zVMoN9lOhktdWQ7gt5m/9IoJY= X-HE-Tag: 1653667653-438087 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 On Fri, 2022-05-27 at 17:21 +0300, Almaz Alexandrovich wrote: > This commit makes function a bit more readable trivia: > diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c [] > @@ -1042,19 +1042,16 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni, > { > int err; > struct NTFS_DE *e; > - const struct INDEX_HDR *hdr; > struct indx_node *node; > > if (!root) > root = indx_get_root(&ni->dir, ni, NULL, NULL); > > if (!root) { > - err = -EINVAL; > - goto out; > + /* Should not happed. */ > + return -EINVAL; s/happed/happen/ > for (;;) { > node = NULL; > if (*diff >= 0 || !de_has_vcn_ex(e)) { > *entry = e; > - goto out; > + return 0; > } might be nicer with a break; or a while like while (*diff < 0 && de_has_vcn_ex(e)) { node = NULL; > /* Read next level. */ > err = indx_read(indx, ni, de_get_vbn(e), &node); > if (err) > - goto out; > + return err; > > /* Lookup entry that is <= to the search value. */ > e = hdr_find_e(indx, &node->index->ihdr, key, key_len, ctx, > diff); > if (!e) { > - err = -EINVAL; > put_indx_node(node); > - goto out; > + return -EINVAL; > } > > fnd_push(fnd, node, e); > } > - > -out: > - return err; and a return 0; or *entry = e; return 0; so it appears that the function has a typical return value.