Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1960511rdb; Mon, 9 Oct 2023 08:14:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQETwEYo+D8HdCcWjqLlWD8NUD90GRRe5IXdAIwFuXvC1vDo8IEy1Cb2BLCun3NlwCQst5 X-Received: by 2002:a17:902:ee41:b0:1bc:c82:9368 with SMTP id 1-20020a170902ee4100b001bc0c829368mr15336939plo.32.1696864454412; Mon, 09 Oct 2023 08:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696864454; cv=none; d=google.com; s=arc-20160816; b=PqzxKwndSdNOzSkQCyDlf0iR4//3DQi0EeaWV2eVSG0ZmKG17BWYU/dpArdOshWyko ohEGoosMHKb4GwmZMrgBBxBBzA8xvFdpdeCSgmwg+QLl3KbXAeA9FMfsQ/TjqSBBzA9D RhM2fUXh7Z7YIIgY2DDK53er2PAIyJhiLnKXoYPWhg/8/jFcIEiV6ITk5yG/WtAEyumB nyqSUjQb2H/AUa1rCx6npYZnYXUK5UfiYQMlAXjG5gqgXumTQUufzdc3wVzU89u32SO7 oy3IvVSIY9uwkzwLaXao4h6G0e7YPLIAehoexUQk8mRZDRxofmJJOgl11zlEp/nRHq4k nS0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uoz+K10w7pQ6DNU58hwrRrzgppsXSJqbfOK+X+HCmDg=; fh=2kCdHXvcAULJv/9f8X/O+IrT3ddiMaJJNnCkHNJ/OJY=; b=TO5uy/OTUiwGPElF7uoPYBPC8IQR43K5Cu41gmAstgHdISf0BGHk2oOJZGTjc6Xcwx mwZLkY0tXXsA8UeAUKkCRLzjHBqCQmINS+RCoe1BgEuwLsDmMIbbBObNENp6Hj7SJ9bu dWGEMq98rxXiROL7XuEolXP6y5WvP52JItN//bwd+f9lEmSn+mBKwFSCNnAV+mgDQjGc yIkofR/WdBnXKk6CqYtuUb4d97L74qAEDgOMKgAEm2SAEMRtK0F22yQ+FPYCvCVxPYoG ZfFQewN0eYkQqAw2F5MewuphzHz5JTOTENxzw2ruYQp5beiusNDnDBxbUqIxH61oXLQ1 c8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mbW6cRFp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q5-20020a170902dac500b001c6d1940305si10808043plx.532.2023.10.09.08.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mbW6cRFp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 47E8380236F8; Mon, 9 Oct 2023 08:14:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346639AbjJIPOJ (ORCPT + 99 others); Mon, 9 Oct 2023 11:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376495AbjJIPNp (ORCPT ); Mon, 9 Oct 2023 11:13:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4E1107; Mon, 9 Oct 2023 08:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696864412; x=1728400412; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bqgDsoa1BRXJuvxgsgl17/J0vD/b9uhc2mRnMLP/Gq4=; b=mbW6cRFpHRJGH5CaMUpvEQi2exvYxDRc1wOr7kYkXx/W02bqFCvm8LbN jiqSgufNJRGxJEkP0XZ0MVA1/KGXPspOODhJmHap7uJg40wne1bdwAjHs ufg1naMZC+GTPjRZUgAX0a/IQhm+/igIN3ZU+2W78b4OyuNnE43Wbo5+D a9c0dHvAQgnl5kaVi9v4ZXjahO6K4AOoM63WtfnKQvQmF41jvCLlw5qqp fjZBVxB1sRBdjRses2wuAN0duI2QNEPbkBRdsPaxNWFqP4Idz7dtG+omZ kelTXizJn/00n2U3N9b2S2Z1gnL9EQw8XJAxlgUKYu1C/TQ+2MN/rOhlz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="369232165" X-IronPort-AV: E=Sophos;i="6.03,210,1694761200"; d="scan'208";a="369232165" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 08:13:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="869288023" X-IronPort-AV: E=Sophos;i="6.03,210,1694761200"; d="scan'208";a="869288023" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmsmga002.fm.intel.com with ESMTP; 09 Oct 2023 08:13:22 -0700 From: Alexander Lobakin To: Yury Norov Cc: Alexander Lobakin , Andy Shevchenko , Rasmus Villemoes , Alexander Potapenko , Jakub Kicinski , Eric Dumazet , David Ahern , Przemek Kitszel , Simon Horman , netdev@vger.kernel.org, linux-btrfs@vger.kernel.org, dm-devel@redhat.com, ntfs3@lists.linux.dev, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/14] fs/ntfs3: rename bitmap_size() -> ntfs3_bitmap_size() Date: Mon, 9 Oct 2023 17:10:18 +0200 Message-ID: <20231009151026.66145-7-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009151026.66145-1-aleksander.lobakin@intel.com> References: <20231009151026.66145-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 08:14:13 -0700 (PDT) bitmap_size() is a pretty generic name and one may want to use it for a generic bitmap API function. At the same time, its logic is NTFS-specific, as it aligns to the sizeof(u64), not the sizeof(long) (although it uses ideologically right ALIGN() instead of division). Add the prefix 'ntfs3_' used for that FS (not just 'ntfs_' to not mix it with the legacy module). Reviewed-by: Przemek Kitszel Signed-off-by: Alexander Lobakin --- fs/ntfs3/bitmap.c | 4 ++-- fs/ntfs3/fsntfs.c | 2 +- fs/ntfs3/index.c | 11 ++++++----- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/super.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index 107e808e06ea..a2e18f13e93a 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -653,7 +653,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) wnd->total_zeroes = nbits; wnd->extent_max = MINUS_ONE_T; wnd->zone_bit = wnd->zone_end = 0; - wnd->nwnd = bytes_to_block(sb, bitmap_size(nbits)); + wnd->nwnd = bytes_to_block(sb, ntfs3_bitmap_size(nbits)); wnd->bits_last = nbits & (wbits - 1); if (!wnd->bits_last) wnd->bits_last = wbits; @@ -1345,7 +1345,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) return -EINVAL; /* Align to 8 byte boundary. */ - new_wnd = bytes_to_block(sb, bitmap_size(new_bits)); + new_wnd = bytes_to_block(sb, ntfs3_bitmap_size(new_bits)); new_last = new_bits & (wbits - 1); if (!new_last) new_last = wbits; diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 33afee0f5559..7a14d2347f27 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -522,7 +522,7 @@ static int ntfs_extend_mft(struct ntfs_sb_info *sbi) ni->mi.dirty = true; /* Step 2: Resize $MFT::BITMAP. */ - new_bitmap_bytes = bitmap_size(new_mft_total); + new_bitmap_bytes = ntfs3_bitmap_size(new_mft_total); err = attr_set_size(ni, ATTR_BITMAP, NULL, 0, &sbi->mft.bitmap.run, new_bitmap_bytes, &new_bitmap_bytes, true, NULL); diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 124c6e822623..ab53a4b6ddf8 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -1453,8 +1453,8 @@ static int indx_create_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, alloc->nres.valid_size = alloc->nres.data_size = cpu_to_le64(data_size); - err = ni_insert_resident(ni, bitmap_size(1), ATTR_BITMAP, in->name, - in->name_len, &bitmap, NULL, NULL); + err = ni_insert_resident(ni, ntfs3_bitmap_size(1), ATTR_BITMAP, + in->name, in->name_len, &bitmap, NULL, NULL); if (err) goto out2; @@ -1515,8 +1515,9 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, if (bmp) { /* Increase bitmap. */ err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len, - &indx->bitmap_run, bitmap_size(bit + 1), - NULL, true, NULL); + &indx->bitmap_run, + ntfs3_bitmap_size(bit + 1), NULL, true, + NULL); if (err) goto out1; } @@ -2089,7 +2090,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni, if (in->name == I30_NAME) ni->vfs_inode.i_size = new_data; - bpb = bitmap_size(bit); + bpb = ntfs3_bitmap_size(bit); if (bpb * 8 == nbits) return 0; diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 629403ede6e5..93333156aac6 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -961,7 +961,7 @@ static inline bool run_is_empty(struct runs_tree *run) } /* NTFS uses quad aligned bitmaps. */ -static inline size_t bitmap_size(size_t bits) +static inline size_t ntfs3_bitmap_size(size_t bits) { return ALIGN((bits + 7) >> 3, 8); } diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index cfec5e0c7f66..b1fb6efe7084 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1285,7 +1285,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) /* Check bitmap boundary. */ tt = sbi->used.bitmap.nbits; - if (inode->i_size < bitmap_size(tt)) { + if (inode->i_size < ntfs3_bitmap_size(tt)) { ntfs_err(sb, "$Bitmap is corrupted."); err = -EINVAL; goto put_inode_out; -- 2.41.0