[ovs-dev] [PATCH 2/3] bridge: Refactor the stats and status update.

Ben Pfaff blp at nicira.com
Fri Sep 19 17:43:42 UTC 2014


On Thu, Sep 18, 2014 at 03:18:12PM -0700, Alex Wang wrote:
> This commit refactors the stats and status update in bridge_run()
> by moving the corresponding code to separate functions.  This
> makes the code more organized.
> 
> Signed-off-by: Alex Wang <alexw at nicira.com>

The variable 'stats_txn' could now be made a static local variable in
run_stats_update().

I suggest creating a "wait" function for the status_txn and moving
this code from bridge_wait() into it:

    /* If the 'status_txn' is non-null (transaction incomplete), waits for the
     * transaction to complete.  If the status update to database needs to be
     * run again (transaction fails), registers a timeout in
     * 'STATUS_CHECK_AGAIN_MSEC'.  Otherwise, waits on the global connectivity
     * sequence number. */
    if (status_txn) {
        ovsdb_idl_txn_wait(status_txn);
    } else if (status_txn_try_again) {
        poll_timer_wait_until(time_msec() + STATUS_CHECK_AGAIN_MSEC);
    } else {
        seq_wait(connectivity_seq_get(), connectivity_seqno);
    }

I suggest adding a brief comment at the top of each of the new
functions.

Acked-by: Ben Pfaff <blp at nicira.com>



More information about the dev mailing list