]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/ocf/src/utils/utils_refcnt.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / ocf / src / utils / utils_refcnt.h
index 10bb24b81f2ea4d109fe28fd7528a76eb623c347..556756031d549111ce6dfb5c7528f62268a11fc9 100644 (file)
@@ -22,23 +22,26 @@ struct ocf_refcnt
 /* Initialize reference counter */
 void ocf_refcnt_init(struct ocf_refcnt *rc);
 
-/* Try to increment counter. Returns true if successfull, false if freezed */
-bool ocf_refcnt_inc(struct ocf_refcnt  *rc);
+/* Try to increment counter. Returns counter value (> 0) if successfull, 0
+ * if counter is frozen */
+int ocf_refcnt_inc(struct ocf_refcnt  *rc);
 
-/* Decrement reference counter */
-void ocf_refcnt_dec(struct ocf_refcnt *rc);
+/* Decrement reference counter and return post-decrement value */
+int ocf_refcnt_dec(struct ocf_refcnt *rc);
 
 /* Disallow incrementing of underlying counter - attempts to increment counter
  * will be failing until ocf_refcnt_unfreeze is calleed.
- * It's ok to call freeze multiple times, in which case counter is freezed
+ * It's ok to call freeze multiple times, in which case counter is frozen
  * until all freeze calls are offset by a corresponding unfreeze.*/
 void ocf_refcnt_freeze(struct ocf_refcnt *rc);
 
 /* Cancel the effect of single ocf_refcnt_freeze call */
 void ocf_refcnt_unfreeze(struct ocf_refcnt *rc);
 
+bool ocf_refcnt_frozen(struct ocf_refcnt *rc);
+
 /* Register callback to be called when reference counter drops to 0.
- * Must be called after counter is freezed.
+ * Must be called after counter is frozen.
  * Cannot be called until previously regsitered callback had fired. */
 void ocf_refcnt_register_zero_cb(struct ocf_refcnt *rc, ocf_refcnt_cb_t cb,
                void *priv);