<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi Joel,</div><div><br /></div><div>Thanks for your suggestion and i've sent a new patch for it.</div><div><br /></div><div>Thanks,</div><div>Xu<br /></div><br /><br /><br /><br /><div style="position:relative;zoom:1"></div><br /><pre><br />From: Joel Colledge <joel.colledge@linbit.com>
Date: 2022-05-03 16:37:28
To: Rui Xu <rui.xu@easystack.cn>
Cc: Philipp Reisner <philipp.reisner@linbit.com>,drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] [PATCH] drbd: change the variable ov_left to atomic>Hi Xu,
>
>Your analysis of the problem seems correct to me. Some details of the
>fix could be improved.
>
>In verify_progress() there are now 3 separate atomic operations. It
>would be better to use atomic64_dec_return() and then use the returned
>value instead of calling atomic64_read() separately. This could have
>minor effects on the behavior.
>
>Similarly, in receive_DataRequest() there is no need to read ov_left
>again after setting it. This should have no effect on the behavior,
>but leads to cleaner code.
>
>Also the repeated reads in finish_state_change() could be avoided for
>cleaner code. Take care of the read after set_ov_position(), since
>that changes the value of ov_left. You could use peer_device->rs_total
>instead of peer_device->ov_left there, since that is what it is set to
>in set_ov_position().
>
>Best regards,
>Joel
</pre></div><br>