From 95988286ce3c2daec3c47cf81c4c9e235850bea1 Mon Sep 17 00:00:00 2001 From: sageweil Date: Fri, 3 Aug 2007 19:16:43 +0000 Subject: [PATCH] some int size cleanup, hopefully everything that touches the osds git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1592 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/include/types.h | 12 +++---- branches/sage/mds/mds/mdstypes.h | 2 +- branches/sage/mds/messages/MOSDOp.h | 11 +++---- branches/sage/mds/messages/MOSDOpReply.h | 20 +++++------ branches/sage/mds/msg/Message.h | 6 ++-- branches/sage/mds/msg/SimpleMessenger.cc | 6 ++-- branches/sage/mds/msg/msg_types.h | 4 +-- branches/sage/mds/osd/OSDMap.h | 42 ++++++++++++------------ branches/sage/mds/osd/osd_types.h | 6 ++-- 9 files changed, 54 insertions(+), 55 deletions(-) diff --git a/branches/sage/mds/include/types.h b/branches/sage/mds/include/types.h index 9f21808d62189..4ec867cd60ecc 100644 --- a/branches/sage/mds/include/types.h +++ b/branches/sage/mds/include/types.h @@ -140,9 +140,9 @@ typedef uint32_t epoch_t; // map epoch (32bits -> 13 epochs/second for 10 struct FileLayout { // -- file -> object mapping -- - int stripe_unit; // stripe unit, in bytes - int stripe_count; // over this many objects - int object_size; // until objects are this big, then move to new objects + int32_t stripe_unit; // stripe unit, in bytes + int32_t stripe_count; // over this many objects + int32_t object_size; // until objects are this big, then move to new objects int stripe_width() { return stripe_unit * stripe_count; } @@ -152,10 +152,10 @@ struct FileLayout { // -- object -> pg layout -- char pg_type; // pg type (replicated, raid, etc.) (see pg_t::TYPE_*) char pg_size; // pg size (num replicas, or raid4 stripe width) - int preferred; // preferred primary osd? + int32_t preferred; // preferred primary osd? // -- pg -> disk layout -- - int object_stripe_unit; // for per-object raid + int32_t object_stripe_unit; // for per-object raid FileLayout() { } FileLayout(int su, int sc, int os, int pgt, int pgs, int o=-1) : @@ -248,7 +248,7 @@ struct inode_t { gid_t gid; // nlink - int nlink; + int32_t nlink; bool anchored; // auth only? // file (data access) diff --git a/branches/sage/mds/mds/mdstypes.h b/branches/sage/mds/mds/mdstypes.h index 4fec690a46966..cb16a4b05d8ac 100644 --- a/branches/sage/mds/mds/mdstypes.h +++ b/branches/sage/mds/mds/mdstypes.h @@ -51,7 +51,7 @@ using namespace std; struct metareqid_t { - int client; + int32_t client; tid_t tid; metareqid_t() : client(-1), tid(0) {} metareqid_t(int c, tid_t t) : client(c), tid(t) {} diff --git a/branches/sage/mds/messages/MOSDOp.h b/branches/sage/mds/messages/MOSDOp.h index 96b389b119a7d..43652dc5b9aed 100644 --- a/branches/sage/mds/messages/MOSDOp.h +++ b/branches/sage/mds/messages/MOSDOp.h @@ -104,9 +104,8 @@ private: eversion_t pg_trim_to; // primary->replica: trim to here - int op; - size_t length; - off_t offset; + int32_t op; + off_t offset, length; eversion_t version; eversion_t old_version; @@ -164,7 +163,7 @@ private: return st.op < 10; } - const size_t get_length() { return st.length; } + const off_t get_length() { return st.length; } const off_t get_offset() { return st.offset; } map& get_attrset() { return attrset; } @@ -187,7 +186,7 @@ private: bufferlist& get_data() { return data; } - size_t get_data_len() { return data.length(); } + off_t get_data_len() { return data.length(); } MOSDOp(entity_inst_t asker, int inc, long tid, @@ -216,7 +215,7 @@ private: void set_layout(const ObjectLayout& l) { st.layout = l; } - void set_length(size_t l) { st.length = l; } + void set_length(off_t l) { st.length = l; } void set_offset(off_t o) { st.offset = o; } void set_version(eversion_t v) { st.version = v; } void set_old_version(eversion_t ov) { st.old_version = ov; } diff --git a/branches/sage/mds/messages/MOSDOpReply.h b/branches/sage/mds/messages/MOSDOpReply.h index e81f14d4558b1..e23210b7e902a 100644 --- a/branches/sage/mds/messages/MOSDOpReply.h +++ b/branches/sage/mds/messages/MOSDOpReply.h @@ -39,13 +39,13 @@ class MOSDOpReply : public Message { object_t oid; ObjectLayout layout; // pgid, etc. - int op; + int32_t op; // reply - int result; + int32_t result; bool commit; - size_t length, offset; - size_t object_size; + off_t length, offset; + off_t object_size; eversion_t version; eversion_t pg_complete_thru; @@ -66,9 +66,9 @@ class MOSDOpReply : public Message { bool get_commit() { return st.commit; } int get_result() { return st.result; } - size_t get_length() { return st.length; } - size_t get_offset() { return st.offset; } - size_t get_object_size() { return st.object_size; } + off_t get_length() { return st.length; } + off_t get_offset() { return st.offset; } + off_t get_object_size() { return st.object_size; } eversion_t get_version() { return st.version; } map& get_attrset() { return attrset; } @@ -76,9 +76,9 @@ class MOSDOpReply : public Message { void set_pg_complete_thru(eversion_t v) { st.pg_complete_thru = v; } void set_result(int r) { st.result = r; } - void set_length(size_t s) { st.length = s; } - void set_offset(size_t o) { st.offset = o; } - void set_object_size(size_t s) { st.object_size = s; } + void set_length(off_t s) { st.length = s; } + void set_offset(off_t o) { st.offset = o; } + void set_object_size(off_t s) { st.object_size = s; } void set_version(eversion_t v) { st.version = v; } void set_attrset(map &as) { attrset = as; } diff --git a/branches/sage/mds/msg/Message.h b/branches/sage/mds/msg/Message.h index ef1ae723a76a1..6adaaa34f03d4 100644 --- a/branches/sage/mds/msg/Message.h +++ b/branches/sage/mds/msg/Message.h @@ -156,10 +156,10 @@ using std::list; typedef struct { - int type; + int32_t type; entity_inst_t src, dst; - int source_port, dest_port; - int nchunks; + int32_t source_port, dest_port; + int32_t nchunks; } msg_envelope_t; #define MSG_ENVELOPE_LEN sizeof(msg_envelope_t) diff --git a/branches/sage/mds/msg/SimpleMessenger.cc b/branches/sage/mds/msg/SimpleMessenger.cc index 48fba9791ee7a..027826dc45cba 100644 --- a/branches/sage/mds/msg/SimpleMessenger.cc +++ b/branches/sage/mds/msg/SimpleMessenger.cc @@ -525,7 +525,7 @@ Message *Rank::Pipe::read_message() // payload bufferlist blist; for (int i=0; iget_dest() << endl; @@ -609,7 +609,7 @@ int Rank::Pipe::write_message(Message *m) } #else // one big chunk - int size = blist.length(); + int32_t size = blist.length(); r = tcp_write( sd, (char*)&size, sizeof(size) ); if (r < 0) { derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data len for " << *m << " to " << m->get_dest() << endl; diff --git a/branches/sage/mds/msg/msg_types.h b/branches/sage/mds/msg/msg_types.h index f20ffe8ed3720..48d8af6955f70 100644 --- a/branches/sage/mds/msg/msg_types.h +++ b/branches/sage/mds/msg/msg_types.h @@ -21,8 +21,8 @@ // new typed msg_addr_t way! class entity_name_t { - int _type; - int _num; + int32_t _type; + int32_t _num; public: static const int TYPE_MON = 1; diff --git a/branches/sage/mds/osd/OSDMap.h b/branches/sage/mds/osd/OSDMap.h index f0e0ff301f813..6bf3f10670ed4 100644 --- a/branches/sage/mds/osd/OSDMap.h +++ b/branches/sage/mds/osd/OSDMap.h @@ -92,12 +92,12 @@ public: bufferlist fullmap; // in leiu of below. // incremental - map new_up; - map new_down; - list new_in; - list new_out; - map new_overload; // updated overload value - list old_overload; // no longer overload + map new_up; + map new_down; + list new_in; + list new_out; + map new_overload; // updated overload value + list old_overload; // no longer overload void encode(bufferlist& bl) { ::_encode(epoch, bl); @@ -129,16 +129,16 @@ private: epoch_t epoch; // what epoch of the osd cluster descriptor is this epoch_t mon_epoch; // monitor epoch (election iteration) utime_t ctime; // epoch start time - int pg_num; // placement group count - int pg_num_mask; // bitmask for above - int localized_pg_num; // localized place group count - int localized_pg_num_mask; // ditto + int32_t pg_num; // placement group count + int32_t pg_num_mask; // bitmask for above + int32_t localized_pg_num; // localized place group count + int32_t localized_pg_num_mask; // ditto - set osds; // all osds - set down_osds; // list of down disks - set out_osds; // list of unmapped disks - map overload_osds; - map osd_inst; + set osds; // all osds + set down_osds; // list of down disks + set out_osds; // list of unmapped disks + map overload_osds; + map osd_inst; public: Crush crush; // hierarchical map @@ -220,7 +220,7 @@ private: } // nope, incremental. - for (map::iterator i = inc.new_down.begin(); + for (map::iterator i = inc.new_down.begin(); i != inc.new_down.end(); i++) { assert(down_osds.count(i->first) == 0); @@ -230,21 +230,21 @@ private: osd_inst.erase(i->first); //cout << "epoch " << epoch << " down osd" << i->first << endl; } - for (list::iterator i = inc.new_out.begin(); + for (list::iterator i = inc.new_out.begin(); i != inc.new_out.end(); i++) { assert(out_osds.count(*i) == 0); out_osds.insert(*i); //cout << "epoch " << epoch << " out osd" << *i << endl; } - for (list::iterator i = inc.old_overload.begin(); + for (list::iterator i = inc.old_overload.begin(); i != inc.old_overload.end(); i++) { assert(overload_osds.count(*i)); overload_osds.erase(*i); } - for (map::iterator i = inc.new_up.begin(); + for (map::iterator i = inc.new_up.begin(); i != inc.new_up.end(); i++) { assert(down_osds.count(i->first)); @@ -253,14 +253,14 @@ private: osd_inst[i->first] = i->second; //cout << "epoch " << epoch << " up osd" << i->first << endl; } - for (list::iterator i = inc.new_in.begin(); + for (list::iterator i = inc.new_in.begin(); i != inc.new_in.end(); i++) { assert(out_osds.count(*i)); out_osds.erase(*i); //cout << "epoch " << epoch << " in osd" << *i << endl; } - for (map::iterator i = inc.new_overload.begin(); + for (map::iterator i = inc.new_overload.begin(); i != inc.new_overload.end(); i++) { overload_osds[i->first] = i->second; diff --git a/branches/sage/mds/osd/osd_types.h b/branches/sage/mds/osd/osd_types.h index 5bd13902ab721..1210c0089f3e5 100644 --- a/branches/sage/mds/osd/osd_types.h +++ b/branches/sage/mds/osd/osd_types.h @@ -24,7 +24,7 @@ class osdreqid_t { public: entity_name_t name; // who - int inc; // incarnation + int32_t inc; // incarnation tid_t tid; osdreqid_t() : inc(0), tid(0) {} osdreqid_t(const entity_name_t& a, int i, tid_t t) : name(a), inc(i), tid(t) {} @@ -170,7 +170,7 @@ namespace __gnu_cxx { */ struct ObjectLayout { pg_t pgid; // what pg do i belong to - int stripe_unit; // for object raid in raid pgs + int32_t stripe_unit; // for object raid in raid pgs ObjectLayout() : pgid(0), stripe_unit(0) { } ObjectLayout(pg_t p, int su=0) : pgid(p), stripe_unit(su) { } @@ -255,7 +255,7 @@ public: const static uint64_t MAGIC = 0xeb0f505dULL; uint64_t magic; uint64_t fsid; // unique fs id (random number) - int whoami; // my role in this fs. + int32_t whoami; // my role in this fs. epoch_t current_epoch; // most recent epoch epoch_t oldest_map, newest_map; // oldest/newest maps we have. OSDSuperblock(uint64_t f=0, int w=0) : -- 2.39.5