2 * Ceph - scalable distributed file system
4 * Copyright (C) 2004-2010 Sage Weil <sage@newdream.net>
6 * This is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software
9 * Foundation. See file COPYING.
13 #ifndef CEPH_RBD_TYPES_H
14 #define CEPH_RBD_TYPES_H
16 #include <linux/types.h>
18 /* For format version 2, rbd image 'foo' consists of objects
19 * rbd_id.foo - id of image
20 * rbd_header.<id> - image metadata
21 * rbd_data.<id>.0000000000000000
22 * rbd_data.<id>.0000000000000001
24 * Clients do not access header data directly in rbd format 2.
27 #define RBD_HEADER_PREFIX "rbd_header."
28 #define RBD_ID_PREFIX "rbd_id."
29 #define RBD_V2_DATA_FORMAT "%s.%016llx"
31 #define RBD_LOCK_NAME "rbd_lock"
32 #define RBD_LOCK_TAG "internal"
33 #define RBD_LOCK_COOKIE_PREFIX "auto"
36 RBD_NOTIFY_OP_ACQUIRED_LOCK
= 0,
37 RBD_NOTIFY_OP_RELEASED_LOCK
= 1,
38 RBD_NOTIFY_OP_REQUEST_LOCK
= 2,
39 RBD_NOTIFY_OP_HEADER_UPDATE
= 3,
43 * For format version 1, rbd image 'foo' consists of objects
44 * foo.rbd - image metadata
45 * rb.<idhi>.<idlo>.<extra>.000000000000
46 * rb.<idhi>.<idlo>.<extra>.000000000001
48 * There is no notion of a persistent image id in rbd format 1.
51 #define RBD_SUFFIX ".rbd"
52 #define RBD_V1_DATA_FORMAT "%s.%012llx"
54 #define RBD_DIRECTORY "rbd_directory"
55 #define RBD_INFO "rbd_info"
57 #define RBD_DEFAULT_OBJ_ORDER 22 /* 4MB */
58 #define RBD_MIN_OBJ_ORDER 16
59 #define RBD_MAX_OBJ_ORDER 30
61 #define RBD_HEADER_TEXT "<<< Rados Block Device Image >>>\n"
62 #define RBD_HEADER_SIGNATURE "RBD"
63 #define RBD_HEADER_VERSION "001.005"
65 struct rbd_image_snap_ondisk
{
68 } __attribute__((packed
));
70 struct rbd_image_header_ondisk
{
72 char object_prefix
[24];
80 } __attribute__((packed
)) options
;
85 __le64 snap_names_len
;
86 struct rbd_image_snap_ondisk snaps
[0];
87 } __attribute__((packed
));