Message ID | d39096b0-3bea-4044-9fdf-0decb1011ec4@paragon-software.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4169700vqy; Wed, 6 Dec 2023 07:11:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU4zPEuSH6D3CVvzHY6H1irT+HDWcGfmMDKgj3IxNxA8zvDIysXoWA0//2fheVvSPOlmbL X-Received: by 2002:a17:902:da83:b0:1d0:5ed4:4bf with SMTP id j3-20020a170902da8300b001d05ed404bfmr1210854plx.54.1701875465171; Wed, 06 Dec 2023 07:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701875465; cv=none; d=google.com; s=arc-20160816; b=tEGm5nPfusghMxlyTmdxQLbPvp2wIKirnIgamOpkhl8XS6me0NIBoRGhmSACF66G+n vhPqetlgxi8SWpiiIF/jgEJaA/7UdLwYE054On7I7ZvqmWP1ckmGYG4L6ZkKgqredxGs voUqe5OnEs5AHluA7SdHIMPH4MMiQZtDzUJitzbZF3s/fQIX4r/O6+G0eA/vlJN7WPmv JoNfIj8QZ1Tj4fkSqX6eljJyGKs+Oy85dyAy/eRpJqtjcH6M0Zz+6kI4i4j1soLr7NY5 6QYLXhAW7E3a1N4FtYUF37M4yUO9waP5tgYKp/Te8ZPBjHtdB374wt0z2kfFDLOE8uWL YATQ== 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; bh=/GAY4vh49Ey49PjOB0D7aW4BJClWKFEVXZZb9RVpvm8=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=WBOgke/osX4EjJmpY2Vk+zBDsxBkuwxa1e3UkULv9RQnxaeGRR0s8GrjYoATwT3A+W WIcSNXnstZr5mHV02Zc46LcWqCNNkRbtY5jrxbjrTjgw71gsf2f+SXz/oOToX5xLuibL f3MEh4/NxYS+fVgn+E9mgi8tySxwi+V3A5hmtMmIThqTF7VjUZARPDIk/JpdMpTeBhzh fht9tfsRZSiLUrbFLrcMn6+U5Eh5hhwAAllUqFxKMfDLZMbKZYJIVAIYCRGlLtS1VypX veybmpkMqkMw9e05ENj2/AfXTTcge6fMAwxfG4w0syX7rGAAxiMgLeyk6EFD1aGwJt4h 7SKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=bV1feHdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id w8-20020a170902904800b001cfd4c10e47si11364995plz.8.2023.12.06.07.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 07:11:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=bV1feHdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 927D38096D8A; Wed, 6 Dec 2023 07:10:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442459AbjLFPK1 (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 6 Dec 2023 10:10:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442448AbjLFPKV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 6 Dec 2023 10:10:21 -0500 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31BBADE; Wed, 6 Dec 2023 07:10:27 -0800 (PST) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id D92B11E1A; Wed, 6 Dec 2023 15:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1701875040; bh=/GAY4vh49Ey49PjOB0D7aW4BJClWKFEVXZZb9RVpvm8=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=bV1feHdOoc85vxuNTcRIuuIj4OKvvVliIheZoWfeIjMagZtKTIExoG1tZP5GKcmcC 2Xm3LxPkbcoWDpxWt3fxCzNeybO3lNj/Zk/uh1gmH2/1enCbGpFcHF7wyUjchAGCIv 2RCP2b2+LXWKnHQCqKpaT1lY7nUqnYMKO5UJM8XU= Received: from [172.16.192.129] (192.168.211.144) 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; Wed, 6 Dec 2023 18:10:24 +0300 Message-ID: <d39096b0-3bea-4044-9fdf-0decb1011ec4@paragon-software.com> Date: Wed, 6 Dec 2023 18:10:24 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 03/16] fs/ntfs3: Improve ntfs_dir_count Content-Language: en-US From: Konstantin Komarovc <almaz.alexandrovich@paragon-software.com> To: <ntfs3@lists.linux.dev> CC: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org> References: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> In-Reply-To: <00fd1558-fda5-421b-be43-7de69e32cb4e@paragon-software.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.211.144] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 06 Dec 2023 07:10:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784545767350775436 X-GMAIL-MSGID: 1784545767350775436 |
Series |
fs/ntfs3: Bugfix and refactoring
|
|
Commit Message
Konstantin Komarov
Dec. 6, 2023, 3:10 p.m. UTC
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
fs/ntfs3/dir.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
*is_empty = true;
@@ -563,7 +561,7 @@ static int ntfs_dir_count(struct inode *dir, bool
*is_empty, size_t *dirs,
fles += 1;
}
- if (vbo >= i_size)
+ if (bit >= max_indx)
goto out;
err = indx_used_bit(&ni->dir, ni, &bit);
@@ -573,8 +571,7 @@ static int ntfs_dir_count(struct inode *dir, bool
*is_empty, size_t *dirs,
if (bit == MINUS_ONE_T)
goto out;
- vbo = (u64)bit << index_bits;
- if (vbo >= i_size)
+ if (bit >= max_indx)
goto out;
err = indx_read(&ni->dir, ni, bit << ni->dir.idx2vbn_bits,
@@ -584,7 +581,6 @@ static int ntfs_dir_count(struct inode *dir, bool
*is_empty, size_t *dirs,
hdr = &node->index->ihdr;
bit += 1;
- vbo = (u64)bit << ni->dir.idx2vbn_bits;
}
out:
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index 22ede4da0450..726122ecd39b 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -515,11 +515,9 @@ static int ntfs_dir_count(struct inode *dir, bool *is_empty, size_t *dirs, struct INDEX_HDR *hdr; const struct ATTR_FILE_NAME *fname; u32 e_size, off, end; - u64 vbo = 0; size_t drs = 0, fles = 0, bit = 0; - loff_t i_size = ni->vfs_inode.i_size; struct indx_node *node = NULL; - u8 index_bits = ni->dir.index_bits; + size_t max_indx = ni->vfs_inode.i_size >> ni->dir.index_bits; if (is_empty)