Merge tag 'drm-fixes-2024-06-01' of https://gitlab.freedesktop.org/drm/kernel
[linux-2.6-block.git] / drivers / block / rbd_types.h
CommitLineData
602adf40
YS
1/*
2 * Ceph - scalable distributed file system
3 *
4 * Copyright (C) 2004-2010 Sage Weil <sage@newdream.net>
5 *
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.
10 *
11 */
12
13#ifndef CEPH_RBD_TYPES_H
14#define CEPH_RBD_TYPES_H
15
16#include <linux/types.h>
17
3bb59ad5
AE
18/* For format version 2, rbd image 'foo' consists of objects
19 * rbd_id.foo - id of image
20 * rbd_header.<id> - image metadata
22e8bd51 21 * rbd_object_map.<id> - optional image object map
3bb59ad5
AE
22 * rbd_data.<id>.0000000000000000
23 * rbd_data.<id>.0000000000000001
24 * ... - data
25 * Clients do not access header data directly in rbd format 2.
26 */
27
28#define RBD_HEADER_PREFIX "rbd_header."
22e8bd51 29#define RBD_OBJECT_MAP_PREFIX "rbd_object_map."
3bb59ad5 30#define RBD_ID_PREFIX "rbd_id."
223768d0 31#define RBD_V2_DATA_FORMAT "%s.%016llx"
3bb59ad5 32
ed95b21a
ID
33#define RBD_LOCK_NAME "rbd_lock"
34#define RBD_LOCK_TAG "internal"
35#define RBD_LOCK_COOKIE_PREFIX "auto"
36
37enum rbd_notify_op {
38 RBD_NOTIFY_OP_ACQUIRED_LOCK = 0,
39 RBD_NOTIFY_OP_RELEASED_LOCK = 1,
40 RBD_NOTIFY_OP_REQUEST_LOCK = 2,
41 RBD_NOTIFY_OP_HEADER_UPDATE = 3,
42};
43
22e8bd51
ID
44#define OBJECT_NONEXISTENT 0
45#define OBJECT_EXISTS 1
46#define OBJECT_PENDING 2
47#define OBJECT_EXISTS_CLEAN 3
48
49#define RBD_FLAG_OBJECT_MAP_INVALID (1ULL << 0)
50#define RBD_FLAG_FAST_DIFF_INVALID (1ULL << 1)
51
602adf40 52/*
3bb59ad5
AE
53 * For format version 1, rbd image 'foo' consists of objects
54 * foo.rbd - image metadata
223768d0
ID
55 * rb.<idhi>.<idlo>.<extra>.000000000000
56 * rb.<idhi>.<idlo>.<extra>.000000000001
3bb59ad5
AE
57 * ... - data
58 * There is no notion of a persistent image id in rbd format 1.
602adf40
YS
59 */
60
61#define RBD_SUFFIX ".rbd"
223768d0 62#define RBD_V1_DATA_FORMAT "%s.%012llx"
3bb59ad5 63
602adf40
YS
64#define RBD_DIRECTORY "rbd_directory"
65#define RBD_INFO "rbd_info"
66
67#define RBD_DEFAULT_OBJ_ORDER 22 /* 4MB */
68#define RBD_MIN_OBJ_ORDER 16
69#define RBD_MAX_OBJ_ORDER 30
70
602adf40
YS
71#define RBD_HEADER_TEXT "<<< Rados Block Device Image >>>\n"
72#define RBD_HEADER_SIGNATURE "RBD"
73#define RBD_HEADER_VERSION "001.005"
74
602adf40
YS
75struct rbd_image_snap_ondisk {
76 __le64 id;
77 __le64 image_size;
78} __attribute__((packed));
79
80struct rbd_image_header_ondisk {
81 char text[40];
843a0d08 82 char object_prefix[24];
602adf40
YS
83 char signature[4];
84 char version[8];
85 struct {
86 __u8 order;
87 __u8 crypt_type;
88 __u8 comp_type;
89 __u8 unused;
90 } __attribute__((packed)) options;
91 __le64 image_size;
92 __le64 snap_seq;
93 __le32 snap_count;
94 __le32 reserved;
95 __le64 snap_names_len;
53ab8e7c 96 struct rbd_image_snap_ondisk snaps[];
602adf40
YS
97} __attribute__((packed));
98
99
100#endif