MCPcopy Create free account
hub / github.com/ceph/ceph / caps_issued_mask

Method caps_issued_mask

src/client/Inode.cc:301–344  ·  view source on GitHub ↗

* caps_issued_mask - check whether we have all of the caps in the mask * @mask: mask to check against * @allow_impl: whether the caller can also use caps that are implemented but not issued * * This is the bog standard "check whether we have the required caps" operation. * Typically, we only check against the capset that is currently "issued". * In other words, we ignore caps that have been

Source from the content-addressed store, hash-verified

299 * caps!
300 */
301bool Inode::caps_issued_mask(unsigned mask, bool allow_impl)
302{
303 int c = snap_caps;
304 int i = 0;
305
306 if ((c & mask) == mask)
307 return true;
308 // prefer auth cap
309 if (auth_cap &&
310 cap_is_valid(*auth_cap) &&
311 (auth_cap->issued & mask) == mask) {
312 auth_cap->touch();
313 client->cap_hit();
314 return true;
315 }
316 // try any cap
317 for (auto &pair : caps) {
318 Cap &cap = pair.second;
319 if (cap_is_valid(cap)) {
320 if ((cap.issued & mask) == mask) {
321 cap.touch();
322 client->cap_hit();
323 return true;
324 }
325 c |= cap.issued;
326 i |= cap.implemented;
327 }
328 }
329
330 if (allow_impl)
331 c |= i;
332
333 if ((c & mask) == mask) {
334 // bah.. touch them all
335 for (auto &pair : caps) {
336 pair.second.touch();
337 }
338 client->cap_hit();
339 return true;
340 }
341
342 client->cap_miss();
343 return false;
344}
345
346int Inode::caps_used()
347{

Callers 8

remove_session_capsMethod · 0.80
_lookupMethod · 0.80
_getattrMethod · 0.80
_do_setattrMethod · 0.80
_readdir_r_cbMethod · 0.80
_openMethod · 0.80
ll_getattrxMethod · 0.80
_is_empty_directoryMethod · 0.80

Calls 3

cap_hitMethod · 0.80
cap_missMethod · 0.80
touchMethod · 0.45

Tested by

no test coverage detected