[Drbd-dev] [PATCH] drbd: change the variable ov_left to atomic

rui.xu rui.xu at easystack.cn
Sat May 7 10:27:48 CEST 2022


Hi Joel,


Thanks for your suggestion and i've sent a new patch for it.


Thanks,
Xu








From: Joel Colledge <joel.colledge at linbit.com>
Date: 2022-05-03 16:37:28
To:  Rui Xu <rui.xu at easystack.cn>
Cc:  Philipp Reisner <philipp.reisner at linbit.com>,drbd-dev at 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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-dev/attachments/20220507/7df9433d/attachment.htm>


More information about the drbd-dev mailing list