Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / client / MetaRequest.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #include "include/types.h"
5 #include "client/MetaRequest.h"
6 #include "client/Dentry.h"
7 #include "client/Inode.h"
8 #include "messages/MClientReply.h"
9 #include "common/Formatter.h"
10
11 void MetaRequest::dump(Formatter *f) const
12 {
13   f->dump_unsigned("tid", tid);
14   f->dump_string("op", ceph_mds_op_name(head.op));
15   f->dump_stream("path") << path;
16   f->dump_stream("path2") << path2;
17   if (_inode)
18     f->dump_stream("ino") << _inode->ino;
19   if (_old_inode)
20     f->dump_stream("old_ino") << _old_inode->ino;
21   if (_other_inode)
22     f->dump_stream("other_ino") << _other_inode->ino;
23   if (target)
24     f->dump_stream("target_ino") << target->ino;
25   if (_dentry)
26     f->dump_string("dentry", _dentry->name);
27   if (_old_dentry)
28     f->dump_string("old_dentry", _old_dentry->name);
29   f->dump_stream("hint_ino") << inodeno_t(head.ino);
30
31   f->dump_stream("sent_stamp") << sent_stamp;
32   f->dump_int("mds", mds);
33   f->dump_int("resend_mds", resend_mds);
34   f->dump_int("send_to_auth", send_to_auth);
35   f->dump_unsigned("sent_on_mseq", sent_on_mseq);
36   f->dump_int("retry_attempt", retry_attempt);
37
38   f->dump_int("got_unsafe", got_unsafe);
39
40   f->dump_unsigned("uid", head.caller_uid);
41   f->dump_unsigned("gid", head.caller_gid);
42
43   f->dump_unsigned("oldest_client_tid", head.oldest_client_tid);
44   f->dump_unsigned("mdsmap_epoch", head.mdsmap_epoch);
45   f->dump_unsigned("flags", head.flags);
46   f->dump_unsigned("num_retry", head.num_retry);
47   f->dump_unsigned("num_fwd", head.num_fwd);
48   f->dump_unsigned("num_releases", head.num_releases);
49
50   f->dump_int("abort_rc", abort_rc);
51 }
52
53 MetaRequest::~MetaRequest()
54 {
55   if (_dentry)
56     _dentry->put();
57   if (_old_dentry)
58     _old_dentry->put();
59   if (reply)
60     reply->put();
61 }
62
63 void MetaRequest::set_dentry(Dentry *d) {
64   assert(_dentry == NULL);
65   _dentry = d;
66   _dentry->get();
67 }
68 Dentry *MetaRequest::dentry() {
69   return _dentry;
70 }
71
72 void MetaRequest::set_old_dentry(Dentry *d) {
73   assert(_old_dentry == NULL);
74   _old_dentry = d;
75   _old_dentry->get();
76 }
77 Dentry *MetaRequest::old_dentry() {
78   return _old_dentry;
79 }