]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/mdstypes.cc
71c5f11d3c2c0bd04cb70377c544e922b6fc5144
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
5 #include "MDSContext.h"
6 #include "common/Formatter.h"
8 const mds_gid_t MDS_GID_NONE
= mds_gid_t(0);
9 const mds_rank_t MDS_RANK_NONE
= mds_rank_t(-1);
16 void frag_info_t::encode(bufferlist
&bl
) const
18 ENCODE_START(3, 2, bl
);
19 ::encode(version
, bl
);
22 ::encode(nsubdirs
, bl
);
23 ::encode(change_attr
, bl
);
27 void frag_info_t::decode(bufferlist::iterator
&bl
)
29 DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl
);
30 ::decode(version
, bl
);
33 ::decode(nsubdirs
, bl
);
35 ::decode(change_attr
, bl
);
41 void frag_info_t::dump(Formatter
*f
) const
43 f
->dump_unsigned("version", version
);
44 f
->dump_stream("mtime") << mtime
;
45 f
->dump_unsigned("num_files", nfiles
);
46 f
->dump_unsigned("num_subdirs", nsubdirs
);
49 void frag_info_t::generate_test_instances(list
<frag_info_t
*>& ls
)
51 ls
.push_back(new frag_info_t
);
52 ls
.push_back(new frag_info_t
);
53 ls
.back()->version
= 1;
54 ls
.back()->mtime
= utime_t(2, 3);
55 ls
.back()->nfiles
= 4;
56 ls
.back()->nsubdirs
= 5;
59 ostream
& operator<<(ostream
&out
, const frag_info_t
&f
)
61 if (f
== frag_info_t())
63 out
<< "f(v" << f
.version
;
64 if (f
.mtime
!= utime_t())
65 out
<< " m" << f
.mtime
;
66 if (f
.nfiles
|| f
.nsubdirs
)
67 out
<< " " << f
.size() << "=" << f
.nfiles
<< "+" << f
.nsubdirs
;
77 void nest_info_t::encode(bufferlist
&bl
) const
79 ENCODE_START(3, 2, bl
);
80 ::encode(version
, bl
);
83 ::encode(rsubdirs
, bl
);
87 ::encode(ranchors
, bl
);
89 ::encode(rsnaprealms
, bl
);
94 void nest_info_t::decode(bufferlist::iterator
&bl
)
96 DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl
);
97 ::decode(version
, bl
);
100 ::decode(rsubdirs
, bl
);
103 ::decode(ranchors
, bl
);
105 ::decode(rsnaprealms
, bl
);
106 ::decode(rctime
, bl
);
110 void nest_info_t::dump(Formatter
*f
) const
112 f
->dump_unsigned("version", version
);
113 f
->dump_unsigned("rbytes", rbytes
);
114 f
->dump_unsigned("rfiles", rfiles
);
115 f
->dump_unsigned("rsubdirs", rsubdirs
);
116 f
->dump_unsigned("rsnaprealms", rsnaprealms
);
117 f
->dump_stream("rctime") << rctime
;
120 void nest_info_t::generate_test_instances(list
<nest_info_t
*>& ls
)
122 ls
.push_back(new nest_info_t
);
123 ls
.push_back(new nest_info_t
);
124 ls
.back()->version
= 1;
125 ls
.back()->rbytes
= 2;
126 ls
.back()->rfiles
= 3;
127 ls
.back()->rsubdirs
= 4;
128 ls
.back()->rsnaprealms
= 6;
129 ls
.back()->rctime
= utime_t(7, 8);
132 ostream
& operator<<(ostream
&out
, const nest_info_t
&n
)
134 if (n
== nest_info_t())
136 out
<< "n(v" << n
.version
;
137 if (n
.rctime
!= utime_t())
138 out
<< " rc" << n
.rctime
;
140 out
<< " b" << n
.rbytes
;
142 out
<< " sr" << n
.rsnaprealms
;
143 if (n
.rfiles
|| n
.rsubdirs
)
144 out
<< " " << n
.rsize() << "=" << n
.rfiles
<< "+" << n
.rsubdirs
;
152 void quota_info_t::dump(Formatter
*f
) const
154 f
->dump_int("max_bytes", max_bytes
);
155 f
->dump_int("max_files", max_files
);
158 void quota_info_t::generate_test_instances(list
<quota_info_t
*>& ls
)
160 ls
.push_back(new quota_info_t
);
161 ls
.push_back(new quota_info_t
);
162 ls
.back()->max_bytes
= 16;
163 ls
.back()->max_files
= 16;
166 ostream
& operator<<(ostream
&out
, const quota_info_t
&n
)
169 << "max_bytes = " << n
.max_bytes
170 << " max_files = " << n
.max_files
176 * client_writeable_range_t
179 void client_writeable_range_t::encode(bufferlist
&bl
) const
181 ENCODE_START(2, 2, bl
);
182 ::encode(range
.first
, bl
);
183 ::encode(range
.last
, bl
);
184 ::encode(follows
, bl
);
188 void client_writeable_range_t::decode(bufferlist::iterator
& bl
)
190 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
191 ::decode(range
.first
, bl
);
192 ::decode(range
.last
, bl
);
193 ::decode(follows
, bl
);
197 void client_writeable_range_t::dump(Formatter
*f
) const
199 f
->open_object_section("byte range");
200 f
->dump_unsigned("first", range
.first
);
201 f
->dump_unsigned("last", range
.last
);
203 f
->dump_unsigned("follows", follows
);
206 void client_writeable_range_t::generate_test_instances(list
<client_writeable_range_t
*>& ls
)
208 ls
.push_back(new client_writeable_range_t
);
209 ls
.push_back(new client_writeable_range_t
);
210 ls
.back()->range
.first
= 123;
211 ls
.back()->range
.last
= 456;
212 ls
.back()->follows
= 12;
215 ostream
& operator<<(ostream
& out
, const client_writeable_range_t
& r
)
217 return out
<< r
.range
.first
<< '-' << r
.range
.last
<< "@" << r
.follows
;
223 void inline_data_t::encode(bufferlist
&bl
) const
225 ::encode(version
, bl
);
229 ::encode(bufferlist(), bl
);
231 void inline_data_t::decode(bufferlist::iterator
&p
)
233 ::decode(version
, p
);
235 ::decode(inline_len
, p
);
237 ::decode_nohead(inline_len
, get_data(), p
);
245 void inode_t::encode(bufferlist
&bl
, uint64_t features
) const
247 ENCODE_START(15, 6, bl
);
261 ::encode(anchored
, bl
);
264 ::encode(dir_layout
, bl
);
265 ::encode(layout
, bl
, features
);
267 ::encode(truncate_seq
, bl
);
268 ::encode(truncate_size
, bl
);
269 ::encode(truncate_from
, bl
);
270 ::encode(truncate_pending
, bl
);
273 ::encode(time_warp_seq
, bl
);
274 ::encode(client_ranges
, bl
);
276 ::encode(dirstat
, bl
);
278 ::encode(accounted_rstat
, bl
);
280 ::encode(version
, bl
);
281 ::encode(file_data_version
, bl
);
282 ::encode(xattr_version
, bl
);
283 ::encode(backtrace_version
, bl
);
284 ::encode(old_pools
, bl
);
285 ::encode(max_size_ever
, bl
);
286 ::encode(inline_data
, bl
);
289 ::encode(stray_prior_path
, bl
);
291 ::encode(last_scrub_version
, bl
);
292 ::encode(last_scrub_stamp
, bl
);
295 ::encode(change_attr
, bl
);
297 ::encode(export_pin
, bl
);
302 void inode_t::decode(bufferlist::iterator
&p
)
304 DECODE_START_LEGACY_COMPAT_LEN(15, 6, 6, p
);
317 ::decode(anchored
, p
);
321 ::decode(dir_layout
, p
);
323 memset(&dir_layout
, 0, sizeof(dir_layout
));
326 ::decode(truncate_seq
, p
);
327 ::decode(truncate_size
, p
);
328 ::decode(truncate_from
, p
);
330 ::decode(truncate_pending
, p
);
332 truncate_pending
= 0;
335 ::decode(time_warp_seq
, p
);
337 ::decode(client_ranges
, p
);
339 map
<client_t
, client_writeable_range_t::byte_range_t
> m
;
341 for (map
<client_t
, client_writeable_range_t::byte_range_t
>::iterator
342 q
= m
.begin(); q
!= m
.end(); ++q
)
343 client_ranges
[q
->first
].range
= q
->second
;
346 ::decode(dirstat
, p
);
348 ::decode(accounted_rstat
, p
);
350 ::decode(version
, p
);
351 ::decode(file_data_version
, p
);
352 ::decode(xattr_version
, p
);
354 ::decode(backtrace_version
, p
);
356 ::decode(old_pools
, p
);
358 ::decode(max_size_ever
, p
);
360 ::decode(inline_data
, p
);
362 inline_data
.version
= CEPH_INLINE_NONE
;
365 backtrace_version
= 0; // force update backtrace
369 if (struct_v
>= 12) {
370 ::decode(stray_prior_path
, p
);
373 if (struct_v
>= 13) {
374 ::decode(last_scrub_version
, p
);
375 ::decode(last_scrub_stamp
, p
);
377 if (struct_v
>= 14) {
379 ::decode(change_attr
, p
);
385 if (struct_v
>= 15) {
386 ::decode(export_pin
, p
);
388 export_pin
= MDS_RANK_NONE
;
394 void inode_t::dump(Formatter
*f
) const
396 f
->dump_unsigned("ino", ino
);
397 f
->dump_unsigned("rdev", rdev
);
398 f
->dump_stream("ctime") << ctime
;
399 f
->dump_stream("btime") << btime
;
400 f
->dump_unsigned("mode", mode
);
401 f
->dump_unsigned("uid", uid
);
402 f
->dump_unsigned("gid", gid
);
403 f
->dump_unsigned("nlink", nlink
);
405 f
->open_object_section("dir_layout");
406 ::dump(dir_layout
, f
);
409 f
->dump_object("layout", layout
);
411 f
->open_array_section("old_pools");
412 for (compact_set
<int64_t>::const_iterator i
= old_pools
.begin();
413 i
!= old_pools
.end();
415 f
->dump_int("pool", *i
);
418 f
->dump_unsigned("size", size
);
419 f
->dump_unsigned("truncate_seq", truncate_seq
);
420 f
->dump_unsigned("truncate_size", truncate_size
);
421 f
->dump_unsigned("truncate_from", truncate_from
);
422 f
->dump_unsigned("truncate_pending", truncate_pending
);
423 f
->dump_stream("mtime") << mtime
;
424 f
->dump_stream("atime") << atime
;
425 f
->dump_unsigned("time_warp_seq", time_warp_seq
);
426 f
->dump_unsigned("change_attr", change_attr
);
427 f
->dump_int("export_pin", export_pin
);
429 f
->open_array_section("client_ranges");
430 for (map
<client_t
,client_writeable_range_t
>::const_iterator p
= client_ranges
.begin(); p
!= client_ranges
.end(); ++p
) {
431 f
->open_object_section("client");
432 f
->dump_unsigned("client", p
->first
.v
);
438 f
->open_object_section("dirstat");
442 f
->open_object_section("rstat");
446 f
->open_object_section("accounted_rstat");
447 accounted_rstat
.dump(f
);
450 f
->dump_unsigned("version", version
);
451 f
->dump_unsigned("file_data_version", file_data_version
);
452 f
->dump_unsigned("xattr_version", xattr_version
);
453 f
->dump_unsigned("backtrace_version", backtrace_version
);
455 f
->dump_string("stray_prior_path", stray_prior_path
);
458 void inode_t::generate_test_instances(list
<inode_t
*>& ls
)
460 ls
.push_back(new inode_t
);
461 ls
.push_back(new inode_t
);
466 int inode_t::compare(const inode_t
&other
, bool *divergent
) const
468 assert(ino
== other
.ino
);
470 if (version
== other
.version
) {
471 if (rdev
!= other
.rdev
||
472 ctime
!= other
.ctime
||
473 btime
!= other
.btime
||
474 mode
!= other
.mode
||
477 nlink
!= other
.nlink
||
478 memcmp(&dir_layout
, &other
.dir_layout
, sizeof(dir_layout
)) ||
479 layout
!= other
.layout
||
480 old_pools
!= other
.old_pools
||
481 size
!= other
.size
||
482 max_size_ever
!= other
.max_size_ever
||
483 truncate_seq
!= other
.truncate_seq
||
484 truncate_size
!= other
.truncate_size
||
485 truncate_from
!= other
.truncate_from
||
486 truncate_pending
!= other
.truncate_pending
||
487 change_attr
!= other
.change_attr
||
488 mtime
!= other
.mtime
||
489 atime
!= other
.atime
||
490 time_warp_seq
!= other
.time_warp_seq
||
491 inline_data
!= other
.inline_data
||
492 client_ranges
!= other
.client_ranges
||
493 !(dirstat
== other
.dirstat
) ||
494 !(rstat
== other
.rstat
) ||
495 !(accounted_rstat
== other
.accounted_rstat
) ||
496 file_data_version
!= other
.file_data_version
||
497 xattr_version
!= other
.xattr_version
||
498 backtrace_version
!= other
.backtrace_version
) {
502 } else if (version
> other
.version
) {
503 *divergent
= !older_is_consistent(other
);
506 assert(version
< other
.version
);
507 *divergent
= !other
.older_is_consistent(*this);
512 bool inode_t::older_is_consistent(const inode_t
&other
) const
514 if (max_size_ever
< other
.max_size_ever
||
515 truncate_seq
< other
.truncate_seq
||
516 time_warp_seq
< other
.time_warp_seq
||
517 inline_data
.version
< other
.inline_data
.version
||
518 dirstat
.version
< other
.dirstat
.version
||
519 rstat
.version
< other
.rstat
.version
||
520 accounted_rstat
.version
< other
.accounted_rstat
.version
||
521 file_data_version
< other
.file_data_version
||
522 xattr_version
< other
.xattr_version
||
523 backtrace_version
< other
.backtrace_version
) {
532 void old_inode_t::encode(bufferlist
& bl
, uint64_t features
) const
534 ENCODE_START(2, 2, bl
);
536 ::encode(inode
, bl
, features
);
537 ::encode(xattrs
, bl
);
541 void old_inode_t::decode(bufferlist::iterator
& bl
)
543 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
546 ::decode(xattrs
, bl
);
550 void old_inode_t::dump(Formatter
*f
) const
552 f
->dump_unsigned("first", first
);
554 f
->open_object_section("xattrs");
555 for (map
<string
,bufferptr
>::const_iterator p
= xattrs
.begin(); p
!= xattrs
.end(); ++p
) {
556 string
v(p
->second
.c_str(), p
->second
.length());
557 f
->dump_string(p
->first
.c_str(), v
);
562 void old_inode_t::generate_test_instances(list
<old_inode_t
*>& ls
)
564 ls
.push_back(new old_inode_t
);
565 ls
.push_back(new old_inode_t
);
566 ls
.back()->first
= 2;
568 inode_t::generate_test_instances(ils
);
569 ls
.back()->inode
= *ils
.back();
570 ls
.back()->xattrs
["user.foo"] = buffer::copy("asdf", 4);
571 ls
.back()->xattrs
["user.unprintable"] = buffer::copy("\000\001\002", 3);
578 void fnode_t::encode(bufferlist
&bl
) const
580 ENCODE_START(4, 3, bl
);
581 ::encode(version
, bl
);
582 ::encode(snap_purged_thru
, bl
);
583 ::encode(fragstat
, bl
);
584 ::encode(accounted_fragstat
, bl
);
586 ::encode(accounted_rstat
, bl
);
587 ::encode(damage_flags
, bl
);
588 ::encode(recursive_scrub_version
, bl
);
589 ::encode(recursive_scrub_stamp
, bl
);
590 ::encode(localized_scrub_version
, bl
);
591 ::encode(localized_scrub_stamp
, bl
);
595 void fnode_t::decode(bufferlist::iterator
&bl
)
597 DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl
);
598 ::decode(version
, bl
);
599 ::decode(snap_purged_thru
, bl
);
600 ::decode(fragstat
, bl
);
601 ::decode(accounted_fragstat
, bl
);
603 ::decode(accounted_rstat
, bl
);
605 ::decode(damage_flags
, bl
);
608 ::decode(recursive_scrub_version
, bl
);
609 ::decode(recursive_scrub_stamp
, bl
);
610 ::decode(localized_scrub_version
, bl
);
611 ::decode(localized_scrub_stamp
, bl
);
616 void fnode_t::dump(Formatter
*f
) const
618 f
->dump_unsigned("version", version
);
619 f
->dump_unsigned("snap_purged_thru", snap_purged_thru
);
621 f
->open_object_section("fragstat");
625 f
->open_object_section("accounted_fragstat");
626 accounted_fragstat
.dump(f
);
629 f
->open_object_section("rstat");
633 f
->open_object_section("accounted_rstat");
634 accounted_rstat
.dump(f
);
638 void fnode_t::generate_test_instances(list
<fnode_t
*>& ls
)
640 ls
.push_back(new fnode_t
);
641 ls
.push_back(new fnode_t
);
642 ls
.back()->version
= 1;
643 ls
.back()->snap_purged_thru
= 2;
644 list
<frag_info_t
*> fls
;
645 frag_info_t::generate_test_instances(fls
);
646 ls
.back()->fragstat
= *fls
.back();
647 ls
.back()->accounted_fragstat
= *fls
.front();
648 list
<nest_info_t
*> nls
;
649 nest_info_t::generate_test_instances(nls
);
650 ls
.back()->rstat
= *nls
.front();
651 ls
.back()->accounted_rstat
= *nls
.back();
658 void old_rstat_t::encode(bufferlist
& bl
) const
660 ENCODE_START(2, 2, bl
);
663 ::encode(accounted_rstat
, bl
);
667 void old_rstat_t::decode(bufferlist::iterator
& bl
)
669 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
672 ::decode(accounted_rstat
, bl
);
676 void old_rstat_t::dump(Formatter
*f
) const
678 f
->dump_unsigned("snapid", first
);
679 f
->open_object_section("rstat");
682 f
->open_object_section("accounted_rstat");
683 accounted_rstat
.dump(f
);
687 void old_rstat_t::generate_test_instances(list
<old_rstat_t
*>& ls
)
689 ls
.push_back(new old_rstat_t());
690 ls
.push_back(new old_rstat_t());
691 ls
.back()->first
= 12;
692 list
<nest_info_t
*> nls
;
693 nest_info_t::generate_test_instances(nls
);
694 ls
.back()->rstat
= *nls
.back();
695 ls
.back()->accounted_rstat
= *nls
.front();
701 void session_info_t::encode(bufferlist
& bl
, uint64_t features
) const
703 ENCODE_START(6, 3, bl
);
704 ::encode(inst
, bl
, features
);
705 ::encode(completed_requests
, bl
);
706 ::encode(prealloc_inos
, bl
); // hacky, see below.
707 ::encode(used_inos
, bl
);
708 ::encode(client_metadata
, bl
);
709 ::encode(completed_flushes
, bl
);
710 ::encode(auth_name
, bl
);
714 void session_info_t::decode(bufferlist::iterator
& p
)
716 DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, p
);
722 completed_requests
[*s
.begin()] = inodeno_t();
726 ::decode(completed_requests
, p
);
728 ::decode(prealloc_inos
, p
);
729 ::decode(used_inos
, p
);
730 prealloc_inos
.insert(used_inos
);
733 ::decode(client_metadata
, p
);
736 ::decode(completed_flushes
, p
);
739 ::decode(auth_name
, p
);
744 void session_info_t::dump(Formatter
*f
) const
746 f
->dump_stream("inst") << inst
;
748 f
->open_array_section("completed_requests");
749 for (map
<ceph_tid_t
,inodeno_t
>::const_iterator p
= completed_requests
.begin();
750 p
!= completed_requests
.end();
752 f
->open_object_section("request");
753 f
->dump_unsigned("tid", p
->first
);
754 f
->dump_stream("created_ino") << p
->second
;
759 f
->open_array_section("prealloc_inos");
760 for (interval_set
<inodeno_t
>::const_iterator p
= prealloc_inos
.begin();
761 p
!= prealloc_inos
.end();
763 f
->open_object_section("ino_range");
764 f
->dump_unsigned("start", p
.get_start());
765 f
->dump_unsigned("length", p
.get_len());
770 f
->open_array_section("used_inos");
771 for (interval_set
<inodeno_t
>::const_iterator p
= prealloc_inos
.begin();
772 p
!= prealloc_inos
.end();
774 f
->open_object_section("ino_range");
775 f
->dump_unsigned("start", p
.get_start());
776 f
->dump_unsigned("length", p
.get_len());
781 for (map
<string
, string
>::const_iterator i
= client_metadata
.begin();
782 i
!= client_metadata
.end(); ++i
) {
783 f
->dump_string(i
->first
.c_str(), i
->second
);
787 void session_info_t::generate_test_instances(list
<session_info_t
*>& ls
)
789 ls
.push_back(new session_info_t
);
790 ls
.push_back(new session_info_t
);
791 ls
.back()->inst
= entity_inst_t(entity_name_t::MDS(12), entity_addr_t());
792 ls
.back()->completed_requests
.insert(make_pair(234, inodeno_t(111222)));
793 ls
.back()->completed_requests
.insert(make_pair(237, inodeno_t(222333)));
794 ls
.back()->prealloc_inos
.insert(333, 12);
795 ls
.back()->prealloc_inos
.insert(377, 112);
796 // we can't add used inos; they're cleared on decode
803 void string_snap_t::encode(bufferlist
& bl
) const
805 ENCODE_START(2, 2, bl
);
807 ::encode(snapid
, bl
);
811 void string_snap_t::decode(bufferlist::iterator
& bl
)
813 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
815 ::decode(snapid
, bl
);
819 void string_snap_t::dump(Formatter
*f
) const
821 f
->dump_string("name", name
);
822 f
->dump_unsigned("snapid", snapid
);
825 void string_snap_t::generate_test_instances(list
<string_snap_t
*>& ls
)
827 ls
.push_back(new string_snap_t
);
828 ls
.push_back(new string_snap_t
);
829 ls
.back()->name
= "foo";
830 ls
.back()->snapid
= 123;
831 ls
.push_back(new string_snap_t
);
832 ls
.back()->name
= "bar";
833 ls
.back()->snapid
= 456;
840 void MDSCacheObjectInfo::encode(bufferlist
& bl
) const
842 ENCODE_START(2, 2, bl
);
844 ::encode(dirfrag
, bl
);
846 ::encode(snapid
, bl
);
850 void MDSCacheObjectInfo::decode(bufferlist::iterator
& p
)
852 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, p
);
854 ::decode(dirfrag
, p
);
860 void MDSCacheObjectInfo::dump(Formatter
*f
) const
862 f
->dump_unsigned("ino", ino
);
863 f
->dump_stream("dirfrag") << dirfrag
;
864 f
->dump_string("name", dname
);
865 f
->dump_unsigned("snapid", snapid
);
868 void MDSCacheObjectInfo::generate_test_instances(list
<MDSCacheObjectInfo
*>& ls
)
870 ls
.push_back(new MDSCacheObjectInfo
);
871 ls
.push_back(new MDSCacheObjectInfo
);
873 ls
.back()->dirfrag
= dirfrag_t(2, 3);
874 ls
.back()->dname
= "fooname";
875 ls
.back()->snapid
= CEPH_NOSNAP
;
876 ls
.push_back(new MDSCacheObjectInfo
);
877 ls
.back()->ino
= 121;
878 ls
.back()->dirfrag
= dirfrag_t(222, 0);
879 ls
.back()->dname
= "bar foo";
880 ls
.back()->snapid
= 21322;
884 * mds_table_pending_t
886 void mds_table_pending_t::encode(bufferlist
& bl
) const
888 ENCODE_START(2, 2, bl
);
895 void mds_table_pending_t::decode(bufferlist::iterator
& bl
)
897 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
904 void mds_table_pending_t::dump(Formatter
*f
) const
906 f
->dump_unsigned("reqid", reqid
);
907 f
->dump_unsigned("mds", mds
);
908 f
->dump_unsigned("tid", tid
);
911 void mds_table_pending_t::generate_test_instances(list
<mds_table_pending_t
*>& ls
)
913 ls
.push_back(new mds_table_pending_t
);
914 ls
.push_back(new mds_table_pending_t
);
915 ls
.back()->reqid
= 234;
917 ls
.back()->tid
= 35434;
924 void inode_load_vec_t::encode(bufferlist
&bl
) const
926 ENCODE_START(2, 2, bl
);
927 for (int i
=0; i
<NUM
; i
++)
928 ::encode(vec
[i
], bl
);
932 void inode_load_vec_t::decode(const utime_t
&t
, bufferlist::iterator
&p
)
934 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, p
);
935 for (int i
=0; i
<NUM
; i
++)
936 ::decode(vec
[i
], t
, p
);
940 void inode_load_vec_t::dump(Formatter
*f
)
942 f
->open_array_section("Decay Counters");
943 for (vector
<DecayCounter
>::const_iterator i
= vec
.begin(); i
!= vec
.end(); ++i
) {
944 f
->open_object_section("Decay Counter");
951 void inode_load_vec_t::generate_test_instances(list
<inode_load_vec_t
*>& ls
)
954 ls
.push_back(new inode_load_vec_t(sample
));
961 void dirfrag_load_vec_t::dump(Formatter
*f
) const
963 f
->open_array_section("Decay Counters");
964 for (vector
<DecayCounter
>::const_iterator i
= vec
.begin(); i
!= vec
.end(); ++i
) {
965 f
->open_object_section("Decay Counter");
972 void dirfrag_load_vec_t::generate_test_instances(list
<dirfrag_load_vec_t
*>& ls
)
975 ls
.push_back(new dirfrag_load_vec_t(sample
));
981 void mds_load_t::encode(bufferlist
&bl
) const {
982 ENCODE_START(2, 2, bl
);
985 ::encode(req_rate
, bl
);
986 ::encode(cache_hit_rate
, bl
);
987 ::encode(queue_len
, bl
);
988 ::encode(cpu_load_avg
, bl
);
992 void mds_load_t::decode(const utime_t
&t
, bufferlist::iterator
&bl
) {
993 DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl
);
994 ::decode(auth
, t
, bl
);
995 ::decode(all
, t
, bl
);
996 ::decode(req_rate
, bl
);
997 ::decode(cache_hit_rate
, bl
);
998 ::decode(queue_len
, bl
);
999 ::decode(cpu_load_avg
, bl
);
1003 void mds_load_t::dump(Formatter
*f
) const
1005 f
->dump_float("request rate", req_rate
);
1006 f
->dump_float("cache hit rate", cache_hit_rate
);
1007 f
->dump_float("queue length", queue_len
);
1008 f
->dump_float("cpu load", cpu_load_avg
);
1009 f
->open_object_section("auth dirfrag");
1012 f
->open_object_section("all dirfrags");
1017 void mds_load_t::generate_test_instances(list
<mds_load_t
*>& ls
)
1020 ls
.push_back(new mds_load_t(sample
));
1026 void cap_reconnect_t::encode(bufferlist
& bl
) const {
1027 ENCODE_START(2, 1, bl
);
1028 encode_old(bl
); // extract out when something changes
1029 ::encode(snap_follows
, bl
);
1033 void cap_reconnect_t::encode_old(bufferlist
& bl
) const {
1035 capinfo
.flock_len
= flockbl
.length();
1036 ::encode(capinfo
, bl
);
1037 ::encode_nohead(flockbl
, bl
);
1040 void cap_reconnect_t::decode(bufferlist::iterator
& bl
) {
1041 DECODE_START(1, bl
);
1042 decode_old(bl
); // extract out when something changes
1044 ::decode(snap_follows
, bl
);
1048 void cap_reconnect_t::decode_old(bufferlist::iterator
& bl
) {
1050 ::decode(capinfo
, bl
);
1051 ::decode_nohead(capinfo
.flock_len
, flockbl
, bl
);
1054 void cap_reconnect_t::dump(Formatter
*f
) const
1056 f
->dump_string("path", path
);
1057 f
->dump_int("cap_id", capinfo
.cap_id
);
1058 f
->dump_string("cap wanted", ccap_string(capinfo
.wanted
));
1059 f
->dump_string("cap issued", ccap_string(capinfo
.issued
));
1060 f
->dump_int("snaprealm", capinfo
.snaprealm
);
1061 f
->dump_int("path base ino", capinfo
.pathbase
);
1062 f
->dump_string("has file locks", capinfo
.flock_len
? "true" : "false");
1065 void cap_reconnect_t::generate_test_instances(list
<cap_reconnect_t
*>& ls
)
1067 ls
.push_back(new cap_reconnect_t
);
1068 ls
.back()->path
= "/test/path";
1069 ls
.back()->capinfo
.cap_id
= 1;
1072 ostream
& operator<<(ostream
&out
, const mds_role_t
&role
)
1074 out
<< role
.fscid
<< ":" << role
.rank
;