Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2440592ioo; Sat, 28 May 2022 13:47:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvI0fBO+8ndhxo1PKhxLiAxhWH7MZCfilvUcsuc2tjUIZlJWID6lILxdGP3mIGn5EfpYfd X-Received: by 2002:a17:903:208:b0:162:284:3396 with SMTP id r8-20020a170903020800b0016202843396mr39123752plh.121.1653770846609; Sat, 28 May 2022 13:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770846; cv=none; d=google.com; s=arc-20160816; b=dXcRxDtcvWgf5mFmFj+Rk11UEylJ/bG1k+jkZBvc/LLP359/V6b5jIhlrwbMgptcEo mIYvlte4KUQbEI/O0C0O/8FYWS3Qs/ozfQ/lkOPQN0rs8A4WLud9VncBJ9oY3ukED4/F CGgSXGo4p2W0Obai6vjMrJTgYOVMvmX9I5C87bQlf1ClhzIgVLNOw0O5q/Vm4wF5+QdU zP2JaBLPmGUfvLowqJRKj3LSaa8FqQbsEpgWRc7psYaj7NpD2LTnWd2vw1muplZ+33U8 +hTrOx++hN48GWj0i+HqxpLw8BnB2uY2SKbJrV4O2fHt53xpSssyjcZG+zDfROoqnih3 dALQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=XnC7aSAr5neGOTbasoTgRb0LT1HnKG7Qv+EzDQ/U96s=; b=U+FkJIOiyT6E8ExPfHQXOWbm5RiDbyfZk6DNbKcKXlniaJuZE8kOBdWCjrZWY03dVt Z8z5vU7+j4ap4b5A3q6Fzf3Zm1vu46EEsXLfyNpjLrYcVF6sKQJkkJuBXgCaCJA2N462 /JcGiGZrBbu1g/mxP0K+5v9trJWSVvwxACZvRLROEOXzS9mFUU/v3TGrTfJjHap8memQ Eg1Rdf0KGcdF3obAcHz0B7aeXBePotM+PPM3PtSWfTiY4+d6CK53lud6AerAym6JHZaz vUEBorOzGP8jK1YeSHeuEBILKCG1NS9XZaGxuBD7tF/rNx4Ki2X+mct4vXnsxuxHWKHt mnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=TJo2FR8X; dkim=pass header.i=@paragon-software.com header.s=mail header.b=XoYlcs8n; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q4-20020a17090311c400b0015eb18d825dsi12930345plh.461.2022.05.28.13.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:47:26 -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; dkim=pass header.i=@paragon-software.com header.s=mail header.b=TJo2FR8X; dkim=pass header.i=@paragon-software.com header.s=mail header.b=XoYlcs8n; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 86BA670372; Sat, 28 May 2022 12:54:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348747AbiE0OVJ (ORCPT + 99 others); Fri, 27 May 2022 10:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231825AbiE0OVI (ORCPT ); Fri, 27 May 2022 10:21:08 -0400 X-Greylist: delayed 341 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 27 May 2022 07:21:07 PDT Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC28106560; Fri, 27 May 2022 07:21:06 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id EACD52629; Fri, 27 May 2022 14:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1653661237; bh=XnC7aSAr5neGOTbasoTgRb0LT1HnKG7Qv+EzDQ/U96s=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=TJo2FR8XuGjp2J4EmDVyjwgKesMT1QCW38axW6Bg555bGml6FqTEzHGDpJU4Otbt7 f5iJ6T7UCq8+PqDA9gAyLh7tzVqXUw8IqAutKrMrZcTRdhFPvpbcAN5PogAz9zK0q8 mi/dK3fYOOOI/YNIejBMlQttPpQD/U06Ib6fNC/E= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 93361220E; Fri, 27 May 2022 14:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1653661264; bh=XnC7aSAr5neGOTbasoTgRb0LT1HnKG7Qv+EzDQ/U96s=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=XoYlcs8nM4kChSxxvHnaa/UCkpzr5vQ187tjOzeDwUdPbQZia6n1/keHbS5VOiz/N hkB6+5A9TlT5s7wkL3RN3zanV2X/sNeqzdGu/FtPJJkR9j5QSXepzjJurZvEQsZo/j 2e3sQHB1fR+V4nqIgxcKV8ub2JSYAHX1JFovNgHo= Received: from [172.30.8.65] (172.30.8.65) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 27 May 2022 17:21:04 +0300 Message-ID: <0f9648cc-66af-077c-88e6-8650fd78f44c@paragon-software.com> Date: Fri, 27 May 2022 17:21:03 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: [PATCH 1/3] fs/ntfs3: Refactoring of indx_find function Content-Language: en-US From: Almaz Alexandrovich To: CC: , References: <75a1215a-eda2-d0dc-b962-0334356eef7c@paragon-software.com> In-Reply-To: <75a1215a-eda2-d0dc-b962-0334356eef7c@paragon-software.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 This commit makes function a bit more readable Signed-off-by: Konstantin Komarov --- fs/ntfs3/index.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 6f81e3a49abf..511f872b6650 100644 --- 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; } - hdr = &root->ihdr; - /* Check cache. */ e = fnd->level ? fnd->de[fnd->level - 1] : fnd->root_de; if (e && !de_is_last(e) && @@ -1068,39 +1065,34 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni, fnd_clear(fnd); /* Lookup entry that is <= to the search value. */ - e = hdr_find_e(indx, hdr, key, key_len, ctx, diff); + e = hdr_find_e(indx, &root->ihdr, key, key_len, ctx, diff); if (!e) return -EINVAL; fnd->root_de = e; - err = 0; for (;;) { node = NULL; if (*diff >= 0 || !de_has_vcn_ex(e)) { *entry = e; - goto out; + return 0; } /* 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; } int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni, -- 2.36.1