}
-void Client::update_inode(Inode *in, InodeStat *st, utime_t ttl)
+void Client::update_inode(Inode *in, InodeStat *st, ceph_mds_reply_lease *l, utime_t ttl)
{
dout(12) << "update_inode stat mask is " << st->mask << dendl;
if (st->mask & CEPH_STAT_MASK_INODE) {
}
-void Locker::decide_client_lease(CInode *in, int mask, int pool, int client)
-{
- mask = CEPH_LOCK_INO;
- pool = 1; // fixme.. do something smart!
- if (in->authlock.can_rdlock(0)) mask |= CEPH_LOCK_IAUTH;
- if (in->linklock.can_rdlock(0)) mask |= CEPH_LOCK_ILINK;
- if (in->filelock.can_rdlock(0)) mask |= CEPH_LOCK_IFILE;
-}
-void Locker::decide_client_lease(CDentry *dn, int mask, int pool, int client)
-{
- pool = 1; // fixme.. do something smart!
- mask = 0;
- if (dn->lock.can_rdlock(0)) mask |= CEPH_LOCK_DN;
-}
-
-void Locker::issue_client_lease(MDSCacheObject *p, int mask, int pool, int client,
- bufferlist &bl, utime_t now, Session *session)
+void Locker::_issue_client_lease(MDSCacheObject *p, int mask, int pool, int client,
+ bufferlist &bl, utime_t now, Session *session)
{
if (mask) {
ClientLease *l = p->add_client_lease(client, mask);
+int Locker::issue_client_lease(CInode *in, int client,
+ bufferlist &bl, utime_t now, Session *session)
+{
+ int mask = CEPH_LOCK_INO;
+ int pool = 1; // fixme.. do something smart!
+ if (in->authlock.can_rdlock(0)) mask |= CEPH_LOCK_IAUTH;
+ if (in->linklock.can_rdlock(0)) mask |= CEPH_LOCK_ILINK;
+ if (in->filelock.can_rdlock(0)) mask |= CEPH_LOCK_IFILE;
+
+ _issue_client_lease(in, mask, pool, client, bl, now, session);
+ return mask;
+}
+
+int Locker::issue_client_lease(CDentry *dn, int client,
+ bufferlist &bl, utime_t now, Session *session)
+{
+ int pool = 1; // fixme.. do something smart!
+ int mask = 0;
+ if (dn->lock.can_rdlock(0)) mask |= CEPH_LOCK_DN;
+
+ _issue_client_lease(dn, mask, pool, client, bl, now, session);
+ return mask;
+}
+
+
public:
void handle_client_lease(class MClientLease *m);
- void decide_client_lease(CInode *in, int mask, int pool, int client);
- void decide_client_lease(CDentry *dn, int mask, int pool, int client);
- void issue_client_lease(MDSCacheObject *p, int mask, int pool, int client,
- bufferlist &bl, utime_t now, Session *session);
+ void _issue_client_lease(MDSCacheObject *p, int mask, int pool, int client, bufferlist &bl, utime_t now, Session *session);
+ int issue_client_lease(CInode *in, int client, bufferlist &bl, utime_t now, Session *session);
+ int issue_client_lease(CDentry *dn, int client, bufferlist &bl, utime_t now, Session *session);
};
// choose lease duration
utime_t now = g_clock.now();
-
- int lmask, lpool;
+ int lmask;
// start with dentry or inode?
if (!in) {
inode:
InodeStat::_encode(bl, in);
- mds->locker->decide_client_lease(in, lmask, lpool, client);
- mds->locker->issue_client_lease(in, lmask, lpool, client, bl, now, session);
+ lmask = mds->locker->issue_client_lease(in, client, bl, now, session);
numi++;
dout(20) << " trace added " << lmask << " " << *in << dendl;
dentry:
::_encode_simple(dn->get_name(), bl);
- mds->locker->decide_client_lease(dn, lmask, lpool, client);
- mds->locker->issue_client_lease(dn, lmask, lpool, client, bl, now, session);
+ lmask = mds->locker->issue_client_lease(dn, client, bl, now, session);
numdn++;
- dout(20) << " trace added " << (int)lmask << " " << *dn << dendl;
+ dout(20) << " trace added " << lmask << " " << *dn << dendl;
// dir
DirStat::_encode(bl, dn->get_dir(), whoami);
dout(12) << "including inode " << *in << dendl;
// dentry
- int lmask, lpool;
::_encode(it->first, dnbl);
- mds->locker->decide_client_lease(dn, lmask, lpool, client);
- mds->locker->issue_client_lease(dn, lmask, lpool, client, dnbl, mdr->now, mdr->session);
+ mds->locker->issue_client_lease(dn, client, dnbl, mdr->now, mdr->session);
// inode
InodeStat::_encode(dnbl, in);
- mds->locker->decide_client_lease(in, lmask, lpool, client);
- mds->locker->issue_client_lease(in, lmask, lpool, client, dnbl, mdr->now, mdr->session);
+ mds->locker->issue_client_lease(in, client, dnbl, mdr->now, mdr->session);
numfiles++;
// touch dn
// reply data
struct ceph_mds_reply_head st;
+ /*
list<InodeStat*> trace_in;
list<DirStat*> trace_dir;
list<string> trace_dn;
list<char> trace_dn_mask;
+ */
bufferlist trace_bl;
DirStat *dir_dir;
::_encode_simple(numdn, trace_bl);
trace_bl.claim_append(bl);
}
+ bufferlist& get_trace_bl() {
+ return trace_bl;
+ }
+ /*
void _decode_trace() {
bufferlist::iterator p = trace_bl.begin();
__u16 numi, numdn;
if (trace_in.empty() && trace_bl.length()) _decode_trace();
return trace_dn_mask;
}
-
+ */
};