And move implementations into mdstypes.cc from CInode and common/types.
mdstypes.cc sadly lives in libcommon; as several of the types we're going
to put there are needed for Messages and similar things.
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
osd/osd_types.cc \
mds/MDSMap.cc \
mds/inode_backtrace.cc \
+ mds/mdstypes.cc \
common/blkdev.cc \
common/common_init.cc \
common/pipe.c \
#include "include/types.h"
#include "common/Formatter.h"
-void dump(const ceph_file_layout& l, Formatter *f)
-{
- f->dump_unsigned("stripe_unit", l.fl_stripe_unit);
- f->dump_unsigned("stripe_count", l.fl_stripe_count);
- f->dump_unsigned("object_size", l.fl_object_size);
- if (l.fl_cas_hash)
- f->dump_unsigned("cas_hash", l.fl_cas_hash);
- if (l.fl_object_stripe_unit)
- f->dump_unsigned("object_stripe_unit", l.fl_object_stripe_unit);
- if (l.fl_pg_pool)
- f->dump_unsigned("pg_pool", l.fl_pg_pool);
-}
-
void dump(const ceph_dir_layout& dl, Formatter *f)
{
f->dump_unsigned("dir_hash", dl.dl_dir_hash);
extern cinode_lock_info_t cinode_lock_info[];
extern int num_cinode_locks;
-/**
- * Default file layout stuff. This lets us set a default file layout on
- * a directory inode that all files in its tree will use on creation.
- */
-struct default_file_layout {
-
- ceph_file_layout layout;
-
- default_file_layout() {
- memset(&layout, 0, sizeof(layout));
- }
-
- void encode(bufferlist &bl) const {
- __u8 struct_v = 1;
- ::encode(struct_v, bl);
- ::encode(layout, bl);
- }
-
- void decode(bufferlist::iterator& bl) {
- __u8 struct_v;
- ::decode(struct_v, bl);
- if (struct_v != 1) { //uh-oh
- derr << "got default layout I don't understand!" << dendl;
- assert(0);
- }
- ::decode(layout, bl);
- }
-};
-WRITE_CLASS_ENCODER(default_file_layout);
-
-
// cached inode wrapper
class CInode : public MDSCacheObject {
/*
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "mdstypes.h"
+#include "common/Formatter.h"
+
+void default_file_layout::encode(bufferlist &bl) const
+{
+ ENCODE_START(2, 2, bl);
+ ::encode(layout, bl);
+ ENCODE_FINISH(bl);
+}
+
+void default_file_layout::decode(bufferlist::iterator& bl)
+{
+ DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
+ ::decode(layout, bl);
+ DECODE_FINISH(bl);
+}
+
+void dump(const ceph_file_layout& l, Formatter *f)
+{
+ f->dump_unsigned("stripe_unit", l.fl_stripe_unit);
+ f->dump_unsigned("stripe_count", l.fl_stripe_count);
+ f->dump_unsigned("object_size", l.fl_object_size);
+ if (l.fl_cas_hash)
+ f->dump_unsigned("cas_hash", l.fl_cas_hash);
+ if (l.fl_object_stripe_unit)
+ f->dump_unsigned("object_stripe_unit", l.fl_object_stripe_unit);
+ if (l.fl_pg_pool)
+ f->dump_unsigned("pg_pool", l.fl_pg_pool);
+}
+
+void default_file_layout::dump(Formatter *f) const
+{
+ ::dump(layout, f);
+}
+
+void default_file_layout::generate_test_instances(list<default_file_layout*>& ls)
+{
+ ls.push_back(new default_file_layout);
+ ls.push_back(new default_file_layout);
+ ls.back()->layout.fl_stripe_unit = 1024;
+ ls.back()->layout.fl_stripe_count = 2;
+ ls.back()->layout.fl_object_size = 2048;
+ ls.back()->layout.fl_cas_hash = 3;
+ ls.back()->layout.fl_object_stripe_unit = 8;
+ ls.back()->layout.fl_pg_pool = 9;
+}
}
+/**
+ * Default file layout stuff. This lets us set a default file layout on
+ * a directory inode that all files in its tree will use on creation.
+ */
+struct default_file_layout {
+ ceph_file_layout layout;
+
+ default_file_layout() {
+ memset(&layout, 0, sizeof(layout));
+ }
+
+ void encode(bufferlist &bl) const;
+ void decode(bufferlist::iterator& bl);
+ void dump(Formatter *f) const;
+ static void generate_test_instances(list<default_file_layout*>& ls);
+};
+WRITE_CLASS_ENCODER(default_file_layout);
+
+
struct scatter_info_t {
version_t version;
TYPE(snaplink_t)
TYPE(sr_t)*/
+#include "mds/mdstypes.h"
+TYPE(default_file_layout)
+
#ifdef WITH_RADOSGW
#include "rgw/rgw_rados.h"