Not sure I can make this actually private and make Client::put_inode() a
friend method (making all of Client a friend would defeat the purpose).
This works well enough, though!
Signed-off-by: Sage Weil <sage@inktank.com>
if (old_dentry)
unlink(old_dentry, dir == old_dentry->dir); // keep dir open if its the same dir
dn = link(dir, dname, in, dn);
- in->put();
+ put_inode(in);
if (set_offset) {
ldout(cct, 15) << " setting dn offset to " << dir->max_offset << dendl;
dn->offset = dir->max_offset++;
void Client::put_inode(Inode *in, int n)
{
ldout(cct, 10) << "put_inode on " << *in << dendl;
- int left = in->put(n);
+ int left = in->_put(n);
if (left == 0) {
// release any caps
remove_all_caps(in);
lsubdout(cct, mds, 15) << "inode.get on " << this << " " << ino << '.' << snapid
<< " now " << _ref << dendl;
}
- int put(int n=1) {
+ /// private method to put a reference; see Client::put_inode()
+ int _put(int n=1) {
_ref -= n;
lsubdout(cct, mds, 15) << "inode.put on " << this << " " << ino << '.' << snapid
<< " now " << _ref << dendl;
assert(_ref >= 0);
return _ref;
}
+
int get_num_ref() {
return _ref;
}