> Hi Jason dillaman
> Recently I worked on the feature http://tracker.ceph.com/issues/13500 , when
> I read the code about librbd, I was confused by RBD_FLAG_OBJECT_MAP_INVALID
> flag.
> When I create a rbd with “—image-features = 13 ” , we enable object-map
> feature without setting RBD_FLAG_OBJECT_MAP_INVALID, then write data to
> generate an object, the existence of this object can be checked by
> object_may_exist.
> But when I use “feature enable ${name} object-map” to enable object-map
> feature of a clone rbd(we cannot specify –image-features option when I clone
> rbd), and RBD_FLAG_OBJECT_MAP_INVALID flag is set. If I use object_may_exist
> to check object existence, object_may_exist function return true, which
> means the object exists.

When you create a new (empty) image with object map enabled from the start, the 
object map is valid since it defaults to all objects don't exist.  If you use 
'rbd feature enable <image-spec> object-map', the object map will be flagged as 
invalid since you may have already written to the object (and thus the object 
map doesn't potentially match reality).  When an object map is flagged as 
invalid, any optimizations for whether the block exists or not are disabled.  

> So there maybe inconsistency with these two methods (--image-features vs.
> feature enable) when we create a rbd. Is this a bug ?
> My question is what does RBD_FLAG_OBJECT_MAP_INVALID flag mean, does it mean
> the object map of rbd is not valid, we need rebuild the object map?

Yes, you need to rebuild an invalid object map via 'rbd object-map rebuild 
<image-spec | snap-spec>' to clear the RBD_FLAG_OBJECT_MAP_INVALID flag.  The 
rebuild process whether or not each potential object within the RBD image 
exists, and updates the object map accordingly. 

-- 

Jason Dillaman 
_______________________________________________
ceph-users mailing list
[email protected]
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to