[Devel] [PATCH 3/3] blk-cbt: define NR_PAGES in terms of BITS_PER_PAGE

2023-01-31 Thread Nikolay Borisov
No point in having the open-coded PAGE_SIZE*8 when we already have an aptly named macro. Signed-off-by: Nikolay Borisov --- block/blk-cbt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-cbt.c b/block/blk-cbt.c index d49ca7fc2865..32485c793484 100644 --- a/bloc

[Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread Nikolay Borisov
Replace all shift rights/shift lefts by divide and multiply operations. I've checked that this doesn't generate worse assembly and that shifts are indeed continued to be used. PAGE_SHIFT + 3 is actually BITS_PER_PAGE and is a constant integer expression so the compiler is perfectly capable of figur

[Devel] [PATCH 2/3] blk-cbt: Don't disable interrupts when working with percpu cache

2023-01-31 Thread Nikolay Borisov
When working with percpu variables the only guarantee we need is that the process is not preempted. So let's do this by using the more idiomatic get_cpu_ptr/put_cpu_ptr rather than the more heavyweight local_irq_disable. No functional changes. Signed-off-by: Nikolay Borisov --- block/blk-cbt.c |

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread Alexander Atanasov
Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that this doesn't generate worse assembly and that shifts are indeed continued to be used. PAGE_SHIFT + 3 is actually BITS_PER_PAGE an

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread Alexander Atanasov
On 31.01.23 18:27, Alexander Atanasov wrote: Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that this doesn't generate worse assembly and that shifts are indeed continued to be use

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread nb
On 31.01.23 г. 19:08 ч., Alexander Atanasov wrote: On 31.01.23 18:27, Alexander Atanasov wrote: Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that this doesn't generate worse a

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread nb
On 31.01.23 г. 18:27 ч., Alexander Atanasov wrote: Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that this doesn't generate worse assembly and that shifts are indeed continued t

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread Alexander Atanasov
On 31.01.23 19:15, nb wrote: On 31.01.23 г. 19:08 ч., Alexander Atanasov wrote: On 31.01.23 18:27, Alexander Atanasov wrote: Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that

Re: [Devel] [PATCH 1/3] blk-cbt: Refactor cbt_find_next_extent for readability

2023-01-31 Thread Alexander Atanasov
On 31.01.23 19:18, nb wrote: On 31.01.23 г. 18:27 ч., Alexander Atanasov wrote: Hi, On 31.01.23 14:23, Nikolay Borisov wrote: Replace all shift rights/shift lefts by divide and multiply operations. What's wrong with shifts? I've checked that this doesn't generate worse assembly and that