lkml.org 
[lkml]   [2023]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 06/14] fs/ntfs3: rename bitmap_size() -> ntfs3_bitmap_size()
From
From: Yury Norov <yury.norov@gmail.com>
Date: Mon, 9 Oct 2023 09:50:15 -0700

> On Mon, Oct 09, 2023 at 05:10:18PM +0200, Alexander Lobakin wrote:
>> bitmap_size() is a pretty generic name and one may want to use it for

[...]

>> @@ -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);
>> }
>
> This looks like duplicating BITS_TO_U64(). If so, why not just switch
> to using the macro while you're here?

I thought that this

return BITS_TO_U64(bits) * sizeof(u64);

would give worse optimization, but actually

add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-32 (-32)

Nice, makes sense to do it.

>
>> 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

Thanks,
Olek

\
 
 \ /
  Last update: 2023-10-11 09:39    [W:0.108 / U:1.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site