rados.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. #ifndef CEPH_RADOS_H
  2. #define CEPH_RADOS_H
  3. /*
  4. * Data types for the Ceph distributed object storage layer RADOS
  5. * (Reliable Autonomic Distributed Object Store).
  6. */
  7. #include <linux/ceph/msgr.h>
  8. /*
  9. * fs id
  10. */
  11. struct ceph_fsid {
  12. unsigned char fsid[16];
  13. };
  14. static inline int ceph_fsid_compare(const struct ceph_fsid *a,
  15. const struct ceph_fsid *b)
  16. {
  17. return memcmp(a, b, sizeof(*a));
  18. }
  19. /*
  20. * ino, object, etc.
  21. */
  22. typedef __le64 ceph_snapid_t;
  23. #define CEPH_SNAPDIR ((__u64)(-1)) /* reserved for hidden .snap dir */
  24. #define CEPH_NOSNAP ((__u64)(-2)) /* "head", "live" revision */
  25. #define CEPH_MAXSNAP ((__u64)(-3)) /* largest valid snapid */
  26. struct ceph_timespec {
  27. __le32 tv_sec;
  28. __le32 tv_nsec;
  29. } __attribute__ ((packed));
  30. /*
  31. * object layout - how objects are mapped into PGs
  32. */
  33. #define CEPH_OBJECT_LAYOUT_HASH 1
  34. #define CEPH_OBJECT_LAYOUT_LINEAR 2
  35. #define CEPH_OBJECT_LAYOUT_HASHINO 3
  36. /*
  37. * pg layout -- how PGs are mapped onto (sets of) OSDs
  38. */
  39. #define CEPH_PG_LAYOUT_CRUSH 0
  40. #define CEPH_PG_LAYOUT_HASH 1
  41. #define CEPH_PG_LAYOUT_LINEAR 2
  42. #define CEPH_PG_LAYOUT_HYBRID 3
  43. #define CEPH_PG_MAX_SIZE 16 /* max # osds in a single pg */
  44. /*
  45. * placement group.
  46. * we encode this into one __le64.
  47. */
  48. struct ceph_pg_v1 {
  49. __le16 preferred; /* preferred primary osd */
  50. __le16 ps; /* placement seed */
  51. __le32 pool; /* object pool */
  52. } __attribute__ ((packed));
  53. /*
  54. * pg_pool is a set of pgs storing a pool of objects
  55. *
  56. * pg_num -- base number of pseudorandomly placed pgs
  57. *
  58. * pgp_num -- effective number when calculating pg placement. this
  59. * is used for pg_num increases. new pgs result in data being "split"
  60. * into new pgs. for this to proceed smoothly, new pgs are intiially
  61. * colocated with their parents; that is, pgp_num doesn't increase
  62. * until the new pgs have successfully split. only _then_ are the new
  63. * pgs placed independently.
  64. *
  65. * lpg_num -- localized pg count (per device). replicas are randomly
  66. * selected.
  67. *
  68. * lpgp_num -- as above.
  69. */
  70. #define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
  71. #define CEPH_POOL_TYPE_REP 1
  72. #define CEPH_POOL_TYPE_RAID4 2 /* never implemented */
  73. #define CEPH_POOL_TYPE_EC 3
  74. /*
  75. * stable_mod func is used to control number of placement groups.
  76. * similar to straight-up modulo, but produces a stable mapping as b
  77. * increases over time. b is the number of bins, and bmask is the
  78. * containing power of 2 minus 1.
  79. *
  80. * b <= bmask and bmask=(2**n)-1
  81. * e.g., b=12 -> bmask=15, b=123 -> bmask=127
  82. */
  83. static inline int ceph_stable_mod(int x, int b, int bmask)
  84. {
  85. if ((x & bmask) < b)
  86. return x & bmask;
  87. else
  88. return x & (bmask >> 1);
  89. }
  90. /*
  91. * object layout - how a given object should be stored.
  92. */
  93. struct ceph_object_layout {
  94. struct ceph_pg_v1 ol_pgid; /* raw pg, with _full_ ps precision. */
  95. __le32 ol_stripe_unit; /* for per-object parity, if any */
  96. } __attribute__ ((packed));
  97. /*
  98. * compound epoch+version, used by storage layer to serialize mutations
  99. */
  100. struct ceph_eversion {
  101. __le32 epoch;
  102. __le64 version;
  103. } __attribute__ ((packed));
  104. /*
  105. * osd map bits
  106. */
  107. /* status bits */
  108. #define CEPH_OSD_EXISTS (1<<0)
  109. #define CEPH_OSD_UP (1<<1)
  110. #define CEPH_OSD_AUTOOUT (1<<2) /* osd was automatically marked out */
  111. #define CEPH_OSD_NEW (1<<3) /* osd is new, never marked in */
  112. extern const char *ceph_osd_state_name(int s);
  113. /* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
  114. #define CEPH_OSD_IN 0x10000
  115. #define CEPH_OSD_OUT 0
  116. /* osd primary-affinity. fixed point value: 0x10000 == baseline */
  117. #define CEPH_OSD_MAX_PRIMARY_AFFINITY 0x10000
  118. #define CEPH_OSD_DEFAULT_PRIMARY_AFFINITY 0x10000
  119. /*
  120. * osd map flag bits
  121. */
  122. #define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
  123. #define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
  124. #define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
  125. #define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
  126. #define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
  127. #define CEPH_OSDMAP_NOUP (1<<5) /* block osd boot */
  128. #define CEPH_OSDMAP_NODOWN (1<<6) /* block osd mark-down/failure */
  129. #define CEPH_OSDMAP_NOOUT (1<<7) /* block osd auto mark-out */
  130. #define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */
  131. #define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */
  132. #define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */
  133. /*
  134. * The error code to return when an OSD can't handle a write
  135. * because it is too large.
  136. */
  137. #define OSD_WRITETOOBIG EMSGSIZE
  138. /*
  139. * osd ops
  140. *
  141. * WARNING: do not use these op codes directly. Use the helpers
  142. * defined below instead. In certain cases, op code behavior was
  143. * redefined, resulting in special-cases in the helpers.
  144. */
  145. #define CEPH_OSD_OP_MODE 0xf000
  146. #define CEPH_OSD_OP_MODE_RD 0x1000
  147. #define CEPH_OSD_OP_MODE_WR 0x2000
  148. #define CEPH_OSD_OP_MODE_RMW 0x3000
  149. #define CEPH_OSD_OP_MODE_SUB 0x4000
  150. #define CEPH_OSD_OP_MODE_CACHE 0x8000
  151. #define CEPH_OSD_OP_TYPE 0x0f00
  152. #define CEPH_OSD_OP_TYPE_LOCK 0x0100
  153. #define CEPH_OSD_OP_TYPE_DATA 0x0200
  154. #define CEPH_OSD_OP_TYPE_ATTR 0x0300
  155. #define CEPH_OSD_OP_TYPE_EXEC 0x0400
  156. #define CEPH_OSD_OP_TYPE_PG 0x0500
  157. #define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
  158. #define __CEPH_OSD_OP1(mode, nr) \
  159. (CEPH_OSD_OP_MODE_##mode | (nr))
  160. #define __CEPH_OSD_OP(mode, type, nr) \
  161. (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr))
  162. #define __CEPH_FORALL_OSD_OPS(f) \
  163. /** data **/ \
  164. /* read */ \
  165. f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \
  166. f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \
  167. f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \
  168. \
  169. /* fancy read */ \
  170. f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \
  171. f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \
  172. \
  173. f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \
  174. f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \
  175. \
  176. /* versioning */ \
  177. f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \
  178. \
  179. f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \
  180. \
  181. f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \
  182. \
  183. /* sync */ \
  184. f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \
  185. \
  186. /* write */ \
  187. f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \
  188. f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \
  189. f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \
  190. f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \
  191. f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \
  192. \
  193. /* fancy write */ \
  194. f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \
  195. f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \
  196. f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \
  197. f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \
  198. \
  199. f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \
  200. f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \
  201. f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \
  202. \
  203. f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \
  204. f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \
  205. \
  206. f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \
  207. \
  208. /* omap */ \
  209. f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \
  210. f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \
  211. f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \
  212. f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \
  213. f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \
  214. f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \
  215. f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \
  216. f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \
  217. f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \
  218. \
  219. /* tiering */ \
  220. f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \
  221. f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \
  222. f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \
  223. f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \
  224. f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \
  225. f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \
  226. f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \
  227. f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \
  228. \
  229. /* convert tmap to omap */ \
  230. f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \
  231. \
  232. /* hints */ \
  233. f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \
  234. \
  235. /** multi **/ \
  236. f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \
  237. f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \
  238. f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \
  239. \
  240. /** attrs **/ \
  241. /* read */ \
  242. f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \
  243. f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \
  244. f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \
  245. \
  246. /* write */ \
  247. f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \
  248. f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \
  249. f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \
  250. f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \
  251. \
  252. /** subop **/ \
  253. f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \
  254. f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \
  255. f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \
  256. f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \
  257. f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \
  258. f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \
  259. f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \
  260. f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \
  261. f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \
  262. \
  263. /** lock **/ \
  264. f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \
  265. f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \
  266. f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \
  267. f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \
  268. f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \
  269. f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \
  270. \
  271. /** exec **/ \
  272. /* note: the RD bit here is wrong; see special-case below in helper */ \
  273. f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \
  274. \
  275. /** pg **/ \
  276. f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \
  277. f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \
  278. f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \
  279. f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get")
  280. enum {
  281. #define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode),
  282. __CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY)
  283. #undef GENERATE_ENUM_ENTRY
  284. };
  285. static inline int ceph_osd_op_type_lock(int op)
  286. {
  287. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
  288. }
  289. static inline int ceph_osd_op_type_data(int op)
  290. {
  291. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
  292. }
  293. static inline int ceph_osd_op_type_attr(int op)
  294. {
  295. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
  296. }
  297. static inline int ceph_osd_op_type_exec(int op)
  298. {
  299. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_EXEC;
  300. }
  301. static inline int ceph_osd_op_type_pg(int op)
  302. {
  303. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
  304. }
  305. static inline int ceph_osd_op_type_multi(int op)
  306. {
  307. return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_MULTI;
  308. }
  309. static inline int ceph_osd_op_mode_subop(int op)
  310. {
  311. return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
  312. }
  313. static inline int ceph_osd_op_mode_read(int op)
  314. {
  315. return (op & CEPH_OSD_OP_MODE_RD) &&
  316. op != CEPH_OSD_OP_CALL;
  317. }
  318. static inline int ceph_osd_op_mode_modify(int op)
  319. {
  320. return op & CEPH_OSD_OP_MODE_WR;
  321. }
  322. /*
  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. */
  326. #define CEPH_OSD_TMAP_HDR 'h'
  327. #define CEPH_OSD_TMAP_SET 's'
  328. #define CEPH_OSD_TMAP_CREATE 'c' /* create key */
  329. #define CEPH_OSD_TMAP_RM 'r'
  330. #define CEPH_OSD_TMAP_RMSLOPPY 'R'
  331. extern const char *ceph_osd_op_name(int op);
  332. /*
  333. * osd op flags
  334. *
  335. * An op may be READ, WRITE, or READ|WRITE.
  336. */
  337. enum {
  338. CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
  339. CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
  340. CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
  341. CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
  342. CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
  343. CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
  344. CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
  345. CEPH_OSD_FLAG_PEERSTAT_OLD = 0x0080, /* DEPRECATED msg includes osd_peer_stat */
  346. CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
  347. CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
  348. CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
  349. CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
  350. CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* DEPRECATED op may exec (public) */
  351. CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
  352. CEPH_OSD_FLAG_RWORDERED = 0x4000, /* order wrt concurrent reads */
  353. CEPH_OSD_FLAG_IGNORE_CACHE = 0x8000, /* ignore cache logic */
  354. CEPH_OSD_FLAG_SKIPRWLOCKS = 0x10000, /* skip rw locks */
  355. CEPH_OSD_FLAG_IGNORE_OVERLAY = 0x20000, /* ignore pool overlay */
  356. CEPH_OSD_FLAG_FLUSH = 0x40000, /* this is part of flush */
  357. };
  358. enum {
  359. CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
  360. CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
  361. };
  362. #define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
  363. #define EBLACKLISTED ESHUTDOWN /* blacklisted */
  364. /* xattr comparison */
  365. enum {
  366. CEPH_OSD_CMPXATTR_OP_NOP = 0,
  367. CEPH_OSD_CMPXATTR_OP_EQ = 1,
  368. CEPH_OSD_CMPXATTR_OP_NE = 2,
  369. CEPH_OSD_CMPXATTR_OP_GT = 3,
  370. CEPH_OSD_CMPXATTR_OP_GTE = 4,
  371. CEPH_OSD_CMPXATTR_OP_LT = 5,
  372. CEPH_OSD_CMPXATTR_OP_LTE = 6
  373. };
  374. enum {
  375. CEPH_OSD_CMPXATTR_MODE_STRING = 1,
  376. CEPH_OSD_CMPXATTR_MODE_U64 = 2
  377. };
  378. #define RADOS_NOTIFY_VER 1
  379. /*
  380. * an individual object operation. each may be accompanied by some data
  381. * payload
  382. */
  383. struct ceph_osd_op {
  384. __le16 op; /* CEPH_OSD_OP_* */
  385. __le32 flags; /* CEPH_OSD_OP_FLAG_* */
  386. union {
  387. struct {
  388. __le64 offset, length;
  389. __le64 truncate_size;
  390. __le32 truncate_seq;
  391. } __attribute__ ((packed)) extent;
  392. struct {
  393. __le32 name_len;
  394. __le32 value_len;
  395. __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
  396. __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
  397. } __attribute__ ((packed)) xattr;
  398. struct {
  399. __u8 class_len;
  400. __u8 method_len;
  401. __u8 argc;
  402. __le32 indata_len;
  403. } __attribute__ ((packed)) cls;
  404. struct {
  405. __le64 cookie, count;
  406. } __attribute__ ((packed)) pgls;
  407. struct {
  408. __le64 snapid;
  409. } __attribute__ ((packed)) snap;
  410. struct {
  411. __le64 cookie;
  412. __le64 ver;
  413. __u8 flag; /* 0 = unwatch, 1 = watch */
  414. } __attribute__ ((packed)) watch;
  415. struct {
  416. __le64 offset, length;
  417. __le64 src_offset;
  418. } __attribute__ ((packed)) clonerange;
  419. struct {
  420. __le64 expected_object_size;
  421. __le64 expected_write_size;
  422. } __attribute__ ((packed)) alloc_hint;
  423. };
  424. __le32 payload_len;
  425. } __attribute__ ((packed));
  426. #endif