From: Sage Weil Date: Mon, 12 Nov 2012 19:03:33 +0000 (-0800) Subject: common: dumpers for ceph_{file,dir}_layout X-Git-Tag: v0.55~118^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c28e5dce9be8d3291b06d6bd31fea9e31c53567;p=ceph.git common: dumpers for ceph_{file,dir}_layout Signed-off-by: Sage Weil --- diff --git a/src/Makefile.am b/src/Makefile.am index c97fc8f4e3a0..e599d7c16db6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1181,6 +1181,7 @@ libcommon_files = \ common/admin_socket.cc \ common/admin_socket_client.cc \ common/escape.c \ + common/types.cc \ common/Clock.cc \ common/Throttle.cc \ common/Timer.cc \ diff --git a/src/common/types.cc b/src/common/types.cc new file mode 100644 index 000000000000..c5482e108225 --- /dev/null +++ b/src/common/types.cc @@ -0,0 +1,23 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#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); +} diff --git a/src/include/types.h b/src/include/types.h index 4f82f31fe582..c783b6e93ce9 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -353,6 +353,13 @@ static inline bool file_mode_is_readonly(int mode) { // dentries #define MAX_DENTRY_LEN 255 +// -- +namespace ceph { + class Formatter; +} +void dump(const ceph_file_layout& l, ceph::Formatter *f); +void dump(const ceph_dir_layout& l, ceph::Formatter *f); + // --