rbd: define common queue_con_delay()
authorAlex Elder <elder@inktank.com>
Tue, 9 Oct 2012 03:37:30 +0000 (20:37 -0700)
committerAlex Elder <elder@inktank.com>
Wed, 10 Oct 2012 05:00:44 +0000 (22:00 -0700)
commit802c6d967fbdcd2cbc91b917425661bb8bbfaade
treea5a64ac537fb69ecb1edd55db8346089fecb9f84
parent8618e30bc14b06bfafa0f164cca7b0e06451f88a
rbd: define common queue_con_delay()

This patch defines a single function, queue_con_delay() to call
queue_delayed_work() for a connection.  It basically generalizes
what was previously queue_con() by adding the delay argument.
queue_con() is now a simple helper that passes 0 for its delay.
queue_con_delay() returns 0 if it queued work or an errno if it
did not for some reason.

If con_work() finds the BACKOFF flag set for a connection, it now
calls queue_con_delay() to handle arranging to start again after a
delay.

Note about connection reference counts:  con_work() only ever gets
called as a work item function.  At the time that work is scheduled,
a reference to the connection is acquired, and the corresponding
con_work() call is then responsible for dropping that reference
before it returns.

Previously, the backoff handling inside con_work() silently handed
off its reference to delayed work it scheduled.  Now that
queue_con_delay() is used, a new reference is acquired for the
newly-scheduled work, and the original reference is dropped by the
con->ops->put() call at the end of the function.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
net/ceph/messenger.c
This page took 0.06552 seconds and 5 git commands to generate.