[Devel] [PATCH RH9 v4 01/10] drivers/vhost: vhost-blk accelerator for virtio-blk guests
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Fri Nov 4 15:28:12 MSK 2022
On 11/4/22 14:31, Pavel Tikhomirov wrote:
>
>
> On 01.11.2022 10:25, Andrey Zhadchenko wrote:
>> +/* It is forbidden to call more than one vhost_blk_flush()
>> simultaneously */
>> +static void vhost_blk_flush(struct vhost_blk *blk)
>> +{
>> + int flush_bin;
>> +
>> + spin_lock(&blk->flush_lock);
>> + blk->during_flush = 1;
>> + flush_bin = blk->new_req_bin;
>> + blk->new_req_bin = (blk->new_req_bin) ? 0 : 1;
>
> We can use shorter and simpler expression for this:
>
> blk->new_req_bin = !blk->new_req_bin;
Are you sure C standard actually defines it this way and we are not
relying on unspecified behavior?
I thought ! operator only defined for logical expressions
>
>> + spin_unlock(&blk->flush_lock);
>
More information about the Devel
mailing list