From: Yury Norov <yury.norov@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com,
vneethv@linux.ibm.com, oberpar@linux.ibm.com, hca@linux.ibm.com,
gor@linux.ibm.com, agordeev@linux.ibm.com,
borntraeger@linux.ibm.com, svens@linux.ibm.com,
almaz.alexandrovich@paragon-software.com,
andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk,
linux-s390@vger.kernel.org, ntfs3@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/4] fs/ntfs3: Rename bitmap_size() as ntfs3_bitmap_size()
Date: Sat, 2 Jul 2022 13:57:54 -0700 [thread overview]
Message-ID: <YsCxUrTKd1N4aVoJ@yury-laptop> (raw)
In-Reply-To: <56a3cb896ec446ca24e4756042d9f0829afc671a.1656785856.git.christophe.jaillet@wanadoo.fr>
On Sat, Jul 02, 2022 at 08:29:27PM +0200, Christophe JAILLET wrote:
> In order to introduce a bitmap_size() function in the bitmap API, we have
> to rename functions with a similar name.
>
> Add a "ntfs3_" prefix and change bitmap_size() into ntfs3_bitmap_size().
>
> No functional change.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> fs/ntfs3/bitmap.c | 4 ++--
> fs/ntfs3/fsntfs.c | 2 +-
> fs/ntfs3/index.c | 6 +++---
> fs/ntfs3/ntfs_fs.h | 2 +-
> fs/ntfs3/super.c | 2 +-
> 5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
> index e3b5680fd516..f98327453d83 100644
> --- a/fs/ntfs3/bitmap.c
> +++ b/fs/ntfs3/bitmap.c
> @@ -661,7 +661,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;
> @@ -1323,7 +1323,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 3de5700a9b83..9c74d88ce0f0 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -493,7 +493,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 84ccc1409874..5c5ea05a5ef1 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c
> @@ -1353,7 +1353,7 @@ 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,
> + err = ni_insert_resident(ni, ntfs3_bitmap_size(1), ATTR_BITMAP, in->name,
> in->name_len, &bitmap, NULL, NULL);
> if (err)
> goto out2;
> @@ -1415,7 +1415,7 @@ 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),
> + &indx->bitmap_run, ntfs3_bitmap_size(bit + 1),
> NULL, true, NULL);
> if (err)
> goto out1;
> @@ -1973,7 +1973,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni,
> if (err)
> return err;
>
> - 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 55d686e3c4ec..85210e610a3a 100644
> --- a/fs/ntfs3/ntfs_fs.h
> +++ b/fs/ntfs3/ntfs_fs.h
> @@ -945,7 +945,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);
> }
Here everything looks OK for me. NTFS3 has their own good reasons
to reserve 64-bit words for their bitmaps, and they need their own
functions for this. And the prefix looks OK because it underlines
that this is a local story.
Maybe we can turn it into BITS_TO_LLONGS() and put into
include/linux/bitops.h... But unless we have another subsystem that
needs it, I'm OK with current approach.
Acked-by: Yury Norov <yury.norov@gmail.com>
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index b41d7c824a50..7d48f886ac82 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -1101,7 +1101,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)) {
> err = -EINVAL;
> goto put_inode_out;
> }
> --
> 2.34.1
next prev parent reply other threads:[~2022-07-02 20:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-02 18:28 [PATCH 0/4] Introduce bitmap_size() Christophe JAILLET
2022-07-02 18:29 ` [PATCH 1/4] s390/cio: Rename bitmap_size() as idset_bitmap_size() Christophe JAILLET
2022-07-02 18:54 ` Andy Shevchenko
2022-07-02 19:24 ` Christophe JAILLET
2022-07-02 19:32 ` Andy Shevchenko
2022-07-02 19:42 ` Christophe JAILLET
2022-07-02 20:46 ` Yury Norov
2022-07-04 4:28 ` Vineeth Vijayan
2022-07-02 18:29 ` [PATCH 2/4] fs/ntfs3: Rename bitmap_size() as ntfs3_bitmap_size() Christophe JAILLET
2022-07-02 18:58 ` Andy Shevchenko
2022-07-02 19:37 ` Christophe JAILLET
2022-07-02 20:57 ` Yury Norov [this message]
2022-07-02 18:29 ` [PATCH 3/4] bitmap: Introduce bitmap_size() Christophe JAILLET
2022-07-02 18:59 ` Andy Shevchenko
2022-07-02 21:09 ` Yury Norov
2022-07-03 6:50 ` Christophe JAILLET
2022-07-03 15:20 ` Andy Shevchenko
2022-07-03 19:13 ` Yury Norov
2022-07-03 20:41 ` Christophe JAILLET
2022-07-02 18:29 ` [PATCH 4/4] bitmap: Use bitmap_size() Christophe JAILLET
2022-07-02 20:44 ` [PATCH 0/4] Introduce bitmap_size() Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YsCxUrTKd1N4aVoJ@yury-laptop \
--to=yury.norov@gmail.com \
--cc=agk@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=borntraeger@linux.ibm.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dm-devel@redhat.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=ntfs3@lists.linux.dev \
--cc=oberpar@linux.ibm.com \
--cc=snitzer@kernel.org \
--cc=svens@linux.ibm.com \
--cc=vneethv@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).