summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-02-18 16:49:39 -0800
committerSage Weil <sage@newdream.net>2009-02-19 15:25:46 -0800
commit86c92a277dd9761cfd9ee547382e5e88f79087f9 (patch)
tree83b9b208df631ed36a3bd3114a6aed10c169811b
parent52b90a4c3f1553bbdb9e8f3512d5f157d95ff157 (diff)
downloadceph-86c92a277dd9761cfd9ee547382e5e88f79087f9.tar.gz
mds: masterinotable, client prealloc
-rw-r--r--src/Makefile.am3
-rw-r--r--src/include/ceph_fs.h10
-rw-r--r--src/mds/InoTable.h8
-rw-r--r--src/mds/LogEvent.cc2
-rw-r--r--src/mds/LogEvent.h2
-rw-r--r--src/mds/LogSegment.h4
-rw-r--r--src/mds/MDS.cc10
-rw-r--r--src/mds/MDS.h2
-rw-r--r--src/mds/MDSMap.h4
-rw-r--r--src/mds/MasterInoTable.cc79
-rw-r--r--src/mds/MasterInoTable.h53
-rw-r--r--src/mds/Server.cc64
-rw-r--r--src/mds/Server.h4
-rw-r--r--src/mds/events/EPrealloc.h54
-rw-r--r--src/mds/journal.cc33
-rw-r--r--src/mds/mdstypes.h1
-rw-r--r--src/messages/MClientReply.h35
17 files changed, 342 insertions, 26 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 48cb454015f..25b2a79b884 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -228,6 +228,7 @@ libmds_a_SOURCES = \
mds/LogEvent.cc \
mds/MDSTable.cc \
mds/InoTable.cc \
+ mds/MasterInoTable.cc \
mds/MDSTableClient.cc \
mds/MDSTableServer.cc \
mds/AnchorServer.cc \
@@ -396,6 +397,7 @@ noinst_HEADERS = \
mds/Locker.h\
mds/LogEvent.h\
mds/LogSegment.h\
+ mds/MasterInoTable.h\
mds/MDBalancer.h\
mds/MDCache.h\
mds/MDLog.h\
@@ -418,6 +420,7 @@ noinst_HEADERS = \
mds/events/EImportStart.h\
mds/events/EMetaBlob.h\
mds/events/EOpen.h\
+ mds/events/EPrealloc.h\
mds/events/ESession.h\
mds/events/ESessions.h\
mds/events/ESlaveUpdate.h\
diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h
index 5c2f269f1a8..285a9c75992 100644
--- a/src/include/ceph_fs.h
+++ b/src/include/ceph_fs.h
@@ -656,7 +656,8 @@ struct ceph_mds_session_head {
* metadata ops.
* & 0x001000 -> write op
* & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
- & & 0x100000 -> use weird ino/path trace
+ * & 0x100000 -> use weird ino/path trace
+ * & 0x200000 -> no path
*/
#define CEPH_MDS_OP_WRITE 0x001000
#define CEPH_MDS_OP_FOLLOW_LINK 0x010000
@@ -664,6 +665,8 @@ struct ceph_mds_session_head {
enum {
CEPH_MDS_OP_FINDINODE = 0x100100,
+ CEPH_MDS_OP_PREALLOC = 0x200100,
+
CEPH_MDS_OP_LSTAT = 0x00100,
CEPH_MDS_OP_LUTIME = 0x01101,
CEPH_MDS_OP_LCHMOD = 0x01102,
@@ -702,6 +705,7 @@ static inline const char *ceph_mds_op_name(int op)
{
switch (op) {
case CEPH_MDS_OP_FINDINODE: return "findinode";
+ case CEPH_MDS_OP_PREALLOC: return "prealloc";
case CEPH_MDS_OP_STAT: return "stat";
case CEPH_MDS_OP_LSTAT: return "lstat";
case CEPH_MDS_OP_UTIME: return "utime";
@@ -736,6 +740,9 @@ static inline const char *ceph_mds_op_name(int op)
union ceph_mds_request_args {
struct {
+ __le32 num;
+ } __attribute__ ((packed)) prealloc;
+ struct {
__le32 mask;
} __attribute__ ((packed)) stat;
struct {
@@ -811,6 +818,7 @@ struct ceph_mds_reply_head {
ceph_tid_t tid;
__le32 op;
__le32 result;
+ __le64 ino; /* used by prealloc */
__le32 mdsmap_epoch;
__u8 safe;
} __attribute__ ((packed));
diff --git a/src/mds/InoTable.h b/src/mds/InoTable.h
index 13969b30721..1b16c291c0c 100644
--- a/src/mds/InoTable.h
+++ b/src/mds/InoTable.h
@@ -21,6 +21,8 @@
class MDS;
+WRITE_CLASS_ENCODER(interval_set<inodeno_t>)
+
class InoTable : public MDSTable {
interval_set<inodeno_t> free; // unused ids
interval_set<inodeno_t> projected_free;
@@ -44,11 +46,11 @@ class InoTable : public MDSTable {
void init_inode();
void reset_state();
void encode_state(bufferlist& bl) {
- ::encode(free.m, bl);
+ ::encode(free, bl);
}
void decode_state(bufferlist::iterator& bl) {
- ::decode(free.m, bl);
- projected_free.m = free.m;
+ ::decode(free, bl);
+ projected_free = free;
}
};
diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc
index 444fe7d8677..9462ac355e9 100644
--- a/src/mds/LogEvent.cc
+++ b/src/mds/LogEvent.cc
@@ -33,6 +33,7 @@
#include "events/ESlaveUpdate.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
+#include "events/EPrealloc.h"
#include "events/ETableClient.h"
#include "events/ETableServer.h"
@@ -68,6 +69,7 @@ LogEvent *LogEvent::decode(bufferlist& bl)
case EVENT_SLAVEUPDATE: le = new ESlaveUpdate; break;
case EVENT_OPEN: le = new EOpen; break;
case EVENT_COMMITTED: le = new ECommitted; break;
+ case EVENT_PREALLOC: le = new EPrealloc; break;
case EVENT_TABLECLIENT: le = new ETableClient; break;
case EVENT_TABLESERVER: le = new ETableServer; break;
diff --git a/src/mds/LogEvent.h b/src/mds/LogEvent.h
index 64e7e4fad9d..76ecd1ae395 100644
--- a/src/mds/LogEvent.h
+++ b/src/mds/LogEvent.h
@@ -30,12 +30,12 @@
#define EVENT_SLAVEUPDATE 21
#define EVENT_OPEN 22
#define EVENT_COMMITTED 23
+#define EVENT_PREALLOC 24
#define EVENT_TABLECLIENT 42
#define EVENT_TABLESERVER 43
-
#include <string>
using namespace std;
diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h
index 61841d450ad..03acd7f694e 100644
--- a/src/mds/LogSegment.h
+++ b/src/mds/LogSegment.h
@@ -57,7 +57,7 @@ class LogSegment {
map<int, tid_t> last_client_tids;
// table version
- version_t inotablev;
+ version_t inotablev, masterinotablev;
version_t sessionmapv;
map<int,version_t> tablev;
@@ -66,7 +66,7 @@ class LogSegment {
// cons
LogSegment(loff_t off) : offset(off), end(off), num_events(0), trimmable_at(0),
- inotablev(0), sessionmapv(0)
+ inotablev(0), masterinotablev(0), sessionmapv(0)
{ }
};
diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc
index f161799b852..64318530782 100644
--- a/src/mds/MDS.cc
+++ b/src/mds/MDS.cc
@@ -39,6 +39,7 @@
#include "SnapClient.h"
#include "InoTable.h"
+#include "MasterInoTable.h"
#include "common/Logger.h"
#include "common/LogType.h"
@@ -94,6 +95,7 @@ MDS::MDS(int whoami_, Messenger *m, MonMap *mm) :
balancer = new MDBalancer(this);
inotable = new InoTable(this);
+ masterinotable = new MasterInoTable(this);
snapserver = new SnapServer(this);
snapclient = new SnapClient(this);
anchorserver = new AnchorServer(this);
@@ -128,6 +130,7 @@ MDS::~MDS() {
if (mdlog) { delete mdlog; mdlog = NULL; }
if (balancer) { delete balancer; balancer = NULL; }
if (inotable) { delete inotable; inotable = NULL; }
+ if (masterinotable) { delete masterinotable; masterinotable = NULL; }
if (anchorserver) { delete anchorserver; anchorserver = NULL; }
if (snapserver) { delete snapserver; snapserver = NULL; }
if (snapclient) { delete snapclient; snapclient = NULL; }
@@ -814,6 +817,10 @@ void MDS::boot_create()
dout(10) << "boot_create creating fresh snaptable" << dendl;
snapserver->reset();
snapserver->save(fin->new_sub());
+
+ dout(10) << "boot_create creating fresh masterinotable" << dendl;
+ masterinotable->reset();
+ masterinotable->save(fin->new_sub());
}
}
@@ -859,6 +866,9 @@ void MDS::boot_start(int step, int r)
dout(2) << "boot_start " << step << ": opening snap table" << dendl;
snapserver->load(gather->new_sub());
+
+ dout(2) << "boot_start " << step << ": opening master ino table" << dendl;
+ masterinotable->load(gather->new_sub());
}
dout(2) << "boot_start " << step << ": opening mds log" << dendl;
diff --git a/src/mds/MDS.h b/src/mds/MDS.h
index 929a376ee64..9e3d59a5e8e 100644
--- a/src/mds/MDS.h
+++ b/src/mds/MDS.h
@@ -60,6 +60,7 @@ class MClientReply;
class MMDSBeacon;
class InoTable;
+class MasterInoTable;
class SnapServer;
class SnapClient;
class AnchorServer;
@@ -94,6 +95,7 @@ class MDS : public Dispatcher {
MDBalancer *balancer;
InoTable *inotable;
+ MasterInoTable *masterinotable;
AnchorServer *anchorserver;
AnchorClient *anchorclient;
diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h
index 8428c4d77ce..767abb2cb15 100644
--- a/src/mds/MDSMap.h
+++ b/src/mds/MDSMap.h
@@ -372,13 +372,13 @@ class MDSMap {
::encode(client_epoch, bl);
::encode(last_failure, bl);
::encode(root, bl);
+ ::encode(tableserver, bl);
::encode(session_timeout, bl);
::encode(session_autoclose, bl);
::encode(max_mds, bl);
::encode(mds_info, bl);
::encode(created, bl);
- ::encode(tableserver, bl);
::encode(in, bl);
::encode(inc, bl);
::encode(up, bl);
@@ -390,13 +390,13 @@ class MDSMap {
::decode(client_epoch, p);
::decode(last_failure, p);
::decode(root, p);
+ ::decode(tableserver, p);
::decode(session_timeout, p);
::decode(session_autoclose, p);
::decode(max_mds, p);
::decode(mds_info, p);
::decode(created, p);
- ::decode(tableserver, p);
::decode(in, p);
::decode(inc, p);
::decode(up, p);
diff --git a/src/mds/MasterInoTable.cc b/src/mds/MasterInoTable.cc
new file mode 100644
index 00000000000..683ae189d56
--- /dev/null
+++ b/src/mds/MasterInoTable.cc
@@ -0,0 +1,79 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "MasterInoTable.h"
+#include "MDS.h"
+
+#include "include/types.h"
+
+#include "config.h"
+
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << "." << table_name << ": "
+
+void MasterInoTable::init_inode()
+{
+ ino = MDS_INO_MASTERINOTABLE;
+ layout = g_default_file_layout;
+}
+
+void MasterInoTable::reset_state()
+{
+ free.clear();
+ prealloc.clear();
+
+ uint64_t start = (uint64_t)(MAX_MDS+1) << 40;
+ uint64_t end = ((uint64_t)(-1));
+ free.insert(start, end-start);
+
+ projected_free.m = free.m;
+}
+
+void MasterInoTable::project_prealloc(int client, inodeno_t& start, unsigned& len)
+{
+ assert(is_active());
+
+ dout(10) << "project_prealloc client" << client << " " << len << " from " << projected_free << dendl;
+
+ start = projected_free.start();
+ inodeno_t end = projected_free.end_after(start);
+ if (end - start < len)
+ len = end-start;
+
+ dout(10) << "project_prealloc client" << client << " " << start << "~" << len
+ << " to " << projected_free << "/" << free << dendl;
+
+ projected_free.erase(start, len);
+ projected_prealloc[client].insert(start, len);
+ ++projected_version;
+}
+
+void MasterInoTable::apply_prealloc(int client, inodeno_t start, unsigned len)
+{
+ dout(10) << "apply_prealloc client" << client << " " << start << "~" << len << dendl;
+ free.erase(start, len);
+ prealloc[client].insert(start, len);
+ ++version;
+}
+
+void MasterInoTable::replay_prealloc(int client, inodeno_t start, unsigned len)
+{
+ dout(10) << "replay_prealloc client" << client << " " << start << "~" << len << dendl;
+ free.erase(start, len);
+ projected_free.erase(start, len);
+ prealloc[client].insert(start, len);
+ projected_prealloc[client].insert(start, len);
+ projected_version = ++version;
+}
diff --git a/src/mds/MasterInoTable.h b/src/mds/MasterInoTable.h
new file mode 100644
index 00000000000..5602127c4b2
--- /dev/null
+++ b/src/mds/MasterInoTable.h
@@ -0,0 +1,53 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+
+#ifndef __MASTERINOTABLE_H
+#define __MASTERINOTABLE_H
+
+#include "InoTable.h"
+#include "MDSTable.h"
+#include "include/interval_set.h"
+
+class MDS;
+
+class MasterInoTable : public MDSTable {
+ interval_set<inodeno_t> free, projected_free;
+ map<int, interval_set<inodeno_t> > prealloc, projected_prealloc;
+
+ public:
+ MasterInoTable(MDS *m) : MDSTable(m, "masterinotable") { }
+
+ void project_prealloc(int client, inodeno_t& start, unsigned& len);
+ void apply_prealloc(int client, inodeno_t start, unsigned len);
+ void replay_prealloc(int client, inodeno_t start, unsigned len);
+
+ void project_reap(int client, inodeno_t start, inodeno_t len);
+
+ void init_inode();
+ void reset_state();
+ void encode_state(bufferlist& bl) {
+ ::encode(free, bl);
+ ::encode(prealloc, bl);
+ }
+ void decode_state(bufferlist::iterator& bl) {
+ ::decode(free, bl);
+ ::decode(prealloc, bl);
+
+ projected_free.m = free.m;
+ projected_prealloc = prealloc;
+ }
+};
+
+#endif
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index a514bcf1f60..5002d2c7570 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -21,6 +21,7 @@
#include "MDBalancer.h"
#include "AnchorClient.h"
#include "InoTable.h"
+#include "MasterInoTable.h"
#include "SnapClient.h"
#include "msg/Messenger.h"
@@ -44,6 +45,7 @@
#include "events/ESession.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
+#include "events/EPrealloc.h"
#include "include/filepath.h"
#include "common/Timer.h"
@@ -885,6 +887,10 @@ void Server::dispatch_client_request(MDRequest *mdr)
handle_client_findinode(mdr);
break;
+ case CEPH_MDS_OP_PREALLOC:
+ handle_client_prealloc(mdr);
+ break;
+
// inodes ops.
case CEPH_MDS_OP_STAT:
case CEPH_MDS_OP_LSTAT:
@@ -978,6 +984,64 @@ void Server::dispatch_client_request(MDRequest *mdr)
// ---------------------------------------
+// client ino preallocation
+
+struct C_MDS_Prealloc : public Context {
+ Server *server;
+ MDRequest *mdr;
+ inodeno_t start;
+ unsigned len;
+ C_MDS_Prealloc(Server *s, MDRequest *m, inodeno_t st, unsigned l) :
+ server(s), mdr(m), start(st), len(l) {}
+ void finish(int r) {
+ server->_prealloc_finish(mdr, start, len);
+ }
+};
+
+void Server::handle_client_prealloc(MDRequest *mdr)
+{
+ MClientRequest *req = mdr->client_request;
+
+ dout(10) << "handle_client_prealloc " << *req
+ << " num " << req->head.args.prealloc.num
+ << dendl;
+
+ if (mds->get_nodeid() != mds->mdsmap->get_tableserver()) {
+ mdcache->request_forward(mdr, mds->mdsmap->get_tableserver());
+ return;
+ }
+
+ int client = mdr->get_client();
+ inodeno_t start;
+ unsigned len = req->head.args.prealloc.num;
+
+ if (!len) {
+ reply_request(mdr, 0);
+ return;
+ }
+
+ mds->masterinotable->project_prealloc(client, start, len);
+
+ EPrealloc *le = new EPrealloc(mds->mdlog, client, start, len, mds->masterinotable->get_projected_version());
+ mds->mdlog->submit_entry(le, new C_MDS_Prealloc(this, mdr, start, len));
+}
+
+
+void Server::_prealloc_finish(MDRequest *mdr, inodeno_t start, unsigned len)
+{
+ dout(10) << "_prealloc_finish " << *mdr << dendl;
+ int client = mdr->get_client();
+ mds->masterinotable->apply_prealloc(client, start, len);
+
+ MClientReply *reply = new MClientReply(mdr->client_request, 0);
+ reply->set_ino(start, len);
+ reply_request(mdr, reply);
+}
+
+
+
+
+// ---------------------------------------
// SLAVE REQUESTS
void Server::handle_slave_request(MMDSSlaveRequest *m)
diff --git a/src/mds/Server.h b/src/mds/Server.h
index 83ccf793cc8..8b974de5b0a 100644
--- a/src/mds/Server.h
+++ b/src/mds/Server.h
@@ -107,6 +107,10 @@ public:
CDir* try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequest *mdr);
+ // prealloc
+ void handle_client_prealloc(MDRequest *mdr);
+ void _prealloc_finish(MDRequest *mdr, inodeno_t start, unsigned len);
+
// requests on existing inodes.
void handle_client_stat(MDRequest *mdr);
void handle_client_findinode(MDRequest *mdr);
diff --git a/src/mds/events/EPrealloc.h b/src/mds/events/EPrealloc.h
new file mode 100644
index 00000000000..d3cb16edb0b
--- /dev/null
+++ b/src/mds/events/EPrealloc.h
@@ -0,0 +1,54 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#ifndef __MDS_EPREALLOC_H
+#define __MDS_EPREALLOC_H
+
+#include "../LogEvent.h"
+#include "EMetaBlob.h"
+
+class EPrealloc : public LogEvent {
+public:
+ int client;
+ inodeno_t start, len;
+ version_t tablev;
+
+ EPrealloc() : LogEvent(EVENT_PREALLOC) { }
+ EPrealloc(MDLog *mdlog,
+ int c, inodeno_t s, inodeno_t l, version_t v) :
+ LogEvent(EVENT_PREALLOC),
+ client(c), start(s), len(l), tablev(v) {}
+
+ void print(ostream& out) {
+ out << "EPrealloc client" << client << " " << start << "~" << len << " v" << tablev;
+ }
+
+ void encode(bufferlist &bl) const {
+ ::encode(client, bl);
+ ::encode(start, bl);
+ ::encode(len, bl);
+ ::encode(tablev, bl);
+ }
+ void decode(bufferlist::iterator &bl) {
+ ::decode(client, bl);
+ ::decode(start, bl);
+ ::decode(len, bl);
+ ::decode(tablev, bl);
+ }
+
+ void update_segment();
+ void replay(MDS *mds);
+};
+
+#endif
diff --git a/src/mds/journal.cc b/src/mds/journal.cc
index 8cde8cb94c0..2f4893a371b 100644
--- a/src/mds/journal.cc
+++ b/src/mds/journal.cc
@@ -24,6 +24,7 @@
#include "events/ESlaveUpdate.h"
#include "events/EOpen.h"
#include "events/ECommitted.h"
+#include "events/EPrealloc.h"
#include "events/EExport.h"
#include "events/EImportStart.h"
@@ -43,6 +44,7 @@
#include "Migrator.h"
#include "InoTable.h"
+#include "MasterInoTable.h"
#include "MDSTableClient.h"
#include "MDSTableServer.h"
@@ -189,6 +191,15 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
mds->inotable->save(gather->new_sub(), inotablev);
}
+ if (masterinotablev > mds->masterinotable->get_committed_version()) {
+ dout(10) << "try_to_expire saving masterinotable table, need " << masterinotablev
+ << ", committed is " << mds->masterinotable->get_committed_version()
+ << " (" << mds->masterinotable->get_committing_version() << ")"
+ << dendl;
+ if (!gather) gather = new C_Gather;
+ mds->masterinotable->save(gather->new_sub(), masterinotablev);
+ }
+
// sessionmap
if (sessionmapv > mds->sessionmap.committed) {
dout(10) << "try_to_expire saving sessionmap, need " << sessionmapv
@@ -821,6 +832,28 @@ void ECommitted::replay(MDS *mds)
}
+// -----------------------
+// EPrealloc
+
+void EPrealloc::update_segment()
+{
+ _segment->masterinotablev = tablev;
+}
+
+void EPrealloc::replay(MDS *mds)
+{
+ if (mds->masterinotable->get_version() >= tablev) {
+ dout(10) << "EPrealloc.replay masterinotable tablev " << tablev
+ << " <= table " << mds->masterinotable->get_version() << dendl;
+ } else {
+ dout(10) << " EPrealloc.replay masterinotable v " << tablev
+ << " - 1 == table " << mds->masterinotable->get_version()
+ << dendl;
+ mds->masterinotable->replay_prealloc(client, start, len);
+ assert(tablev == mds->masterinotable->get_version());
+ }
+ update_segment();
+}
// -----------------------
// ESlaveUpdate
diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h
index c6232efaa71..53ae9ad5624 100644
--- a/src/mds/mdstypes.h
+++ b/src/mds/mdstypes.h
@@ -33,6 +33,7 @@ using namespace std;
#define MDS_INO_PGTABLE 2
#define MDS_INO_ANCHORTABLE 3
#define MDS_INO_SNAPTABLE 4
+#define MDS_INO_MASTERINOTABLE 5
#define MDS_INO_LOG_OFFSET (1*MAX_MDS)
#define MDS_INO_IDS_OFFSET (2*MAX_MDS)
diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h
index c5367a7f5a4..3e6f1b746b7 100644
--- a/src/messages/MClientReply.h
+++ b/src/messages/MClientReply.h
@@ -171,41 +171,42 @@ struct InodeStat {
class MClientReply : public Message {
// reply data
- struct ceph_mds_reply_head st;
+ struct ceph_mds_reply_head head;
bufferlist trace_bl;
bufferlist dir_bl;
public:
bufferlist snapbl;
public:
- long get_tid() { return st.tid; }
- int get_op() { return st.op; }
+ long get_tid() { return head.tid; }
+ int get_op() { return head.op; }
- void set_mdsmap_epoch(epoch_t e) { st.mdsmap_epoch = e; }
- epoch_t get_mdsmap_epoch() { return st.mdsmap_epoch; }
+ void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; }
+ epoch_t get_mdsmap_epoch() { return head.mdsmap_epoch; }
- int get_result() { return (__s32)(__u32)st.result; }
+ int get_result() { return (__s32)(__u32)head.result; }
- void set_result(int r) { st.result = r; }
+ void set_result(int r) { head.result = r; }
- void set_unsafe() { st.safe = 0; }
+ void set_unsafe() { head.safe = 0; }
+ void set_ino(inodeno_t i, int len) { head.ino = i; head.result = len; }
MClientReply() {}
MClientReply(MClientRequest *req, int result = 0) :
Message(CEPH_MSG_CLIENT_REPLY) {
- memset(&st, 0, sizeof(st));
- st.tid = req->get_tid();
- st.op = req->get_op();
- st.result = result;
- st.safe = 1;
+ memset(&head, 0, sizeof(head));
+ head.tid = req->get_tid();
+ head.op = req->get_op();
+ head.result = result;
+ head.safe = 1;
}
const char *get_type_name() { return "creply"; }
void print(ostream& o) {
- o << "client_reply(" << header.dst.name << "." << st.tid;
+ o << "client_reply(" << header.dst.name << "." << head.tid;
o << " = " << get_result();
if (get_result() <= 0)
o << " " << strerror(-get_result());
- if (st.safe)
+ if (head.safe)
o << " safe";
else
o << " unsafe";
@@ -215,14 +216,14 @@ public:
// serialization
virtual void decode_payload() {
bufferlist::iterator p = payload.begin();
- ::decode(st, p);
+ ::decode(head, p);
::decode(trace_bl, p);
::decode(dir_bl, p);
::decode(snapbl, p);
assert(p.end());
}
virtual void encode_payload() {
- ::encode(st, payload);
+ ::encode(head, payload);
::encode(trace_bl, payload);
::encode(dir_bl, payload);
::encode(snapbl, payload);