librbd: add new deep-flatten RBD feature

Copy-on-read/write will now use an empty snapshot context to
deep-copy the object through all existing snapshots.  With the
deep-flatten feature enabled, the flatten operation will now
disconnect a child image from its parent even if it has existing
snapshots.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2015-04-15 14:25:08 -04:00
parent a7ffd8d19b
commit b556d3173a
4 changed files with 15 additions and 10 deletions

View File

@ -136,6 +136,7 @@ Parameters
exclusive-lock: exclusive locking support
object-map: object map support (requires exclusive-lock)
fast-diff: fast diff calculations (requires object-map)
deep-flatten: snapshot flatten support
.. option:: --image-shared

View File

@ -6,23 +6,26 @@
#define RBD_FEATURE_EXCLUSIVE_LOCK (1<<2)
#define RBD_FEATURE_OBJECT_MAP (1<<3)
#define RBD_FEATURE_FAST_DIFF (1<<4)
#define RBD_FEATURE_DEEP_FLATTEN (1<<5)
#define RBD_FEATURES_INCOMPATIBLE (RBD_FEATURE_LAYERING | \
RBD_FEATURE_STRIPINGV2)
#define RBD_FEATURES_RW_INCOMPATIBLE (RBD_FEATURES_INCOMPATIBLE | \
#define RBD_FEATURES_RW_INCOMPATIBLE (RBD_FEATURES_INCOMPATIBLE | \
RBD_FEATURE_EXCLUSIVE_LOCK | \
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_FAST_DIFF)
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_FAST_DIFF | \
RBD_FEATURE_DEEP_FLATTEN)
#define RBD_FEATURES_ALL (RBD_FEATURE_LAYERING | \
RBD_FEATURE_STRIPINGV2 | \
#define RBD_FEATURES_ALL (RBD_FEATURE_LAYERING | \
RBD_FEATURE_STRIPINGV2 | \
RBD_FEATURE_EXCLUSIVE_LOCK | \
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_FAST_DIFF)
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_FAST_DIFF | \
RBD_FEATURE_DEEP_FLATTEN)
#define RBD_FEATURES_MUTABLE (RBD_FEATURE_EXCLUSIVE_LOCK | \
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_OBJECT_MAP | \
RBD_FEATURE_FAST_DIFF)
#endif

View File

@ -82,7 +82,8 @@ static std::map<uint64_t, std::string> feature_mapping =
RBD_FEATURE_STRIPINGV2, "striping")(
RBD_FEATURE_EXCLUSIVE_LOCK, "exclusive-lock")(
RBD_FEATURE_OBJECT_MAP, "object-map")(
RBD_FEATURE_FAST_DIFF, "fast-diff");
RBD_FEATURE_FAST_DIFF, "fast-diff")(
RBD_FEATURE_DEEP_FLATTEN, "deep-flatten");
void usage()
{

View File

@ -100,7 +100,7 @@
--allow-shrink allow shrinking of an image when resizing
Supported image features:
layering (+), striping (+), exclusive-lock (*), object-map (*), fast-diff (*)
layering (+), striping (+), exclusive-lock (*), object-map (*), fast-diff (*), deep-flatten
(*) supports enabling/disabling on existing images
(+) enabled by default for new images if features are not specified