From: Pavan Rallabhandi Date: Wed, 29 Apr 2015 08:05:29 +0000 (+0530) Subject: Avoid an extra read on the atomic variable X-Git-Tag: v0.94.4~49^2~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b16129c3393d6e301b4af5203ffa1c6d8dfdda38;p=ceph.git Avoid an extra read on the atomic variable Signed-off-by: Pavan Rallabhandi (cherry picked from commit 7476e944af049aefdb8871cce62883b86f6b6f8d) --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 09664e9149cc..a421efd31d70 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -8898,10 +8898,11 @@ librados::Rados* RGWRados::get_rados_handle() } else { handle_lock.put_read(); handle_lock.get_write(); - if (next_rados_handle.read() == num_rados_handles) { + uint32_t handle = next_rados_handle.read(); + if (handle == num_rados_handles) { next_rados_handle.set(0); + handle = 0; } - int handle = next_rados_handle.read(); rados_map[id] = handle; next_rados_handle.inc(); handle_lock.put_write();