blob: bb6f40c9cb0fd151d3593a3826263a68b293b584 [file] [log] [blame]
Sage Weil5cd068c2010-07-07 08:38:17 -07001#ifndef CEPH_RADOS_H
2#define CEPH_RADOS_H
Sage Weil0dee3c22009-10-06 11:31:06 -07003
4/*
5 * Data types for the Ceph distributed object storage layer RADOS
6 * (Reliable Autonomic Distributed Object Store).
7 */
8
David Howellsa1ce3922012-10-02 18:01:25 +01009#include <linux/ceph/msgr.h>
Sage Weil0dee3c22009-10-06 11:31:06 -070010
11/*
12 * fs id
13 */
14struct ceph_fsid {
15 unsigned char fsid[16];
16};
17
18static inline int ceph_fsid_compare(const struct ceph_fsid *a,
19 const struct ceph_fsid *b)
20{
21 return memcmp(a, b, sizeof(*a));
22}
23
24/*
25 * ino, object, etc.
26 */
27typedef __le64 ceph_snapid_t;
28#define CEPH_SNAPDIR ((__u64)(-1)) /* reserved for hidden .snap dir */
29#define CEPH_NOSNAP ((__u64)(-2)) /* "head", "live" revision */
30#define CEPH_MAXSNAP ((__u64)(-3)) /* largest valid snapid */
31
32struct ceph_timespec {
33 __le32 tv_sec;
34 __le32 tv_nsec;
35} __attribute__ ((packed));
36
37
38/*
39 * object layout - how objects are mapped into PGs
40 */
41#define CEPH_OBJECT_LAYOUT_HASH 1
42#define CEPH_OBJECT_LAYOUT_LINEAR 2
43#define CEPH_OBJECT_LAYOUT_HASHINO 3
44
45/*
46 * pg layout -- how PGs are mapped onto (sets of) OSDs
47 */
48#define CEPH_PG_LAYOUT_CRUSH 0
49#define CEPH_PG_LAYOUT_HASH 1
50#define CEPH_PG_LAYOUT_LINEAR 2
51#define CEPH_PG_LAYOUT_HYBRID 3
52
Sage Weild85b7052010-05-10 10:24:48 -070053#define CEPH_PG_MAX_SIZE 16 /* max # osds in a single pg */
Sage Weil0dee3c22009-10-06 11:31:06 -070054
55/*
56 * placement group.
57 * we encode this into one __le64.
58 */
Sage Weil129793542013-01-08 09:15:10 -080059struct ceph_pg_v1 {
Sage Weil51042122009-11-04 11:39:12 -080060 __le16 preferred; /* preferred primary osd */
61 __le16 ps; /* placement seed */
62 __le32 pool; /* object pool */
Sage Weil0dee3c22009-10-06 11:31:06 -070063} __attribute__ ((packed));
64
65/*
66 * pg_pool is a set of pgs storing a pool of objects
67 *
68 * pg_num -- base number of pseudorandomly placed pgs
69 *
70 * pgp_num -- effective number when calculating pg placement. this
71 * is used for pg_num increases. new pgs result in data being "split"
72 * into new pgs. for this to proceed smoothly, new pgs are intiially
73 * colocated with their parents; that is, pgp_num doesn't increase
74 * until the new pgs have successfully split. only _then_ are the new
75 * pgs placed independently.
76 *
77 * lpg_num -- localized pg count (per device). replicas are randomly
78 * selected.
79 *
80 * lpgp_num -- as above.
81 */
Alex Elder86b00e02012-10-25 23:34:42 -050082#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
83
Sage Weil0dee3c22009-10-06 11:31:06 -070084#define CEPH_PG_TYPE_REP 1
85#define CEPH_PG_TYPE_RAID4 2
Sage Weil0dee3c22009-10-06 11:31:06 -070086
87/*
88 * stable_mod func is used to control number of placement groups.
89 * similar to straight-up modulo, but produces a stable mapping as b
90 * increases over time. b is the number of bins, and bmask is the
91 * containing power of 2 minus 1.
92 *
93 * b <= bmask and bmask=(2**n)-1
94 * e.g., b=12 -> bmask=15, b=123 -> bmask=127
95 */
96static inline int ceph_stable_mod(int x, int b, int bmask)
97{
98 if ((x & bmask) < b)
99 return x & bmask;
100 else
101 return x & (bmask >> 1);
102}
103
104/*
105 * object layout - how a given object should be stored.
106 */
107struct ceph_object_layout {
Sage Weil129793542013-01-08 09:15:10 -0800108 struct ceph_pg_v1 ol_pgid; /* raw pg, with _full_ ps precision. */
Sage Weil0dee3c22009-10-06 11:31:06 -0700109 __le32 ol_stripe_unit; /* for per-object parity, if any */
110} __attribute__ ((packed));
111
112/*
113 * compound epoch+version, used by storage layer to serialize mutations
114 */
115struct ceph_eversion {
116 __le32 epoch;
117 __le64 version;
118} __attribute__ ((packed));
119
120/*
121 * osd map bits
122 */
123
124/* status bits */
Alex Elder0315a772013-02-15 11:42:30 -0600125#define CEPH_OSD_EXISTS (1<<0)
126#define CEPH_OSD_UP (1<<1)
127#define CEPH_OSD_AUTOOUT (1<<2) /* osd was automatically marked out */
128#define CEPH_OSD_NEW (1<<3) /* osd is new, never marked in */
Sage Weil0dee3c22009-10-06 11:31:06 -0700129
Alex Elder4b568b12013-02-15 11:42:30 -0600130extern const char *ceph_osd_state_name(int s);
131
Sage Weil0dee3c22009-10-06 11:31:06 -0700132/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
133#define CEPH_OSD_IN 0x10000
134#define CEPH_OSD_OUT 0
135
Ilya Dryomov2cfa34f2014-03-21 19:05:30 +0200136/* osd primary-affinity. fixed point value: 0x10000 == baseline */
137#define CEPH_OSD_MAX_PRIMARY_AFFINITY 0x10000
138#define CEPH_OSD_DEFAULT_PRIMARY_AFFINITY 0x10000
139
Sage Weil0dee3c22009-10-06 11:31:06 -0700140
141/*
142 * osd map flag bits
143 */
144#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
145#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
146#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
147#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
148#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
Alex Elder0315a772013-02-15 11:42:30 -0600149#define CEPH_OSDMAP_NOUP (1<<5) /* block osd boot */
150#define CEPH_OSDMAP_NODOWN (1<<6) /* block osd mark-down/failure */
151#define CEPH_OSDMAP_NOOUT (1<<7) /* block osd auto mark-out */
152#define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */
153#define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */
154#define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */
155
156/*
157 * The error code to return when an OSD can't handle a write
158 * because it is too large.
159 */
160#define OSD_WRITETOOBIG EMSGSIZE
Sage Weil0dee3c22009-10-06 11:31:06 -0700161
162/*
163 * osd ops
Alex Elder0315a772013-02-15 11:42:30 -0600164 *
165 * WARNING: do not use these op codes directly. Use the helpers
166 * defined below instead. In certain cases, op code behavior was
167 * redefined, resulting in special-cases in the helpers.
Sage Weil0dee3c22009-10-06 11:31:06 -0700168 */
169#define CEPH_OSD_OP_MODE 0xf000
170#define CEPH_OSD_OP_MODE_RD 0x1000
171#define CEPH_OSD_OP_MODE_WR 0x2000
172#define CEPH_OSD_OP_MODE_RMW 0x3000
173#define CEPH_OSD_OP_MODE_SUB 0x4000
Sage Weil0dee3c22009-10-06 11:31:06 -0700174
175#define CEPH_OSD_OP_TYPE 0x0f00
176#define CEPH_OSD_OP_TYPE_LOCK 0x0100
177#define CEPH_OSD_OP_TYPE_DATA 0x0200
178#define CEPH_OSD_OP_TYPE_ATTR 0x0300
179#define CEPH_OSD_OP_TYPE_EXEC 0x0400
180#define CEPH_OSD_OP_TYPE_PG 0x0500
Alex Elder0315a772013-02-15 11:42:30 -0600181#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
Sage Weil0dee3c22009-10-06 11:31:06 -0700182
183enum {
184 /** data **/
185 /* read */
186 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
187 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800188 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
Sage Weil0dee3c22009-10-06 11:31:06 -0700189
190 /* fancy read */
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800191 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
192 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
193
194 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
195 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
196
197 /* versioning */
198 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
Sage Weil0dee3c22009-10-06 11:31:06 -0700199
200 /* write */
201 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
202 CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
203 CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
204 CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
205 CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
206
207 /* fancy write */
208 CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
209 CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
210 CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
211 CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
212
213 CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
214 CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
215 CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
216
217 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
Sage Weilf0b18d92010-07-07 08:39:03 -0700218 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
Sage Weil0dee3c22009-10-06 11:31:06 -0700219
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800220 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
221
Alex Elder0315a772013-02-15 11:42:30 -0600222 /* omap */
223 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
224 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
225 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
226 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
227 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
228 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
229 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
230 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
231 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
232 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
233
Ilya Dryomovc647b8a2014-02-25 16:22:27 +0200234 /* hints */
235 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
236
Alex Elder0315a772013-02-15 11:42:30 -0600237 /** multi **/
238 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
239 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
240 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
241
Sage Weil0dee3c22009-10-06 11:31:06 -0700242 /** attrs **/
243 /* read */
244 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
245 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
Sage Weilca9d93a2010-05-12 14:48:20 -0700246 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
Sage Weil0dee3c22009-10-06 11:31:06 -0700247
248 /* write */
249 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
250 CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
251 CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
252 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
253
254 /** subop **/
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800255 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
256 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
257 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
258 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
259 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
260 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
261 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
262 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
Alex Elder0315a772013-02-15 11:42:30 -0600263 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
Sage Weil0dee3c22009-10-06 11:31:06 -0700264
265 /** lock **/
266 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
267 CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
268 CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
269 CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
270 CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
271 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
272
273 /** exec **/
Alex Elder0315a772013-02-15 11:42:30 -0600274 /* note: the RD bit here is wrong; see special-case below in helper */
Sage Weil0dee3c22009-10-06 11:31:06 -0700275 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
276
277 /** pg **/
278 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
Alex Elder0315a772013-02-15 11:42:30 -0600279 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
Sage Weil0dee3c22009-10-06 11:31:06 -0700280};
281
282static inline int ceph_osd_op_type_lock(int op)
283{
284 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
285}
286static inline int ceph_osd_op_type_data(int op)
287{
288 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
289}
290static inline int ceph_osd_op_type_attr(int op)
291{
292 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
293}
294static inline int ceph_osd_op_type_exec(int op)
295{
296 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_EXEC;
297}
298static inline int ceph_osd_op_type_pg(int op)
299{
300 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
301}
Alex Elder0315a772013-02-15 11:42:30 -0600302static inline int ceph_osd_op_type_multi(int op)
303{
304 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_MULTI;
305}
Sage Weil0dee3c22009-10-06 11:31:06 -0700306
307static inline int ceph_osd_op_mode_subop(int op)
308{
309 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
310}
311static inline int ceph_osd_op_mode_read(int op)
312{
Alex Elder0315a772013-02-15 11:42:30 -0600313 return (op & CEPH_OSD_OP_MODE_RD) &&
314 op != CEPH_OSD_OP_CALL;
Sage Weil0dee3c22009-10-06 11:31:06 -0700315}
316static inline int ceph_osd_op_mode_modify(int op)
317{
Alex Elder0315a772013-02-15 11:42:30 -0600318 return op & CEPH_OSD_OP_MODE_WR;
Sage Weil0dee3c22009-10-06 11:31:06 -0700319}
320
Sage Weilf0b18d92010-07-07 08:39:03 -0700321/*
322 * note that the following tmap stuff is also defined in the ceph librados.h
323 * any modification here needs to be updated there
324 */
Sage Weil0dee3c22009-10-06 11:31:06 -0700325#define CEPH_OSD_TMAP_HDR 'h'
326#define CEPH_OSD_TMAP_SET 's'
Alex Elder0315a772013-02-15 11:42:30 -0600327#define CEPH_OSD_TMAP_CREATE 'c' /* create key */
Sage Weil0dee3c22009-10-06 11:31:06 -0700328#define CEPH_OSD_TMAP_RM 'r'
Alex Elder0315a772013-02-15 11:42:30 -0600329#define CEPH_OSD_TMAP_RMSLOPPY 'R'
Sage Weil0dee3c22009-10-06 11:31:06 -0700330
331extern const char *ceph_osd_op_name(int op);
332
Sage Weil0dee3c22009-10-06 11:31:06 -0700333/*
334 * osd op flags
335 *
336 * An op may be READ, WRITE, or READ|WRITE.
337 */
338enum {
Alex Elder0315a772013-02-15 11:42:30 -0600339 CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
340 CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
341 CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
342 CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
343 CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
344 CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
345 CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
346 CEPH_OSD_FLAG_PEERSTAT_OLD = 0x0080, /* DEPRECATED msg includes osd_peer_stat */
347 CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
348 CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
349 CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
350 CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
351 CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* DEPRECATED op may exec (public) */
352 CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
353 CEPH_OSD_FLAG_RWORDERED = 0x4000, /* order wrt concurrent reads */
Ilya Dryomov1b3f2ab2014-01-27 17:40:19 +0200354 CEPH_OSD_FLAG_IGNORE_CACHE = 0x8000, /* ignore cache logic */
355 CEPH_OSD_FLAG_SKIPRWLOCKS = 0x10000, /* skip rw locks */
356 CEPH_OSD_FLAG_IGNORE_OVERLAY = 0x20000, /* ignore pool overlay */
357 CEPH_OSD_FLAG_FLUSH = 0x40000, /* this is part of flush */
Sage Weil0dee3c22009-10-06 11:31:06 -0700358};
359
360enum {
361 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
Alex Elder0315a772013-02-15 11:42:30 -0600362 CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
Sage Weil0dee3c22009-10-06 11:31:06 -0700363};
364
365#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
366#define EBLACKLISTED ESHUTDOWN /* blacklisted */
367
Sage Weilca9d93a2010-05-12 14:48:20 -0700368/* xattr comparison */
369enum {
370 CEPH_OSD_CMPXATTR_OP_NOP = 0,
371 CEPH_OSD_CMPXATTR_OP_EQ = 1,
372 CEPH_OSD_CMPXATTR_OP_NE = 2,
373 CEPH_OSD_CMPXATTR_OP_GT = 3,
374 CEPH_OSD_CMPXATTR_OP_GTE = 4,
375 CEPH_OSD_CMPXATTR_OP_LT = 5,
376 CEPH_OSD_CMPXATTR_OP_LTE = 6
377};
378
379enum {
380 CEPH_OSD_CMPXATTR_MODE_STRING = 1,
381 CEPH_OSD_CMPXATTR_MODE_U64 = 2
382};
383
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800384#define RADOS_NOTIFY_VER 1
385
Sage Weil0dee3c22009-10-06 11:31:06 -0700386/*
387 * an individual object operation. each may be accompanied by some data
388 * payload
389 */
390struct ceph_osd_op {
391 __le16 op; /* CEPH_OSD_OP_* */
Ilya Dryomov7b25bf52014-02-25 16:22:26 +0200392 __le32 flags; /* CEPH_OSD_OP_FLAG_* */
Sage Weil0dee3c22009-10-06 11:31:06 -0700393 union {
394 struct {
395 __le64 offset, length;
Yehuda Sadeh0c948992010-02-01 16:10:45 -0800396 __le64 truncate_size;
397 __le32 truncate_seq;
Sage Weil0dee3c22009-10-06 11:31:06 -0700398 } __attribute__ ((packed)) extent;
399 struct {
400 __le32 name_len;
401 __le32 value_len;
Sage Weilca9d93a2010-05-12 14:48:20 -0700402 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
403 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
Sage Weil0dee3c22009-10-06 11:31:06 -0700404 } __attribute__ ((packed)) xattr;
405 struct {
Sage Weil0dee3c22009-10-06 11:31:06 -0700406 __u8 class_len;
407 __u8 method_len;
408 __u8 argc;
409 __le32 indata_len;
410 } __attribute__ ((packed)) cls;
411 struct {
412 __le64 cookie, count;
413 } __attribute__ ((packed)) pgls;
Sage Weilf0b18d92010-07-07 08:39:03 -0700414 struct {
415 __le64 snapid;
416 } __attribute__ ((packed)) snap;
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800417 struct {
418 __le64 cookie;
419 __le64 ver;
420 __u8 flag; /* 0 = unwatch, 1 = watch */
421 } __attribute__ ((packed)) watch;
Alex Elder0315a772013-02-15 11:42:30 -0600422 struct {
423 __le64 offset, length;
424 __le64 src_offset;
425 } __attribute__ ((packed)) clonerange;
Ilya Dryomovc647b8a2014-02-25 16:22:27 +0200426 struct {
427 __le64 expected_object_size;
428 __le64 expected_write_size;
429 } __attribute__ ((packed)) alloc_hint;
Alex Elder0315a772013-02-15 11:42:30 -0600430 };
Sage Weil0dee3c22009-10-06 11:31:06 -0700431 __le32 payload_len;
432} __attribute__ ((packed));
433
Sage Weil0dee3c22009-10-06 11:31:06 -0700434
Sage Weil0dee3c22009-10-06 11:31:06 -0700435#endif