blob: f20e0d8a2155dc0f5d95ee248c2ed1aa56af1df1 [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
Ilya Dryomov2abebdb2014-03-24 17:12:47 +020084#define CEPH_POOL_TYPE_REP 1
85#define CEPH_POOL_TYPE_RAID4 2 /* never implemented */
86#define CEPH_POOL_TYPE_EC 3
Sage Weil0dee3c22009-10-06 11:31:06 -070087
88/*
89 * stable_mod func is used to control number of placement groups.
90 * similar to straight-up modulo, but produces a stable mapping as b
91 * increases over time. b is the number of bins, and bmask is the
92 * containing power of 2 minus 1.
93 *
94 * b <= bmask and bmask=(2**n)-1
95 * e.g., b=12 -> bmask=15, b=123 -> bmask=127
96 */
97static inline int ceph_stable_mod(int x, int b, int bmask)
98{
99 if ((x & bmask) < b)
100 return x & bmask;
101 else
102 return x & (bmask >> 1);
103}
104
105/*
106 * object layout - how a given object should be stored.
107 */
108struct ceph_object_layout {
Sage Weil129793542013-01-08 09:15:10 -0800109 struct ceph_pg_v1 ol_pgid; /* raw pg, with _full_ ps precision. */
Sage Weil0dee3c22009-10-06 11:31:06 -0700110 __le32 ol_stripe_unit; /* for per-object parity, if any */
111} __attribute__ ((packed));
112
113/*
114 * compound epoch+version, used by storage layer to serialize mutations
115 */
116struct ceph_eversion {
117 __le32 epoch;
118 __le64 version;
119} __attribute__ ((packed));
120
121/*
122 * osd map bits
123 */
124
125/* status bits */
Alex Elder0315a772013-02-15 11:42:30 -0600126#define CEPH_OSD_EXISTS (1<<0)
127#define CEPH_OSD_UP (1<<1)
128#define CEPH_OSD_AUTOOUT (1<<2) /* osd was automatically marked out */
129#define CEPH_OSD_NEW (1<<3) /* osd is new, never marked in */
Sage Weil0dee3c22009-10-06 11:31:06 -0700130
Alex Elder4b568b12013-02-15 11:42:30 -0600131extern const char *ceph_osd_state_name(int s);
132
Sage Weil0dee3c22009-10-06 11:31:06 -0700133/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
134#define CEPH_OSD_IN 0x10000
135#define CEPH_OSD_OUT 0
136
Ilya Dryomov2cfa34f2014-03-21 19:05:30 +0200137/* osd primary-affinity. fixed point value: 0x10000 == baseline */
138#define CEPH_OSD_MAX_PRIMARY_AFFINITY 0x10000
139#define CEPH_OSD_DEFAULT_PRIMARY_AFFINITY 0x10000
140
Sage Weil0dee3c22009-10-06 11:31:06 -0700141
142/*
143 * osd map flag bits
144 */
145#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
146#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
147#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
148#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
149#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
Alex Elder0315a772013-02-15 11:42:30 -0600150#define CEPH_OSDMAP_NOUP (1<<5) /* block osd boot */
151#define CEPH_OSDMAP_NODOWN (1<<6) /* block osd mark-down/failure */
152#define CEPH_OSDMAP_NOOUT (1<<7) /* block osd auto mark-out */
153#define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */
154#define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */
155#define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */
156
157/*
158 * The error code to return when an OSD can't handle a write
159 * because it is too large.
160 */
161#define OSD_WRITETOOBIG EMSGSIZE
Sage Weil0dee3c22009-10-06 11:31:06 -0700162
163/*
164 * osd ops
Alex Elder0315a772013-02-15 11:42:30 -0600165 *
166 * WARNING: do not use these op codes directly. Use the helpers
167 * defined below instead. In certain cases, op code behavior was
168 * redefined, resulting in special-cases in the helpers.
Sage Weil0dee3c22009-10-06 11:31:06 -0700169 */
170#define CEPH_OSD_OP_MODE 0xf000
171#define CEPH_OSD_OP_MODE_RD 0x1000
172#define CEPH_OSD_OP_MODE_WR 0x2000
173#define CEPH_OSD_OP_MODE_RMW 0x3000
174#define CEPH_OSD_OP_MODE_SUB 0x4000
Sage Weil0dee3c22009-10-06 11:31:06 -0700175
176#define CEPH_OSD_OP_TYPE 0x0f00
177#define CEPH_OSD_OP_TYPE_LOCK 0x0100
178#define CEPH_OSD_OP_TYPE_DATA 0x0200
179#define CEPH_OSD_OP_TYPE_ATTR 0x0300
180#define CEPH_OSD_OP_TYPE_EXEC 0x0400
181#define CEPH_OSD_OP_TYPE_PG 0x0500
Alex Elder0315a772013-02-15 11:42:30 -0600182#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
Sage Weil0dee3c22009-10-06 11:31:06 -0700183
184enum {
185 /** data **/
186 /* read */
187 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
188 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800189 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
Sage Weil0dee3c22009-10-06 11:31:06 -0700190
191 /* fancy read */
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800192 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
193 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
194
195 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
196 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
197
198 /* versioning */
199 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
Sage Weil0dee3c22009-10-06 11:31:06 -0700200
201 /* write */
202 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
203 CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
204 CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
205 CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
206 CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
207
208 /* fancy write */
209 CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
210 CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
211 CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
212 CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
213
214 CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
215 CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
216 CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
217
218 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
Sage Weilf0b18d92010-07-07 08:39:03 -0700219 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
Sage Weil0dee3c22009-10-06 11:31:06 -0700220
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800221 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
222
Alex Elder0315a772013-02-15 11:42:30 -0600223 /* omap */
224 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
225 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
226 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
227 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
228 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
229 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
230 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
231 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
234
Ilya Dryomovc647b8a2014-02-25 16:22:27 +0200235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
Alex Elder0315a772013-02-15 11:42:30 -0600238 /** multi **/
239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
241 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
242
Sage Weil0dee3c22009-10-06 11:31:06 -0700243 /** attrs **/
244 /* read */
245 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
246 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
Sage Weilca9d93a2010-05-12 14:48:20 -0700247 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
Sage Weil0dee3c22009-10-06 11:31:06 -0700248
249 /* write */
250 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
251 CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
252 CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
253 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
254
255 /** subop **/
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800256 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
257 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
258 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
259 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
260 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
261 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
262 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
263 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
Alex Elder0315a772013-02-15 11:42:30 -0600264 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
Sage Weil0dee3c22009-10-06 11:31:06 -0700265
266 /** lock **/
267 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
268 CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
269 CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
270 CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
271 CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
272 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
273
274 /** exec **/
Alex Elder0315a772013-02-15 11:42:30 -0600275 /* note: the RD bit here is wrong; see special-case below in helper */
Sage Weil0dee3c22009-10-06 11:31:06 -0700276 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
277
278 /** pg **/
279 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
Alex Elder0315a772013-02-15 11:42:30 -0600280 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
Sage Weil0dee3c22009-10-06 11:31:06 -0700281};
282
283static inline int ceph_osd_op_type_lock(int op)
284{
285 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
286}
287static inline int ceph_osd_op_type_data(int op)
288{
289 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
290}
291static inline int ceph_osd_op_type_attr(int op)
292{
293 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
294}
295static inline int ceph_osd_op_type_exec(int op)
296{
297 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_EXEC;
298}
299static inline int ceph_osd_op_type_pg(int op)
300{
301 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
302}
Alex Elder0315a772013-02-15 11:42:30 -0600303static inline int ceph_osd_op_type_multi(int op)
304{
305 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_MULTI;
306}
Sage Weil0dee3c22009-10-06 11:31:06 -0700307
308static inline int ceph_osd_op_mode_subop(int op)
309{
310 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
311}
312static inline int ceph_osd_op_mode_read(int op)
313{
Alex Elder0315a772013-02-15 11:42:30 -0600314 return (op & CEPH_OSD_OP_MODE_RD) &&
315 op != CEPH_OSD_OP_CALL;
Sage Weil0dee3c22009-10-06 11:31:06 -0700316}
317static inline int ceph_osd_op_mode_modify(int op)
318{
Alex Elder0315a772013-02-15 11:42:30 -0600319 return op & CEPH_OSD_OP_MODE_WR;
Sage Weil0dee3c22009-10-06 11:31:06 -0700320}
321
Sage Weilf0b18d92010-07-07 08:39:03 -0700322/*
323 * note that the following tmap stuff is also defined in the ceph librados.h
324 * any modification here needs to be updated there
325 */
Sage Weil0dee3c22009-10-06 11:31:06 -0700326#define CEPH_OSD_TMAP_HDR 'h'
327#define CEPH_OSD_TMAP_SET 's'
Alex Elder0315a772013-02-15 11:42:30 -0600328#define CEPH_OSD_TMAP_CREATE 'c' /* create key */
Sage Weil0dee3c22009-10-06 11:31:06 -0700329#define CEPH_OSD_TMAP_RM 'r'
Alex Elder0315a772013-02-15 11:42:30 -0600330#define CEPH_OSD_TMAP_RMSLOPPY 'R'
Sage Weil0dee3c22009-10-06 11:31:06 -0700331
332extern const char *ceph_osd_op_name(int op);
333
Sage Weil0dee3c22009-10-06 11:31:06 -0700334/*
335 * osd op flags
336 *
337 * An op may be READ, WRITE, or READ|WRITE.
338 */
339enum {
Alex Elder0315a772013-02-15 11:42:30 -0600340 CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
341 CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
342 CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
343 CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
344 CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
345 CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
346 CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
347 CEPH_OSD_FLAG_PEERSTAT_OLD = 0x0080, /* DEPRECATED msg includes osd_peer_stat */
348 CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
349 CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
350 CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
351 CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
352 CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* DEPRECATED op may exec (public) */
353 CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
354 CEPH_OSD_FLAG_RWORDERED = 0x4000, /* order wrt concurrent reads */
Ilya Dryomov1b3f2ab2014-01-27 17:40:19 +0200355 CEPH_OSD_FLAG_IGNORE_CACHE = 0x8000, /* ignore cache logic */
356 CEPH_OSD_FLAG_SKIPRWLOCKS = 0x10000, /* skip rw locks */
357 CEPH_OSD_FLAG_IGNORE_OVERLAY = 0x20000, /* ignore pool overlay */
358 CEPH_OSD_FLAG_FLUSH = 0x40000, /* this is part of flush */
Sage Weil0dee3c22009-10-06 11:31:06 -0700359};
360
361enum {
362 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
Alex Elder0315a772013-02-15 11:42:30 -0600363 CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
Sage Weil0dee3c22009-10-06 11:31:06 -0700364};
365
366#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
367#define EBLACKLISTED ESHUTDOWN /* blacklisted */
368
Sage Weilca9d93a2010-05-12 14:48:20 -0700369/* xattr comparison */
370enum {
371 CEPH_OSD_CMPXATTR_OP_NOP = 0,
372 CEPH_OSD_CMPXATTR_OP_EQ = 1,
373 CEPH_OSD_CMPXATTR_OP_NE = 2,
374 CEPH_OSD_CMPXATTR_OP_GT = 3,
375 CEPH_OSD_CMPXATTR_OP_GTE = 4,
376 CEPH_OSD_CMPXATTR_OP_LT = 5,
377 CEPH_OSD_CMPXATTR_OP_LTE = 6
378};
379
380enum {
381 CEPH_OSD_CMPXATTR_MODE_STRING = 1,
382 CEPH_OSD_CMPXATTR_MODE_U64 = 2
383};
384
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800385#define RADOS_NOTIFY_VER 1
386
Sage Weil0dee3c22009-10-06 11:31:06 -0700387/*
388 * an individual object operation. each may be accompanied by some data
389 * payload
390 */
391struct ceph_osd_op {
392 __le16 op; /* CEPH_OSD_OP_* */
Ilya Dryomov7b25bf52014-02-25 16:22:26 +0200393 __le32 flags; /* CEPH_OSD_OP_FLAG_* */
Sage Weil0dee3c22009-10-06 11:31:06 -0700394 union {
395 struct {
396 __le64 offset, length;
Yehuda Sadeh0c948992010-02-01 16:10:45 -0800397 __le64 truncate_size;
398 __le32 truncate_seq;
Sage Weil0dee3c22009-10-06 11:31:06 -0700399 } __attribute__ ((packed)) extent;
400 struct {
401 __le32 name_len;
402 __le32 value_len;
Sage Weilca9d93a2010-05-12 14:48:20 -0700403 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
404 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
Sage Weil0dee3c22009-10-06 11:31:06 -0700405 } __attribute__ ((packed)) xattr;
406 struct {
Sage Weil0dee3c22009-10-06 11:31:06 -0700407 __u8 class_len;
408 __u8 method_len;
409 __u8 argc;
410 __le32 indata_len;
411 } __attribute__ ((packed)) cls;
412 struct {
413 __le64 cookie, count;
414 } __attribute__ ((packed)) pgls;
Sage Weilf0b18d92010-07-07 08:39:03 -0700415 struct {
416 __le64 snapid;
417 } __attribute__ ((packed)) snap;
Yehuda Sadeh483fac72011-01-20 16:36:06 -0800418 struct {
419 __le64 cookie;
420 __le64 ver;
421 __u8 flag; /* 0 = unwatch, 1 = watch */
422 } __attribute__ ((packed)) watch;
Alex Elder0315a772013-02-15 11:42:30 -0600423 struct {
424 __le64 offset, length;
425 __le64 src_offset;
426 } __attribute__ ((packed)) clonerange;
Ilya Dryomovc647b8a2014-02-25 16:22:27 +0200427 struct {
428 __le64 expected_object_size;
429 __le64 expected_write_size;
430 } __attribute__ ((packed)) alloc_hint;
Alex Elder0315a772013-02-15 11:42:30 -0600431 };
Sage Weil0dee3c22009-10-06 11:31:06 -0700432 __le32 payload_len;
433} __attribute__ ((packed));
434
Sage Weil0dee3c22009-10-06 11:31:06 -0700435
Sage Weil0dee3c22009-10-06 11:31:06 -0700436#endif