summaryrefslogtreecommitdiffstats
path: root/src/client/MetaRequest.cc
blob: 2450a1f681c9caf02429ece635d2f3c6c085ce77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "include/types.h"
#include "client/MetaRequest.h"
#include "client/Dentry.h"
#include "client/Inode.h"
#include "messages/MClientReply.h"
#include "common/Formatter.h"

void MetaRequest::dump(Formatter *f) const
{
  auto age = std::chrono::duration<double>(ceph_clock_now() - op_stamp);

  f->dump_unsigned("tid", tid);
  f->dump_string("op", ceph_mds_op_name(head.op));
  f->dump_stream("path") << path;
  f->dump_stream("path2") << path2;
  if (_inode)
    f->dump_stream("ino") << _inode->ino;
  if (_old_inode)
    f->dump_stream("old_ino") << _old_inode->ino;
  if (_other_inode)
    f->dump_stream("other_ino") << _other_inode->ino;
  if (target)
    f->dump_stream("target_ino") << target->ino;
  if (_dentry)
    f->dump_string("dentry", _dentry->name);
  if (_old_dentry)
    f->dump_string("old_dentry", _old_dentry->name);
  f->dump_stream("hint_ino") << inodeno_t(head.ino);

  f->dump_stream("sent_stamp") << sent_stamp;
  f->dump_float("age", age.count());
  f->dump_int("mds", mds);
  f->dump_int("resend_mds", resend_mds);
  f->dump_int("send_to_auth", send_to_auth);
  f->dump_unsigned("sent_on_mseq", sent_on_mseq);
  f->dump_int("retry_attempt", retry_attempt);

  f->dump_int("got_unsafe", got_unsafe);

  f->dump_unsigned("uid", head.caller_uid);
  f->dump_unsigned("gid", head.caller_gid);

  f->dump_unsigned("oldest_client_tid", head.oldest_client_tid);
  f->dump_unsigned("mdsmap_epoch", head.mdsmap_epoch);
  f->dump_unsigned("flags", head.flags);
  f->dump_unsigned("num_retry", head.num_retry);
  f->dump_unsigned("num_fwd", head.num_fwd);
  f->dump_unsigned("num_releases", head.num_releases);

  f->dump_int("abort_rc", abort_rc);
}

MetaRequest::~MetaRequest()
{
  if (_dentry)
    _dentry->put();
  if (_old_dentry)
    _old_dentry->put();
}

void MetaRequest::set_dentry(Dentry *d) {
  ceph_assert(_dentry == NULL);
  _dentry = d;
  _dentry->get();
}
Dentry *MetaRequest::dentry() {
  return _dentry;
}

void MetaRequest::set_old_dentry(Dentry *d) {
  ceph_assert(_old_dentry == NULL);
  _old_dentry = d;
  _old_dentry->get();
}
Dentry *MetaRequest::old_dentry() {
  return _old_dentry;
}