How to implement ceph object map
This article is to share with you about how to implement ceph object map. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Ceph::BitVector m_object_map is introduced into object map.
Is a bitmap implementation that records the existence status of each object according to object_no. Masking object _ map [object _ no]! = new_state)
Each image pair should have one object_map:
Namespace librbd {
Class AsyncOperation
Class AsyncRequest
Class AsyncResizeRequest
Class CopyupRequest
Class ImageWatcher
Struct ImageCtx {
CephContext * cct
...
ObjectMap object_map; / / = > the original pull is: ceph::BitVector object_map
Check here to see if object exists:
If (! object_map.object_may_exist-> object_map.object_may_exist (m_object_no))
When you do copy_up, you will set the corresponding object to OBJECT_EXISTS:
Bool sent = object_map.aio_update-> object_map.aio_update (m_object_no, OBJECT_EXISTS)
Boost::optional ()
Ctx)
-
Create an image that supports object map:
. / rbd create-- image-feature exclusive-lock-- image-feature object-map-- image-feature layering-p rbd user1_image_om-- size 1024-- image-format 2
There is a special object to store the object map:
Rbd_object_map.4a3ec5a23fb32
Rbd_header.4a3ec5a23fb32
Rbd_id.user1_image_om
/ * New-style rbd image 'foo' consists of objects
* rbd_id.foo-id of image
* rbd_header. -image metadata
* rbd_object_map. -optional image object map
* rbd_data..00000000
* rbd_data..00000001
*.-data
, /
# define RBD_HEADER_PREFIX "rbd_header."
# define RBD_OBJECT_MAP_PREFIX "rbd_object_map."
# define RBD_DATA_PREFIX "rbd_data."
# define RBD_ID_PREFIX "rbd_id."
Create the correct pose that supports object map on hammer:
[guzhongyan@ceph32] $rbd create-- size 50000-- image-format 2-- image-features + 12 test_image_om
[guzhongyan@ceph32 ~] $rbd info test_image_om
Rbd image 'test_image_om':
Size 50000 MB in 12500 objects
Order 22 (4096 kB objects)
Block_name_prefix: rbd_data.6ac6606b8b4567
Format: 2
Features: exclusive, object map
Flags:
The above is how to implement ceph object map. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.