[PATCH] ext4: convert to DIV_ROUND_UP() in mpage_process_page_bufs()
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Mar 10 17:37:11 AEDT 2023
On 2023/3/10 14:35, Gao Xiang wrote:
>
>
> On 2023/3/10 14:27, Yangtao Li wrote:
>>> Please don't do this. This makes the code compile down to a division, which is
>>> far less efficient. I've verified this by checking the assembly generated.
>>
>> How much is the performance impact? So should the following be modified as shift operations as well?
>>
>> fs/erofs/namei.c:92: int head = 0, back = DIV_ROUND_UP(dir->i_size, EROFS_BLKSIZ) - 1;
>> fs/erofs/zmap.c:252: const unsigned int totalidx = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
>> fs/erofs/decompressor.c:14:#define LZ4_MAX_DISTANCE_PAGES (DIV_ROUND_UP(LZ4_DISTANCE_MAX, PAGE_SIZE) + 1)
>> fs/erofs/decompressor.c:56: DIV_ROUND_UP(distance, PAGE_SIZE) + 1 :
>> fs/erofs/decompressor.c:70: unsigned long bounced[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES,
>> fs/erofs/data.c:84: nblocks = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
>
> Please stop taking EROFS as example on ext4 patches
> and they will all be changed due to subpage support.
Here EROFS_BLKSIZ == PAGE_SIZE is a constant, so no difference
to use shift or division.
>
>>
>> Thx,
>> Yangtao
More information about the Linux-erofs
mailing list