Skip to content

Commit

Permalink
Change tid_t to ceph_tid_t to avoid conflicts with a popular type
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Mick <[email protected]>
  • Loading branch information
Dan Mick committed Mar 19, 2014
1 parent 381850b commit 1268dbb
Show file tree
Hide file tree
Showing 57 changed files with 308 additions and 304 deletions.
14 changes: 7 additions & 7 deletions src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ void Client::dump_mds_sessions(Formatter *f)
}
void Client::dump_mds_requests(Formatter *f)
{
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
for (map<ceph_tid_t, MetaRequest*>::iterator p = mds_requests.begin();
p != mds_requests.end();
++p) {
f->open_object_section("request");
Expand Down Expand Up @@ -1315,7 +1315,7 @@ int Client::make_request(MetaRequest *request,
int r = 0;

// assign a unique tid
tid_t tid = ++last_tid;
ceph_tid_t tid = ++last_tid;
request->set_tid(tid);
// make note
mds_requests[tid] = request->get();
Expand Down Expand Up @@ -1726,7 +1726,7 @@ void Client::handle_client_request_forward(MClientRequestForward *fwd)
fwd->put();
return;
}
tid_t tid = fwd->get_tid();
ceph_tid_t tid = fwd->get_tid();

if (mds_requests.count(tid) == 0) {
ldout(cct, 10) << "handle_client_request_forward no pending request on tid " << tid << dendl;
Expand Down Expand Up @@ -1765,7 +1765,7 @@ void Client::handle_client_reply(MClientReply *reply)
return;
}

tid_t tid = reply->get_tid();
ceph_tid_t tid = reply->get_tid();
bool is_safe = reply->is_safe();

if (mds_requests.count(tid) == 0) {
Expand Down Expand Up @@ -2043,7 +2043,7 @@ void Client::send_reconnect(MetaSession *session)
void Client::kick_requests(MetaSession *session)
{
ldout(cct, 10) << "kick_requests for mds." << session->mds_num << dendl;
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
for (map<ceph_tid_t, MetaRequest*>::iterator p = mds_requests.begin();
p != mds_requests.end();
++p) {
if (p->second->mds == session->mds_num) {
Expand All @@ -2063,7 +2063,7 @@ void Client::resend_unsafe_requests(MetaSession *session)
void Client::kick_requests_closed(MetaSession *session)
{
ldout(cct, 10) << "kick_requests_closed for mds." << session->mds_num << dendl;
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
for (map<ceph_tid_t, MetaRequest*>::iterator p = mds_requests.begin();
p != mds_requests.end();
++p) {
if (p->second->mds == session->mds_num) {
Expand Down Expand Up @@ -6513,7 +6513,7 @@ int Client::_fsync(Fh *f, bool syncdataonly)
int r = 0;

Inode *in = f->inode;
tid_t wait_on_flush = 0;
ceph_tid_t wait_on_flush = 0;
bool flushed_metadata = false;
Mutex lock("Client::_fsync::lock");
Cond cond;
Expand Down
4 changes: 2 additions & 2 deletions src/client/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ class Client : public Dispatcher {
void resend_unsafe_requests(MetaSession *s);

// mds requests
tid_t last_tid, last_flush_seq;
map<tid_t, MetaRequest*> mds_requests;
ceph_tid_t last_tid, last_flush_seq;
map<ceph_tid_t, MetaRequest*> mds_requests;
set<int> failed_mds;

void dump_mds_requests(Formatter *f);
Expand Down
2 changes: 1 addition & 1 deletion src/client/Inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Inode {
int snap_caps, snap_cap_refs;
utime_t hold_caps_until;
xlist<Inode*>::item cap_item, flushing_cap_item;
tid_t last_flush_tid;
ceph_tid_t last_flush_tid;

SnapRealm *snaprealm;
xlist<Inode*>::item snaprealm_item;
Expand Down
6 changes: 3 additions & 3 deletions src/client/MetaRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ struct MetaRequest {
}

// normal fields
void set_tid(tid_t t) { tid = t; }
void set_oldest_client_tid(tid_t t) { head.oldest_client_tid = t; }
void set_tid(ceph_tid_t t) { tid = t; }
void set_oldest_client_tid(ceph_tid_t t) { head.oldest_client_tid = t; }
void inc_num_fwd() { head.num_fwd = head.num_fwd + 1; }
void set_retry_attempt(int a) { head.num_retry = a; }
void set_filepath(const filepath& fp) { path = fp; }
Expand All @@ -154,7 +154,7 @@ struct MetaRequest {
head.flags = head.flags | CEPH_MDS_FLAG_WANT_DENTRY;
}
int get_op() { return head.op; }
tid_t get_tid() { return tid; }
ceph_tid_t get_tid() { return tid; }
filepath& get_filepath() { return path; }
filepath& get_filepath2() { return path2; }

Expand Down
4 changes: 2 additions & 2 deletions src/client/ObjecterWriteback.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class ObjecterWriteback : public WritebackHandler {
return false;
}

virtual tid_t write(const object_t& oid, const object_locator_t& oloc,
virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len, const SnapContext& snapc,
const bufferlist &bl, utime_t mtime, uint64_t trunc_size,
__u32 trunc_seq, Context *oncommit) {
return m_objecter->write_trunc(oid, oloc, off, len, snapc, bl, mtime, 0,
trunc_size, trunc_seq, NULL, oncommit);
}

virtual tid_t lock(const object_t& oid, const object_locator_t& oloc, int op,
virtual ceph_tid_t lock(const object_t& oid, const object_locator_t& oloc, int op,
int flags, Context *onack, Context *oncommit) {
return m_objecter->lock(oid, oloc, op, flags, onack, oncommit);
}
Expand Down
2 changes: 1 addition & 1 deletion src/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ WRITE_RAW_ENCODER(ceph_mon_statfs_reply)
// some basic types

// NOTE: these must match ceph_fs.h typedefs
typedef uint64_t tid_t; // transaction id
typedef uint64_t ceph_tid_t; // transaction id
typedef uint64_t version_t;
typedef __u32 epoch_t; // map epoch (32bits -> 13 epochs/second for 10 years)

Expand Down
2 changes: 1 addition & 1 deletion src/librados/AioCompletionImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct librados::AioCompletionImpl {
unsigned maxlen;

IoCtxImpl *io;
tid_t aio_write_seq;
ceph_tid_t aio_write_seq;
xlist<AioCompletionImpl*>::item aio_write_list_item;

AioCompletionImpl() : lock("AioCompletionImpl lock", false, false),
Expand Down
6 changes: 3 additions & 3 deletions src/librados/IoCtxImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void librados::IoCtxImpl::complete_aio_write(AioCompletionImpl *c)
assert(c->io == this);
c->aio_write_list_item.remove_myself();

map<tid_t, std::list<AioCompletionImpl*> >::iterator waiters = aio_write_waiters.begin();
map<ceph_tid_t, std::list<AioCompletionImpl*> >::iterator waiters = aio_write_waiters.begin();
while (waiters != aio_write_waiters.end()) {
if (!aio_write_list.empty() &&
aio_write_list.front()->aio_write_seq <= waiters->first) {
Expand Down Expand Up @@ -123,7 +123,7 @@ void librados::IoCtxImpl::flush_aio_writes_async(AioCompletionImpl *c)
ldout(client->cct, 20) << "flush_aio_writes_async " << this
<< " completion " << c << dendl;
Mutex::Locker l(aio_write_list_lock);
tid_t seq = aio_write_seq;
ceph_tid_t seq = aio_write_seq;
if (aio_write_list.empty()) {
ldout(client->cct, 20) << "flush_aio_writes_async no writes. (tid "
<< seq << ")" << dendl;
Expand All @@ -140,7 +140,7 @@ void librados::IoCtxImpl::flush_aio_writes()
{
ldout(client->cct, 20) << "flush_aio_writes" << dendl;
aio_write_list_lock.Lock();
tid_t seq = aio_write_seq;
ceph_tid_t seq = aio_write_seq;
while (!aio_write_list.empty() &&
aio_write_list.front()->aio_write_seq <= seq)
aio_write_cond.Wait(aio_write_list_lock);
Expand Down
4 changes: 2 additions & 2 deletions src/librados/IoCtxImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ struct librados::IoCtxImpl {
object_locator_t oloc;

Mutex aio_write_list_lock;
tid_t aio_write_seq;
ceph_tid_t aio_write_seq;
Cond aio_write_cond;
xlist<AioCompletionImpl*> aio_write_list;
map<tid_t, std::list<AioCompletionImpl*> > aio_write_waiters;
map<ceph_tid_t, std::list<AioCompletionImpl*> > aio_write_waiters;

Mutex *lock;
Objecter *objecter;
Expand Down
4 changes: 2 additions & 2 deletions src/librados/RadosClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ int librados::RadosClient::osd_command(int osd, vector<string>& cmd,
Cond cond;
bool done;
int ret;
tid_t tid;
ceph_tid_t tid;

if (osd < 0)
return -EINVAL;
Expand All @@ -781,7 +781,7 @@ int librados::RadosClient::pg_command(pg_t pgid, vector<string>& cmd,
Cond cond;
bool done;
int ret;
tid_t tid;
ceph_tid_t tid;
lock.Lock();
int r = objecter->pg_command(pgid, cmd, inbl, &tid, poutbl, prs,
new C_SafeCond(&mylock, &cond, &done, &ret));
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/LibrbdWriteback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ namespace librbd {
return may;
}

tid_t LibrbdWriteback::write(const object_t& oid,
ceph_tid_t LibrbdWriteback::write(const object_t& oid,
const object_locator_t& oloc,
uint64_t off, uint64_t len,
const SnapContext& snapc,
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/LibrbdWriteback.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace librbd {
virtual bool may_copy_on_write(const object_t& oid, uint64_t read_off, uint64_t read_len, snapid_t snapid);

// Note that oloc, trunc_size, and trunc_seq are ignored
virtual tid_t write(const object_t& oid, const object_locator_t& oloc,
virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len, const SnapContext& snapc,
const bufferlist &bl, utime_t mtime, uint64_t trunc_size,
__u32 trunc_seq, Context *oncommit);
Expand All @@ -52,7 +52,7 @@ namespace librbd {
private:
void complete_writes(const std::string& oid);

tid_t m_tid;
ceph_tid_t m_tid;
Mutex& m_lock;
librbd::ImageCtx *m_ictx;
ceph::unordered_map<std::string, std::queue<write_result_d*> > m_writes;
Expand Down
2 changes: 1 addition & 1 deletion src/mds/LogSegment.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class LogSegment {
set<dirfrag_t> uncommitted_fragments;

// client request ids
map<int, tid_t> last_client_tids;
map<int, ceph_tid_t> last_client_tids;

// table version
version_t inotablev;
Expand Down
10 changes: 5 additions & 5 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,7 @@ void MDCache::find_ino_peers(inodeno_t ino, Context *c, int hint)
dout(5) << "find_ino_peers " << ino << " hint " << hint << dendl;
assert(!have_inode(ino));

tid_t tid = ++find_ino_peer_last_tid;
ceph_tid_t tid = ++find_ino_peer_last_tid;
find_ino_peer_info_t& fip = find_ino_peer[tid];
fip.ino = ino;
fip.tid = tid;
Expand Down Expand Up @@ -8731,7 +8731,7 @@ void MDCache::handle_find_ino(MMDSFindIno *m)

void MDCache::handle_find_ino_reply(MMDSFindInoReply *m)
{
map<tid_t, find_ino_peer_info_t>::iterator p = find_ino_peer.find(m->tid);
map<ceph_tid_t, find_ino_peer_info_t>::iterator p = find_ino_peer.find(m->tid);
if (p != find_ino_peer.end()) {
dout(10) << "handle_find_ino_reply " << *m << dendl;
find_ino_peer_info_t& fip = p->second;
Expand Down Expand Up @@ -8773,7 +8773,7 @@ void MDCache::handle_find_ino_reply(MMDSFindInoReply *m)
void MDCache::kick_find_ino_peers(int who)
{
// find_ino_peers requests we should move on from
for (map<tid_t,find_ino_peer_info_t>::iterator p = find_ino_peer.begin();
for (map<ceph_tid_t,find_ino_peer_info_t>::iterator p = find_ino_peer.begin();
p != find_ino_peer.end();
++p) {
find_ino_peer_info_t& fip = p->second;
Expand Down Expand Up @@ -10053,7 +10053,7 @@ void MDCache::discover_ino(CDir *base,

void MDCache::kick_discovers(int who)
{
for (map<tid_t,discover_info_t>::iterator p = discovers.begin();
for (map<ceph_tid_t,discover_info_t>::iterator p = discovers.begin();
p != discovers.end();
++p) {
if (p->second.mds != who)
Expand Down Expand Up @@ -10387,7 +10387,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)

// decrement discover counters
if (m->get_tid()) {
map<tid_t,discover_info_t>::iterator p = discovers.find(m->get_tid());
map<ceph_tid_t,discover_info_t>::iterator p = discovers.find(m->get_tid());
if (p != discovers.end()) {
dout(10) << " found tid " << m->get_tid() << dendl;
discovers.erase(p);
Expand Down
16 changes: 8 additions & 8 deletions src/mds/MDCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class MDCache {

// -- discover --
struct discover_info_t {
tid_t tid;
ceph_tid_t tid;
int mds;
inodeno_t ino;
frag_t frag;
Expand All @@ -144,12 +144,12 @@ class MDCache {
discover_info_t() : tid(0), mds(-1), snap(CEPH_NOSNAP), want_base_dir(false), want_xlocked(false) {}
};

map<tid_t, discover_info_t> discovers;
tid_t discover_last_tid;
map<ceph_tid_t, discover_info_t> discovers;
ceph_tid_t discover_last_tid;

void _send_discover(discover_info_t& dis);
discover_info_t& _create_discover(int mds) {
tid_t t = ++discover_last_tid;
ceph_tid_t t = ++discover_last_tid;
discover_info_t& d = discovers[t];
d.tid = t;
d.mds = mds;
Expand Down Expand Up @@ -802,7 +802,7 @@ class MDCache {
open_ino_info_t() : checking(-1), auth_hint(-1),
check_peers(true), fetch_backtrace(true), discover(false) {}
};
tid_t open_ino_last_tid;
ceph_tid_t open_ino_last_tid;
map<inodeno_t,open_ino_info_t> opening_inodes;

void _open_ino_backtrace_fetched(inodeno_t ino, bufferlist& bl, int err);
Expand Down Expand Up @@ -830,7 +830,7 @@ class MDCache {
// -- find_ino_peer --
struct find_ino_peer_info_t {
inodeno_t ino;
tid_t tid;
ceph_tid_t tid;
Context *fin;
int hint;
int checking;
Expand All @@ -839,8 +839,8 @@ class MDCache {
find_ino_peer_info_t() : tid(0), fin(NULL), hint(-1), checking(-1) {}
};

map<tid_t, find_ino_peer_info_t> find_ino_peer;
tid_t find_ino_peer_last_tid;
map<ceph_tid_t, find_ino_peer_info_t> find_ino_peer;
ceph_tid_t find_ino_peer_last_tid;

void find_ino_peers(inodeno_t ino, Context *c, int hint=-1);
void _do_find_ino_peer(find_ino_peer_info_t& fip);
Expand Down
4 changes: 2 additions & 2 deletions src/mds/MDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class MDS : public Dispatcher {

map<int,version_t> peer_mdsmap_epoch;

tid_t last_tid; // for mds-initiated requests (e.g. stray rename)
ceph_tid_t last_tid; // for mds-initiated requests (e.g. stray rename)

public:
void wait_for_active(Context *c) {
Expand Down Expand Up @@ -251,7 +251,7 @@ class MDS : public Dispatcher {

void request_state(int s);

tid_t issue_tid() { return ++last_tid; }
ceph_tid_t issue_tid() { return ++last_tid; }


// -- waiters --
Expand Down
10 changes: 5 additions & 5 deletions src/mds/SessionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ class Session : public RefCountedObject {


public:
void add_completed_request(tid_t t, inodeno_t created) {
void add_completed_request(ceph_tid_t t, inodeno_t created) {
info.completed_requests[t] = created;
}
void trim_completed_requests(tid_t mintid) {
void trim_completed_requests(ceph_tid_t mintid) {
// trim
while (!info.completed_requests.empty() &&
(mintid == 0 || info.completed_requests.begin()->first < mintid))
info.completed_requests.erase(info.completed_requests.begin());
}
bool have_completed_request(tid_t tid, inodeno_t *pcreated) const {
map<tid_t,inodeno_t>::const_iterator p = info.completed_requests.find(tid);
bool have_completed_request(ceph_tid_t tid, inodeno_t *pcreated) const {
map<ceph_tid_t,inodeno_t>::const_iterator p = info.completed_requests.find(tid);
if (p == info.completed_requests.end())
return false;
if (pcreated)
Expand Down Expand Up @@ -370,7 +370,7 @@ class SessionMap {
Session *session = get_session(rid.name);
return session && session->have_completed_request(rid.tid, NULL);
}
void trim_completed_requests(entity_name_t c, tid_t tid) {
void trim_completed_requests(entity_name_t c, ceph_tid_t tid) {
Session *session = get_session(c);
assert(session);
session->trim_completed_requests(tid);
Expand Down
4 changes: 2 additions & 2 deletions src/mds/mdstypes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void session_info_t::decode(bufferlist::iterator& p)
DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, p);
::decode(inst, p);
if (struct_v <= 2) {
set<tid_t> s;
set<ceph_tid_t> s;
::decode(s, p);
while (!s.empty()) {
completed_requests[*s.begin()] = inodeno_t();
Expand All @@ -576,7 +576,7 @@ void session_info_t::dump(Formatter *f) const
f->dump_stream("inst") << inst;

f->open_array_section("completed_requests");
for (map<tid_t,inodeno_t>::const_iterator p = completed_requests.begin();
for (map<ceph_tid_t,inodeno_t>::const_iterator p = completed_requests.begin();
p != completed_requests.end();
++p) {
f->open_object_section("request");
Expand Down
Loading

0 comments on commit 1268dbb

Please sign in to comment.