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

Method put_cap_ref

src/client/Client.cc:3864–3906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3862}
3863
3864void Client::put_cap_ref(Inode *in, int cap)
3865{
3866 int last = in->put_cap_ref(cap);
3867 if (last) {
3868 int put_nref = 0;
3869 int drop = last & ~in->caps_issued();
3870 if (in->snapid == CEPH_NOSNAP) {
3871 if ((last & CEPH_CAP_FILE_WR) &&
3872 !in->cap_snaps.empty() &&
3873 in->cap_snaps.rbegin()->second.writing) {
3874 ldout(cct, 10) << __func__ << " finishing pending cap_snap on " << *in << dendl;
3875 in->cap_snaps.rbegin()->second.writing = 0;
3876 finish_cap_snap(in, in->cap_snaps.rbegin()->second, get_caps_used(in));
3877 ldout(cct, 10) << __func__ << " calling signal_caps_inode" << dendl;
3878 signal_caps_inode(in); // wake up blocked sync writers
3879 }
3880 if (last & CEPH_CAP_FILE_BUFFER) {
3881 for (auto &p : in->cap_snaps)
3882 p.second.dirty_data = 0;
3883 signal_context_list(in->waitfor_commit);
3884 ldout(cct, 5) << __func__ << " dropped last FILE_BUFFER ref on " << *in << dendl;
3885 if (!in->is_write_delegated()) {
3886 ++put_nref;
3887 }
3888
3889 if (!in->cap_snaps.empty()) {
3890 flush_snaps(in);
3891 }
3892 }
3893 }
3894 if (last & CEPH_CAP_FILE_CACHE) {
3895 ldout(cct, 5) << __func__ << " dropped last FILE_CACHE ref on " << *in << dendl;
3896 ++put_nref;
3897
3898 ldout(cct, 10) << __func__ << " calling signal_caps_inode" << dendl;
3899 signal_caps_inode(in);
3900 }
3901 if (drop)
3902 check_caps(in, 0);
3903 if (put_nref)
3904 put_inode(in, put_nref);
3905 }
3906}
3907
3908// get caps for a given file handle -- the inode should have @need caps
3909// issued by the mds and @want caps not revoked (or not under revocation).

Callers 4

finish_ioMethod · 0.45
finishMethod · 0.45
try_completeMethod · 0.45
do_try_finishMethod · 0.45

Calls 4

caps_issuedMethod · 0.80
emptyMethod · 0.45
rbeginMethod · 0.45
is_write_delegatedMethod · 0.45

Tested by

no test coverage detected