]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: cache: define 'empty' buffer
authorSage Weil <sage@redhat.com>
Fri, 10 Jun 2016 13:24:10 +0000 (09:24 -0400)
committerSage Weil <sage@redhat.com>
Wed, 22 Jun 2016 15:28:40 +0000 (11:28 -0400)
This is a buffer with no data.  It's a placeholder that is there to be used
by cache replacement algorithms like 2Q and MQ that needs history for
trimmed buffers.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.h

index 5d103748efaecd51b98f776b2b9833809aba24f8..d160f66caea07fbd3a08b50a208b23c50834f41f 100644 (file)
@@ -111,14 +111,14 @@ public:
   /// cached buffer
   struct Buffer {
     enum {
-      STATE_UNDEF = 0,
-      STATE_CLEAN,
-      STATE_WRITING,
+      STATE_EMPTY,     ///< empty buffer -- used for cache history
+      STATE_CLEAN,     ///< clean data that is up to date
+      STATE_WRITING,   ///< data that is being written (io not yet complete)
       STATE_READING,
     };
     static const char *get_state_name(int s) {
       switch (s) {
-      case STATE_UNDEF: return "undef";
+      case STATE_EMPTY: return "empty";
       case STATE_CLEAN: return "clean";
       case STATE_WRITING: return "writing";
       case STATE_READING: return "reading";
@@ -154,6 +154,9 @@ public:
       : space(space), state(s), flags(f), seq(q), offset(o),
        length(b.length()), data(b) {}
 
+    bool is_empty() const {
+      return state == STATE_EMPTY;
+    }
     bool is_clean() const {
       return state == STATE_CLEAN;
     }