diff options
-rw-r--r-- | include/linux/ceph/rados.h | 225 | ||||
-rw-r--r-- | net/ceph/ceph_strings.c | 75 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 65 |
3 files changed, 137 insertions, 228 deletions
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h index f20e0d8a2155..2f822dca1046 100644 --- a/include/linux/ceph/rados.h +++ b/include/linux/ceph/rados.h | |||
@@ -172,6 +172,7 @@ extern const char *ceph_osd_state_name(int s); | |||
172 | #define CEPH_OSD_OP_MODE_WR 0x2000 | 172 | #define CEPH_OSD_OP_MODE_WR 0x2000 |
173 | #define CEPH_OSD_OP_MODE_RMW 0x3000 | 173 | #define CEPH_OSD_OP_MODE_RMW 0x3000 |
174 | #define CEPH_OSD_OP_MODE_SUB 0x4000 | 174 | #define CEPH_OSD_OP_MODE_SUB 0x4000 |
175 | #define CEPH_OSD_OP_MODE_CACHE 0x8000 | ||
175 | 176 | ||
176 | #define CEPH_OSD_OP_TYPE 0x0f00 | 177 | #define CEPH_OSD_OP_TYPE 0x0f00 |
177 | #define CEPH_OSD_OP_TYPE_LOCK 0x0100 | 178 | #define CEPH_OSD_OP_TYPE_LOCK 0x0100 |
@@ -181,103 +182,135 @@ extern const char *ceph_osd_state_name(int s); | |||
181 | #define CEPH_OSD_OP_TYPE_PG 0x0500 | 182 | #define CEPH_OSD_OP_TYPE_PG 0x0500 |
182 | #define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ | 183 | #define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ |
183 | 184 | ||
185 | #define __CEPH_OSD_OP1(mode, nr) \ | ||
186 | (CEPH_OSD_OP_MODE_##mode | (nr)) | ||
187 | |||
188 | #define __CEPH_OSD_OP(mode, type, nr) \ | ||
189 | (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr)) | ||
190 | |||
191 | #define __CEPH_FORALL_OSD_OPS(f) \ | ||
192 | /** data **/ \ | ||
193 | /* read */ \ | ||
194 | f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \ | ||
195 | f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \ | ||
196 | f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \ | ||
197 | \ | ||
198 | /* fancy read */ \ | ||
199 | f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \ | ||
200 | f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \ | ||
201 | \ | ||
202 | f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \ | ||
203 | f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \ | ||
204 | \ | ||
205 | /* versioning */ \ | ||
206 | f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \ | ||
207 | \ | ||
208 | f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \ | ||
209 | \ | ||
210 | f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \ | ||
211 | \ | ||
212 | /* sync */ \ | ||
213 | f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \ | ||
214 | \ | ||
215 | /* write */ \ | ||
216 | f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \ | ||
217 | f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \ | ||
218 | f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \ | ||
219 | f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \ | ||
220 | f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \ | ||
221 | \ | ||
222 | /* fancy write */ \ | ||
223 | f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \ | ||
224 | f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \ | ||
225 | f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \ | ||
226 | f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \ | ||
227 | \ | ||
228 | f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \ | ||
229 | f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \ | ||
230 | f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \ | ||
231 | \ | ||
232 | f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \ | ||
233 | f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \ | ||
234 | \ | ||
235 | f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \ | ||
236 | \ | ||
237 | /* omap */ \ | ||
238 | f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \ | ||
239 | f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \ | ||
240 | f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \ | ||
241 | f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \ | ||
242 | f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \ | ||
243 | f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \ | ||
244 | f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \ | ||
245 | f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \ | ||
246 | f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \ | ||
247 | \ | ||
248 | /* tiering */ \ | ||
249 | f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \ | ||
250 | f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \ | ||
251 | f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \ | ||
252 | f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \ | ||
253 | f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \ | ||
254 | f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \ | ||
255 | f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \ | ||
256 | f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \ | ||
257 | \ | ||
258 | /* convert tmap to omap */ \ | ||
259 | f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \ | ||
260 | \ | ||
261 | /* hints */ \ | ||
262 | f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \ | ||
263 | \ | ||
264 | /** multi **/ \ | ||
265 | f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \ | ||
266 | f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \ | ||
267 | f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \ | ||
268 | \ | ||
269 | /** attrs **/ \ | ||
270 | /* read */ \ | ||
271 | f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \ | ||
272 | f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \ | ||
273 | f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \ | ||
274 | \ | ||
275 | /* write */ \ | ||
276 | f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \ | ||
277 | f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \ | ||
278 | f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \ | ||
279 | f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \ | ||
280 | \ | ||
281 | /** subop **/ \ | ||
282 | f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \ | ||
283 | f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \ | ||
284 | f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \ | ||
285 | f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \ | ||
286 | f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \ | ||
287 | f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \ | ||
288 | f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \ | ||
289 | f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \ | ||
290 | f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \ | ||
291 | \ | ||
292 | /** lock **/ \ | ||
293 | f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \ | ||
294 | f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \ | ||
295 | f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \ | ||
296 | f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \ | ||
297 | f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \ | ||
298 | f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \ | ||
299 | \ | ||
300 | /** exec **/ \ | ||
301 | /* note: the RD bit here is wrong; see special-case below in helper */ \ | ||
302 | f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \ | ||
303 | \ | ||
304 | /** pg **/ \ | ||
305 | f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \ | ||
306 | f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \ | ||
307 | f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \ | ||
308 | f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get") | ||
309 | |||
184 | enum { | 310 | enum { |
185 | /** data **/ | 311 | #define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode), |
186 | /* read */ | 312 | __CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY) |
187 | CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, | 313 | #undef GENERATE_ENUM_ENTRY |
188 | CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, | ||
189 | CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3, | ||
190 | |||
191 | /* fancy read */ | ||
192 | 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, | ||
200 | |||
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, | ||
219 | CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, | ||
220 | |||
221 | CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15, | ||
222 | |||
223 | /* 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 | |||
235 | /* hints */ | ||
236 | CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35, | ||
237 | |||
238 | /** 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 | |||
243 | /** 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, | ||
247 | CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3, | ||
248 | |||
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 **/ | ||
256 | 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, | ||
264 | CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9, | ||
265 | |||
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 **/ | ||
275 | /* note: the RD bit here is wrong; see special-case below in helper */ | ||
276 | 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, | ||
280 | CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2, | ||
281 | }; | 314 | }; |
282 | 315 | ||
283 | static inline int ceph_osd_op_type_lock(int op) | 316 | static inline int ceph_osd_op_type_lock(int op) |
diff --git a/net/ceph/ceph_strings.c b/net/ceph/ceph_strings.c index 1348df96fe15..30560202f57b 100644 --- a/net/ceph/ceph_strings.c +++ b/net/ceph/ceph_strings.c | |||
@@ -19,77 +19,12 @@ const char *ceph_entity_type_name(int type) | |||
19 | const char *ceph_osd_op_name(int op) | 19 | const char *ceph_osd_op_name(int op) |
20 | { | 20 | { |
21 | switch (op) { | 21 | switch (op) { |
22 | case CEPH_OSD_OP_READ: return "read"; | 22 | #define GENERATE_CASE(op, opcode, str) case CEPH_OSD_OP_##op: return (str); |
23 | case CEPH_OSD_OP_STAT: return "stat"; | 23 | __CEPH_FORALL_OSD_OPS(GENERATE_CASE) |
24 | case CEPH_OSD_OP_MAPEXT: return "mapext"; | 24 | #undef GENERATE_CASE |
25 | case CEPH_OSD_OP_SPARSE_READ: return "sparse-read"; | 25 | default: |
26 | case CEPH_OSD_OP_NOTIFY: return "notify"; | 26 | return "???"; |
27 | case CEPH_OSD_OP_NOTIFY_ACK: return "notify-ack"; | ||
28 | case CEPH_OSD_OP_ASSERT_VER: return "assert-version"; | ||
29 | |||
30 | case CEPH_OSD_OP_MASKTRUNC: return "masktrunc"; | ||
31 | |||
32 | case CEPH_OSD_OP_CREATE: return "create"; | ||
33 | case CEPH_OSD_OP_WRITE: return "write"; | ||
34 | case CEPH_OSD_OP_DELETE: return "delete"; | ||
35 | case CEPH_OSD_OP_TRUNCATE: return "truncate"; | ||
36 | case CEPH_OSD_OP_ZERO: return "zero"; | ||
37 | case CEPH_OSD_OP_WRITEFULL: return "writefull"; | ||
38 | case CEPH_OSD_OP_ROLLBACK: return "rollback"; | ||
39 | |||
40 | case CEPH_OSD_OP_APPEND: return "append"; | ||
41 | case CEPH_OSD_OP_STARTSYNC: return "startsync"; | ||
42 | case CEPH_OSD_OP_SETTRUNC: return "settrunc"; | ||
43 | case CEPH_OSD_OP_TRIMTRUNC: return "trimtrunc"; | ||
44 | |||
45 | case CEPH_OSD_OP_TMAPUP: return "tmapup"; | ||
46 | case CEPH_OSD_OP_TMAPGET: return "tmapget"; | ||
47 | case CEPH_OSD_OP_TMAPPUT: return "tmapput"; | ||
48 | case CEPH_OSD_OP_WATCH: return "watch"; | ||
49 | |||
50 | case CEPH_OSD_OP_CLONERANGE: return "clonerange"; | ||
51 | case CEPH_OSD_OP_ASSERT_SRC_VERSION: return "assert-src-version"; | ||
52 | case CEPH_OSD_OP_SRC_CMPXATTR: return "src-cmpxattr"; | ||
53 | |||
54 | case CEPH_OSD_OP_GETXATTR: return "getxattr"; | ||
55 | case CEPH_OSD_OP_GETXATTRS: return "getxattrs"; | ||
56 | case CEPH_OSD_OP_SETXATTR: return "setxattr"; | ||
57 | case CEPH_OSD_OP_SETXATTRS: return "setxattrs"; | ||
58 | case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs"; | ||
59 | case CEPH_OSD_OP_RMXATTR: return "rmxattr"; | ||
60 | case CEPH_OSD_OP_CMPXATTR: return "cmpxattr"; | ||
61 | |||
62 | case CEPH_OSD_OP_PULL: return "pull"; | ||
63 | case CEPH_OSD_OP_PUSH: return "push"; | ||
64 | case CEPH_OSD_OP_BALANCEREADS: return "balance-reads"; | ||
65 | case CEPH_OSD_OP_UNBALANCEREADS: return "unbalance-reads"; | ||
66 | case CEPH_OSD_OP_SCRUB: return "scrub"; | ||
67 | case CEPH_OSD_OP_SCRUB_RESERVE: return "scrub-reserve"; | ||
68 | case CEPH_OSD_OP_SCRUB_UNRESERVE: return "scrub-unreserve"; | ||
69 | case CEPH_OSD_OP_SCRUB_STOP: return "scrub-stop"; | ||
70 | case CEPH_OSD_OP_SCRUB_MAP: return "scrub-map"; | ||
71 | |||
72 | case CEPH_OSD_OP_WRLOCK: return "wrlock"; | ||
73 | case CEPH_OSD_OP_WRUNLOCK: return "wrunlock"; | ||
74 | case CEPH_OSD_OP_RDLOCK: return "rdlock"; | ||
75 | case CEPH_OSD_OP_RDUNLOCK: return "rdunlock"; | ||
76 | case CEPH_OSD_OP_UPLOCK: return "uplock"; | ||
77 | case CEPH_OSD_OP_DNLOCK: return "dnlock"; | ||
78 | |||
79 | case CEPH_OSD_OP_CALL: return "call"; | ||
80 | |||
81 | case CEPH_OSD_OP_PGLS: return "pgls"; | ||
82 | case CEPH_OSD_OP_PGLS_FILTER: return "pgls-filter"; | ||
83 | case CEPH_OSD_OP_OMAPGETKEYS: return "omap-get-keys"; | ||
84 | case CEPH_OSD_OP_OMAPGETVALS: return "omap-get-vals"; | ||
85 | case CEPH_OSD_OP_OMAPGETHEADER: return "omap-get-header"; | ||
86 | case CEPH_OSD_OP_OMAPGETVALSBYKEYS: return "omap-get-vals-by-keys"; | ||
87 | case CEPH_OSD_OP_OMAPSETVALS: return "omap-set-vals"; | ||
88 | case CEPH_OSD_OP_OMAPSETHEADER: return "omap-set-header"; | ||
89 | case CEPH_OSD_OP_OMAPCLEAR: return "omap-clear"; | ||
90 | case CEPH_OSD_OP_OMAPRMKEYS: return "omap-rm-keys"; | ||
91 | } | 27 | } |
92 | return "???"; | ||
93 | } | 28 | } |
94 | 29 | ||
95 | const char *ceph_osd_state_name(int s) | 30 | const char *ceph_osd_state_name(int s) |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index a528ea34253a..f3fc54eac09d 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -431,68 +431,9 @@ EXPORT_SYMBOL(ceph_osdc_alloc_request); | |||
431 | static bool osd_req_opcode_valid(u16 opcode) | 431 | static bool osd_req_opcode_valid(u16 opcode) |
432 | { | 432 | { |
433 | switch (opcode) { | 433 | switch (opcode) { |
434 | case CEPH_OSD_OP_READ: | 434 | #define GENERATE_CASE(op, opcode, str) case CEPH_OSD_OP_##op: return true; |
435 | case CEPH_OSD_OP_STAT: | 435 | __CEPH_FORALL_OSD_OPS(GENERATE_CASE) |
436 | case CEPH_OSD_OP_MAPEXT: | 436 | #undef GENERATE_CASE |
437 | case CEPH_OSD_OP_MASKTRUNC: | ||
438 | case CEPH_OSD_OP_SPARSE_READ: | ||
439 | case CEPH_OSD_OP_NOTIFY: | ||
440 | case CEPH_OSD_OP_NOTIFY_ACK: | ||
441 | case CEPH_OSD_OP_ASSERT_VER: | ||
442 | case CEPH_OSD_OP_WRITE: | ||
443 | case CEPH_OSD_OP_WRITEFULL: | ||
444 | case CEPH_OSD_OP_TRUNCATE: | ||
445 | case CEPH_OSD_OP_ZERO: | ||
446 | case CEPH_OSD_OP_DELETE: | ||
447 | case CEPH_OSD_OP_APPEND: | ||
448 | case CEPH_OSD_OP_STARTSYNC: | ||
449 | case CEPH_OSD_OP_SETTRUNC: | ||
450 | case CEPH_OSD_OP_TRIMTRUNC: | ||
451 | case CEPH_OSD_OP_TMAPUP: | ||
452 | case CEPH_OSD_OP_TMAPPUT: | ||
453 | case CEPH_OSD_OP_TMAPGET: | ||
454 | case CEPH_OSD_OP_CREATE: | ||
455 | case CEPH_OSD_OP_ROLLBACK: | ||
456 | case CEPH_OSD_OP_WATCH: | ||
457 | case CEPH_OSD_OP_OMAPGETKEYS: | ||
458 | case CEPH_OSD_OP_OMAPGETVALS: | ||
459 | case CEPH_OSD_OP_OMAPGETHEADER: | ||
460 | case CEPH_OSD_OP_OMAPGETVALSBYKEYS: | ||
461 | case CEPH_OSD_OP_OMAPSETVALS: | ||
462 | case CEPH_OSD_OP_OMAPSETHEADER: | ||
463 | case CEPH_OSD_OP_OMAPCLEAR: | ||
464 | case CEPH_OSD_OP_OMAPRMKEYS: | ||
465 | case CEPH_OSD_OP_OMAP_CMP: | ||
466 | case CEPH_OSD_OP_SETALLOCHINT: | ||
467 | case CEPH_OSD_OP_CLONERANGE: | ||
468 | case CEPH_OSD_OP_ASSERT_SRC_VERSION: | ||
469 | case CEPH_OSD_OP_SRC_CMPXATTR: | ||
470 | case CEPH_OSD_OP_GETXATTR: | ||
471 | case CEPH_OSD_OP_GETXATTRS: | ||
472 | case CEPH_OSD_OP_CMPXATTR: | ||
473 | case CEPH_OSD_OP_SETXATTR: | ||
474 | case CEPH_OSD_OP_SETXATTRS: | ||
475 | case CEPH_OSD_OP_RESETXATTRS: | ||
476 | case CEPH_OSD_OP_RMXATTR: | ||
477 | case CEPH_OSD_OP_PULL: | ||
478 | case CEPH_OSD_OP_PUSH: | ||
479 | case CEPH_OSD_OP_BALANCEREADS: | ||
480 | case CEPH_OSD_OP_UNBALANCEREADS: | ||
481 | case CEPH_OSD_OP_SCRUB: | ||
482 | case CEPH_OSD_OP_SCRUB_RESERVE: | ||
483 | case CEPH_OSD_OP_SCRUB_UNRESERVE: | ||
484 | case CEPH_OSD_OP_SCRUB_STOP: | ||
485 | case CEPH_OSD_OP_SCRUB_MAP: | ||
486 | case CEPH_OSD_OP_WRLOCK: | ||
487 | case CEPH_OSD_OP_WRUNLOCK: | ||
488 | case CEPH_OSD_OP_RDLOCK: | ||
489 | case CEPH_OSD_OP_RDUNLOCK: | ||
490 | case CEPH_OSD_OP_UPLOCK: | ||
491 | case CEPH_OSD_OP_DNLOCK: | ||
492 | case CEPH_OSD_OP_CALL: | ||
493 | case CEPH_OSD_OP_PGLS: | ||
494 | case CEPH_OSD_OP_PGLS_FILTER: | ||
495 | return true; | ||
496 | default: | 437 | default: |
497 | return false; | 438 | return false; |
498 | } | 439 | } |