On 02/02/23 at 07:17am, Lorenzo Stoakes wrote: > On Thu, Feb 02, 2023 at 11:20:07AM +0800, Baoquan He wrote: > > [snip] > > > > > + for_each_set_bitrange(rs, re, vb->used_map, VMAP_BBMAP_BITS) { > > > > + if (!count) > > > > + break; > > > > + start = vmap_block_vaddr(vb->va->va_start, rs); > > > > + while (addr < start) { > > > > + if (count == 0) > > > > + break; > > > > > > Bit pedantic, but you're using the `if (!count)` form of checking whether it's > > > zero above, but here you explicitly check it, would be good to keep both consistent. > > > > Yeah, sounds good. Will change. > > > > > > > > Given you're checking here, perhaps you could simply drop the previous check? > > > > Well, maybe no. The previous "if (!count)" is checking if count is 0 > > after the 'count -=n;' line at the end of the for_each loop. While this > > "if (count == 0)" is checking if count is 0 after 'count--;' at the end > > of while loop. Not sure if I got your point. > > You're right, sorry each break is for a different loop :) and I guess the inner > check is feeding the outer one so we're all good. Oh, the inner check and break only terminates the while loop, but it should jump to the 'spin_unlock(&vb->lock);' line too as the outer break does. I will fix this.