mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
libceph: add ceph_monc_wait_osdmap()
Add ceph_monc_wait_osdmap(), which will block until the osdmap with the specified epoch is received or timeout occurs. Export both of these as they are going to be needed by rbd. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Sage Weil <[email protected]>
This commit is contained in:
parent
513a8243d6
commit
6044cde6f2
2 changed files with 29 additions and 0 deletions
|
|
@ -296,6 +296,33 @@ void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc)
|
|||
__send_subscribe(monc);
|
||||
mutex_unlock(&monc->mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(ceph_monc_request_next_osdmap);
|
||||
|
||||
int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
|
||||
unsigned long timeout)
|
||||
{
|
||||
unsigned long started = jiffies;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&monc->mutex);
|
||||
while (monc->have_osdmap < epoch) {
|
||||
mutex_unlock(&monc->mutex);
|
||||
|
||||
if (timeout != 0 && time_after_eq(jiffies, started + timeout))
|
||||
return -ETIMEDOUT;
|
||||
|
||||
ret = wait_event_interruptible_timeout(monc->client->auth_wq,
|
||||
monc->have_osdmap >= epoch, timeout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mutex_lock(&monc->mutex);
|
||||
}
|
||||
|
||||
mutex_unlock(&monc->mutex);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(ceph_monc_wait_osdmap);
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue