]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/ocf/src/metadata/metadata_status.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / ocf / src / metadata / metadata_status.h
index 021e12a52f30ebe7b25863326027e2050a7c3561..10faec8f0e8275aa24b8fa30e153e3aec3c685af 100644 (file)
@@ -6,7 +6,8 @@
 #ifndef __METADATA_STATUS_H__
 #define __METADATA_STATUS_H__
 
-#include "../ocf_request.h"
+#include "../concurrency/ocf_metadata_concurrency.h"
+
 /*******************************************************************************
  * Dirty
  ******************************************************************************/
@@ -199,49 +200,47 @@ static inline bool metadata_test_and_clear_dirty_sec(
 /*
  * Marks given cache line's bits as clean
  *
- * @return true if the cache line was dirty and became clean
+ * @return true if any cache line's sector was dirty and became clean
  * @return false for other cases
  */
 static inline bool metadata_clear_dirty_sec_changed(
                struct ocf_cache *cache, ocf_cache_line_t line,
-               uint8_t start, uint8_t stop)
+               uint8_t start, uint8_t stop, bool *line_is_clean)
 {
-       bool was_dirty, is_dirty = false;
+       bool sec_changed;
 
        OCF_METADATA_BITS_LOCK_WR();
 
-       was_dirty = cache->metadata.iface.test_dirty(cache, line,
-                       cache->metadata.settings.sector_start,
-                       cache->metadata.settings.sector_end,
-                       false);
-
-       if (was_dirty) {
-               is_dirty = cache->metadata.iface.clear_dirty(cache, line,
-                               start, stop);
-       }
+       sec_changed = cache->metadata.iface.test_dirty(cache, line,
+                       start, stop, false);
+       *line_is_clean = !cache->metadata.iface.clear_dirty(cache, line,
+                       start, stop);
 
        OCF_METADATA_BITS_UNLOCK_WR();
 
-       return was_dirty && !is_dirty;
+       return sec_changed;
 }
 
 /*
  * Marks given cache line's bits as dirty
  *
- * @return true if the cache line was clean and became dirty
- * @return false if the cache line was dirty before marking bits
+ * @return true if any cache line's sector became dirty
+ * @return false for other cases
  */
 static inline bool metadata_set_dirty_sec_changed(
                struct ocf_cache *cache, ocf_cache_line_t line,
-               uint8_t start, uint8_t stop)
+               uint8_t start, uint8_t stop, bool *line_was_dirty)
 {
-       bool was_dirty;
+       bool sec_changed;
 
        OCF_METADATA_BITS_LOCK_WR();
-       was_dirty = cache->metadata.iface.set_dirty(cache, line, start, stop);
+       sec_changed = !cache->metadata.iface.test_dirty(cache, line,
+                       start, stop, true);
+       *line_was_dirty = cache->metadata.iface.set_dirty(cache, line, start,
+                       stop);
        OCF_METADATA_BITS_UNLOCK_WR();
 
-       return !was_dirty;
+       return sec_changed;
 }
 
 /*******************************************************************************