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

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to