Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1456991pxb; Fri, 27 Aug 2021 09:14:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyP2FYpkH8U/BGwDB9ZuhNzPSE2A4yRepwsxL4+7xRsEWUhoQmpAyRmrM9AEQ2vPePLrdv X-Received: by 2002:a5d:690b:: with SMTP id t11mr11131602wru.182.1630080883225; Fri, 27 Aug 2021 09:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630080883; cv=none; d=google.com; s=arc-20160816; b=BGFS84/ubdG3dY95vgcvX/BoOqaoC3DY0olRM1/9axHUchuQF2PKfhU1mCJK+WLr5C AuOZKVby2PM2VT+6nuaCbcT37xTfyFal5Z7jqXjmcA4vwHa9qX9e8LO4XVYFYztGryL5 YmBnwj6Lhj9CHD7us7AVy/8QH/sdevD9LYJzJdnIhWmdCFCF89LQJKMCptiYrbXRxT5g EY2QEYCbSiJVcf5ilSj6bJtDsm8gjXtKI5iIXkQc1DAphn5Gq1WM0lB0ltmasKy4V2vI rSadUvXYJmlj16cr8MeAemPW6nlC0xNUoiPBSBRx9fxv2kWjyKNEmUegc9Si9aVCpDXr 3tVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=nD33TNXGbeVwtfqT0HqayU2dyuRSJU6rquy3c3fui+A=; b=LHqQyBwSxLILUybPfFJiq+uL2mzUVKl1k0ifoeUu6Uuf/04W5LF2YVXRrNFpBgQchP ALp+rQHuRB9dOpwbS67bSA+M06JTgxqfDdyn6AepNimx4DRyB6C3UXwsh4AEVocQBXZ1 r2+CxlaBGKND5a8HIfLP8xEyCbdcHQ3w+ceocqfZ1UXUx5rYWUMJWshbdEnEAi7Q6V15 zodXiVetGZUGF2chNeMTo04jPFnW28MqVppev0bpwfJrqIe0DOr5fXEUklWSdOeTx6DY KPsNxrVxLIYiJIwixf7EgpF5nJ1CLS60R2cAC3Lrx5OM9cktPz429V2WUEwGLmUlUA4v i5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="WXcjg/KB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eg43si6254959edb.107.2021.08.27.09.14.12; Fri, 27 Aug 2021 09:14:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="WXcjg/KB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245501AbhH0QJ1 (ORCPT + 99 others); Fri, 27 Aug 2021 12:09:27 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:43506 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245500AbhH0QJZ (ORCPT ); Fri, 27 Aug 2021 12:09:25 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id 05F6782090; Fri, 27 Aug 2021 19:08:35 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1630080515; bh=nD33TNXGbeVwtfqT0HqayU2dyuRSJU6rquy3c3fui+A=; h=From:To:CC:Subject:Date:References:In-Reply-To; b=WXcjg/KBKuMlhtBAPGOOBYsOV3DS8S7ezzCfYPWuzGoKfg/uAxqk/j6XDWxTi92gS Q88/ng5/y4wgS3l7Z/TJ30APBleuNB+kPfKoTv2e/cKyQ6gFEV09VlCb9kHbkgQWky eNNHYBp5ViKVc38Rw/q1D0gmW7woL63GzEhNXQpg= Received: from vdlg-exch-02.paragon-software.com (172.30.1.105) 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.2176.2; Fri, 27 Aug 2021 19:08:34 +0300 Received: from vdlg-exch-02.paragon-software.com ([fe80::586:6d72:3fe5:bd9b]) by vdlg-exch-02.paragon-software.com ([fe80::586:6d72:3fe5:bd9b%12]) with mapi id 15.01.2176.009; Fri, 27 Aug 2021 19:08:34 +0300 From: Konstantin Komarov To: Kari Argillander , "ntfs3@lists.linux.dev" CC: "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" Subject: RE: [PATCH] fs/ntfs3: Use linux/log2 is_power_of_2 function Thread-Topic: [PATCH] fs/ntfs3: Use linux/log2 is_power_of_2 function Thread-Index: AQHXkorR1aO5dQA04k2VH8WfP//lc6uHllhQ Date: Fri, 27 Aug 2021 16:08:34 +0000 Message-ID: <215724bb79f24c7281731b6637fe7164@paragon-software.com> References: <20210816103732.177207-1-kari.argillander@gmail.com> In-Reply-To: <20210816103732.177207-1-kari.argillander@gmail.com> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.0.26] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Kari Argillander > Sent: Monday, August 16, 2021 1:38 PM > To: Konstantin Komarov ; ntfs3@= lists.linux.dev > Cc: Kari Argillander ; linux-kernel@vger.kern= el.org; linux-fsdevel@vger.kernel.org > Subject: [PATCH] fs/ntfs3: Use linux/log2 is_power_of_2 function >=20 > We do not need our own implementation for this function in this > driver. It is much better to use generic one. >=20 > Signed-off-by: Kari Argillander > --- > fs/ntfs3/ntfs_fs.h | 5 ----- > fs/ntfs3/run.c | 3 ++- > fs/ntfs3/super.c | 9 +++++---- > 3 files changed, 7 insertions(+), 10 deletions(-) >=20 > diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h > index 0c3ac89c3115..c8ea6dd38c21 100644 > --- a/fs/ntfs3/ntfs_fs.h > +++ b/fs/ntfs3/ntfs_fs.h > @@ -972,11 +972,6 @@ static inline struct buffer_head *ntfs_bread(struct = super_block *sb, > return NULL; > } >=20 > -static inline bool is_power_of2(size_t v) > -{ > - return v && !(v & (v - 1)); > -} > - > static inline struct ntfs_inode *ntfs_i(struct inode *inode) > { > return container_of(inode, struct ntfs_inode, vfs_inode); > diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c > index 5cdf6efe67e0..ce6bff3568df 100644 > --- a/fs/ntfs3/run.c > +++ b/fs/ntfs3/run.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include >=20 > #include "debug.h" > @@ -376,7 +377,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, C= LST lcn, CLST len, > if (!used) { > bytes =3D 64; > } else if (used <=3D 16 * PAGE_SIZE) { > - if (is_power_of2(run->allocated)) > + if (is_power_of_2(run->allocated)) > bytes =3D run->allocated << 1; > else > bytes =3D (size_t)1 > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 6be13e256c1a..c1b7127f5e61 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -735,13 +736,13 @@ static int ntfs_init_from_boot(struct super_block *= sb, u32 sector_size, >=20 > boot_sector_size =3D (u32)boot->bytes_per_sector[1] << 8; > if (boot->bytes_per_sector[0] || boot_sector_size < SECTOR_SIZE || > - !is_power_of2(boot_sector_size)) { > + !is_power_of_2(boot_sector_size)) { > goto out; > } >=20 > /* cluster size: 512, 1K, 2K, 4K, ... 2M */ > sct_per_clst =3D true_sectors_per_clst(boot); > - if (!is_power_of2(sct_per_clst)) > + if (!is_power_of_2(sct_per_clst)) > goto out; >=20 > mlcn =3D le64_to_cpu(boot->mft_clst); > @@ -757,14 +758,14 @@ static int ntfs_init_from_boot(struct super_block *= sb, u32 sector_size, > /* Check MFT record size */ > if ((boot->record_size < 0 && > SECTOR_SIZE > (2U << (-boot->record_size))) || > - (boot->record_size >=3D 0 && !is_power_of2(boot->record_size))) { > + (boot->record_size >=3D 0 && !is_power_of_2(boot->record_size))) { > goto out; > } >=20 > /* Check index record size */ > if ((boot->index_size < 0 && > SECTOR_SIZE > (2U << (-boot->index_size))) || > - (boot->index_size >=3D 0 && !is_power_of2(boot->index_size))) { > + (boot->index_size >=3D 0 && !is_power_of_2(boot->index_size))) { > goto out; > } >=20 > -- > 2.30.2 Hi Kari! Thanks for the patch, applied. Best regards.