From: Sage Weil Date: Fri, 10 Jun 2016 13:24:10 +0000 (-0400) Subject: os/bluestore: cache: define 'empty' buffer X-Git-Tag: v11.0.0~70^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba0a7c4027d6c9a4e4b66aeef8e18813bc21111a;p=ceph.git os/bluestore: cache: define 'empty' buffer 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 --- diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 5d103748efae..d160f66caea0 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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; }