rename MClientFileCaps MClientCaps

This commit is contained in:
Sage Weil 2008-08-07 16:43:26 -07:00
parent 41c8a850d6
commit 7cc9015ee4
20 changed files with 78 additions and 80 deletions

View File

@ -402,7 +402,7 @@ noinst_HEADERS = \
messages/MOSDIn.h\
messages/MMDSBoot.h\
messages/MClientMount.h\
messages/MClientFileCaps.h\
messages/MClientCaps.h\
messages/MClientLease.h\
messages/MOSDMap.h\
messages/MOSDOp.h\

View File

@ -1,5 +1,3 @@
v0.3
v0.4
- ENOSPC
- finish client failure recovery (reconnect after long eviction; and slow delayed reconnect)

View File

@ -45,7 +45,7 @@ using namespace std;
#include "messages/MClientRequest.h"
#include "messages/MClientRequestForward.h"
#include "messages/MClientReply.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MClientLease.h"
#include "messages/MClientSnap.h"
@ -1113,8 +1113,8 @@ void Client::dispatch(Message *m)
case CEPH_MSG_CLIENT_SNAP:
handle_snap((MClientSnap*)m);
break;
case CEPH_MSG_CLIENT_FILECAPS:
handle_file_caps((MClientFileCaps*)m);
case CEPH_MSG_CLIENT_CAPS:
handle_caps((MClientCaps*)m);
break;
case CEPH_MSG_CLIENT_LEASE:
handle_lease((MClientLease*)m);
@ -1472,13 +1472,13 @@ void Client::check_caps(Inode *in, bool is_delayed, bool flush_snap)
op = CEPH_CAP_OP_FLUSHSNAP;
else if (wanted == 0)
op = CEPH_CAP_OP_RELEASE;
MClientFileCaps *m = new MClientFileCaps(op,
in->inode,
0,
cap->seq,
cap->issued,
wanted,
cap->mseq);
MClientCaps *m = new MClientCaps(op,
in->inode,
0,
cap->seq,
cap->issued,
wanted,
cap->mseq);
in->reported_size = in->inode.size;
m->set_max_size(in->wanted_max_size);
in->requested_max_size = in->wanted_max_size;
@ -1853,7 +1853,7 @@ void Client::handle_snap(MClientSnap *m)
delete m;
}
void Client::handle_file_caps(MClientFileCaps *m)
void Client::handle_caps(MClientCaps *m)
{
int mds = m->get_source().num();

View File

@ -840,7 +840,7 @@ protected:
vector<snapid_t>& snaps);
void handle_snap(class MClientSnap *m);
void handle_file_caps(class MClientFileCaps *m);
void handle_caps(class MClientCaps *m);
void cap_delay_requeue(Inode *in);
void check_caps(Inode *in, bool is_delayed, bool flush_snap=false);
void put_cap_ref(Inode *in, int cap);

View File

@ -419,7 +419,7 @@ struct ceph_msg_footer {
#define CEPH_MSG_CLIENT_REQUEST 24
#define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
#define CEPH_MSG_CLIENT_REPLY 26
#define CEPH_MSG_CLIENT_FILECAPS 0x310
#define CEPH_MSG_CLIENT_CAPS 0x310
#define CEPH_MSG_CLIENT_LEASE 0x311
#define CEPH_MSG_CLIENT_SNAP 0x312
@ -805,7 +805,7 @@ inline static const char* ceph_cap_op_name(int op) {
}
}
struct ceph_mds_file_caps {
struct ceph_mds_caps {
__le32 op;
__le64 ino;
__le32 seq;

View File

@ -182,7 +182,7 @@ struct ltstr
WRITE_RAW_ENCODER(ceph_fsid)
WRITE_RAW_ENCODER(ceph_file_layout)
WRITE_RAW_ENCODER(ceph_mds_request_head)
WRITE_RAW_ENCODER(ceph_mds_file_caps)
WRITE_RAW_ENCODER(ceph_mds_caps)
WRITE_RAW_ENCODER(ceph_mds_lease)
WRITE_RAW_ENCODER(ceph_mds_reply_head)
WRITE_RAW_ENCODER(ceph_mds_reply_inode)

View File

@ -1385,7 +1385,7 @@ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode)
* 0 - ok
* 1 - send the msg back to mds
*/
int ceph_handle_cap_grant(struct inode *inode, struct ceph_mds_file_caps *grant,
int ceph_handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
struct ceph_mds_session *session)
{
struct ceph_inode_cap *cap;
@ -1569,7 +1569,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode)
}
void ceph_handle_cap_trunc(struct inode *inode,
struct ceph_mds_file_caps *trunc,
struct ceph_mds_caps *trunc,
struct ceph_mds_session *session)
{
struct ceph_inode_info *ci = ceph_inode(inode);
@ -1612,7 +1612,7 @@ void ceph_handle_cap_trunc(struct inode *inode,
&ci->i_vmtruncate_work);
}
void ceph_handle_cap_export(struct inode *inode, struct ceph_mds_file_caps *ex,
void ceph_handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
struct ceph_mds_session *session)
{
struct ceph_inode_info *ci = ceph_inode(inode);
@ -1650,7 +1650,7 @@ out:
spin_unlock(&inode->i_lock);
}
void ceph_handle_cap_import(struct inode *inode, struct ceph_mds_file_caps *im,
void ceph_handle_cap_import(struct inode *inode, struct ceph_mds_caps *im,
struct ceph_mds_session *session)
{
struct ceph_inode_info *ci = ceph_inode(inode);

View File

@ -1460,13 +1460,13 @@ static void send_cap_ack(struct ceph_mds_client *mdsc, __u64 ino, int caps,
struct timespec *mtime, struct timespec *atime,
u64 time_warp_seq, int mds)
{
struct ceph_mds_file_caps *fc;
struct ceph_mds_caps *fc;
struct ceph_msg *msg;
dout(10, "send_cap_ack ino %llx caps %d wanted %d seq %u size %llu\n",
ino, caps, wanted, (unsigned)seq, size);
msg = ceph_msg_new(CEPH_MSG_CLIENT_FILECAPS, sizeof(*fc), 0, 0, 0);
msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), 0, 0, 0);
if (IS_ERR(msg))
return;
@ -1490,21 +1490,21 @@ static void send_cap_ack(struct ceph_mds_client *mdsc, __u64 ino, int caps,
send_msg_mds(mdsc, msg, mds);
}
void ceph_mdsc_handle_filecaps(struct ceph_mds_client *mdsc,
struct ceph_msg *msg)
void ceph_mdsc_handle_caps(struct ceph_mds_client *mdsc,
struct ceph_msg *msg)
{
struct super_block *sb = mdsc->client->sb;
struct ceph_client *client = ceph_sb_to_client(sb);
struct ceph_mds_session *session;
struct inode *inode;
struct ceph_mds_file_caps *h;
struct ceph_mds_caps *h;
int mds = le32_to_cpu(msg->hdr.src.name.num);
int op;
u32 seq;
u64 ino, size, max_size;
ino_t inot;
dout(10, "handle_filecaps from mds%d\n", mds);
dout(10, "handle_caps from mds%d\n", mds);
/* decode */
if (msg->front.iov_len != sizeof(*h))
@ -1521,7 +1521,7 @@ void ceph_mdsc_handle_filecaps(struct ceph_mds_client *mdsc,
session = __get_session(&client->mdsc, mds);
spin_unlock(&mdsc->lock);
if (!session) {
dout(10, "WTF, got filecap but no session for mds%d\n", mds);
dout(10, "WTF, got cap but no session for mds%d\n", mds);
return;
}
@ -1573,7 +1573,7 @@ no_inode:
return;
bad:
dout(10, "corrupt filecaps message\n");
dout(10, "corrupt caps message\n");
return;
}

View File

@ -144,8 +144,8 @@ extern void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc,
extern void ceph_mdsc_handle_forward(struct ceph_mds_client *mdsc,
struct ceph_msg *msg);
extern void ceph_mdsc_handle_filecaps(struct ceph_mds_client *mdsc,
struct ceph_msg *msg);
extern void ceph_mdsc_handle_caps(struct ceph_mds_client *mdsc,
struct ceph_msg *msg);
extern void ceph_mdsc_handle_lease(struct ceph_mds_client *mdsc,
struct ceph_msg *msg);

View File

@ -558,7 +558,7 @@ static __u64 calc_layout(struct ceph_osd_client *osdc,
__u64 toff = off, tlen = len;
reqhead->oid.ino = ino;
reqhead->oid.rev = 0;
reqhead->oid.snap = 0;
calc_file_object_mapping(layout, &toff, &tlen, &reqhead->oid,
&off, &len);

View File

@ -304,7 +304,7 @@ const char *ceph_msg_type_name(int type)
case CEPH_MSG_CLIENT_REQUEST: return "client_request";
case CEPH_MSG_CLIENT_REQUEST_FORWARD: return "client_request_forward";
case CEPH_MSG_CLIENT_REPLY: return "client_reply";
case CEPH_MSG_CLIENT_FILECAPS: return "client_filecaps";
case CEPH_MSG_CLIENT_CAPS: return "client_caps";
case CEPH_MSG_CLIENT_LEASE: return "client_lease";
case CEPH_MSG_OSD_GETMAP: return "osd_getmap";
case CEPH_MSG_OSD_MAP: return "osd_map";
@ -792,8 +792,8 @@ void ceph_dispatch(void *p, struct ceph_msg *msg)
case CEPH_MSG_CLIENT_REQUEST_FORWARD:
ceph_mdsc_handle_forward(&client->mdsc, msg);
break;
case CEPH_MSG_CLIENT_FILECAPS:
ceph_mdsc_handle_filecaps(&client->mdsc, msg);
case CEPH_MSG_CLIENT_CAPS:
ceph_mdsc_handle_caps(&client->mdsc, msg);
break;
case CEPH_MSG_CLIENT_LEASE:
ceph_mdsc_handle_lease(&client->mdsc, msg);

View File

@ -459,16 +459,16 @@ extern void ceph_remove_cap(struct ceph_inode_cap *cap);
extern void ceph_remove_all_caps(struct ceph_inode_info *ci);
extern int ceph_get_cap_mds(struct inode *inode);
extern int ceph_handle_cap_grant(struct inode *inode,
struct ceph_mds_file_caps *grant,
struct ceph_mds_caps *grant,
struct ceph_mds_session *session);
extern void ceph_handle_cap_trunc(struct inode *inode,
struct ceph_mds_file_caps *trunc,
struct ceph_mds_caps *trunc,
struct ceph_mds_session *session);
extern void ceph_handle_cap_export(struct inode *inode,
struct ceph_mds_file_caps *ex,
struct ceph_mds_caps *ex,
struct ceph_mds_session *session);
extern void ceph_handle_cap_import(struct inode *inode,
struct ceph_mds_file_caps *im,
struct ceph_mds_caps *im,
struct ceph_mds_session *session);
extern int ceph_get_cap_refs(struct ceph_inode_info *ci, int need, int want, int *got, loff_t offset);
extern void ceph_take_cap_refs(struct ceph_inode_info *ci, int got);

View File

@ -45,7 +45,7 @@
#include "messages/MClientRequest.h"
#include "messages/MClientReply.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MMDSSlaveRequest.h"
@ -73,8 +73,8 @@ void Locker::dispatch(Message *m)
break;
// client sync
case CEPH_MSG_CLIENT_FILECAPS:
handle_client_file_caps((MClientFileCaps*)m);
case CEPH_MSG_CLIENT_CAPS:
handle_client_caps((MClientCaps*)m);
break;
case CEPH_MSG_CLIENT_LEASE:
handle_client_lease((MClientLease*)m);
@ -617,11 +617,11 @@ bool Locker::issue_caps(CInode *in)
if (seq > 0 &&
!cap->is_suppress()) {
dout(7) << " sending MClientFileCaps to client" << it->first
dout(7) << " sending MClientCaps to client" << it->first
<< " seq " << cap->get_last_seq()
<< " new pending " << cap_string(cap->pending()) << " was " << cap_string(before)
<< dendl;
mds->send_message_client(new MClientFileCaps(CEPH_CAP_OP_GRANT,
mds->send_message_client(new MClientCaps(CEPH_CAP_OP_GRANT,
in->inode,
in->find_snaprealm()->inode->ino(),
cap->get_last_seq(),
@ -644,7 +644,7 @@ void Locker::issue_truncate(CInode *in)
it != in->client_caps.end();
it++) {
Capability *cap = it->second;
mds->send_message_client(new MClientFileCaps(CEPH_CAP_OP_TRUNC,
mds->send_message_client(new MClientCaps(CEPH_CAP_OP_TRUNC,
in->inode,
in->find_snaprealm()->inode->ino(),
cap->get_last_seq(),
@ -904,7 +904,7 @@ void Locker::share_inode_max_size(CInode *in)
Capability *cap = it->second;
if (cap->pending() & CEPH_CAP_WR) {
dout(10) << "share_inode_max_size with client" << client << dendl;
mds->send_message_client(new MClientFileCaps(CEPH_CAP_OP_GRANT,
mds->send_message_client(new MClientCaps(CEPH_CAP_OP_GRANT,
in->inode,
in->find_snaprealm()->inode->ino(),
cap->get_last_seq(),
@ -922,18 +922,18 @@ void Locker::share_inode_max_size(CInode *in)
* - we are calling back previously issued caps (fewer than the client previously had)
* - or if the client releases (any of) its caps on its own
*/
void Locker::handle_client_file_caps(MClientFileCaps *m)
void Locker::handle_client_caps(MClientCaps *m)
{
int client = m->get_source().num();
snapid_t follows = m->get_snap_follows();
dout(7) << "handle_client_file_caps on " << m->get_ino()
dout(7) << "handle_client_caps on " << m->get_ino()
<< " follows " << follows
<< " op " << ceph_cap_op_name(m->get_op()) << dendl;
CInode *head_in = mdcache->get_inode(m->get_ino());
if (!head_in) {
dout(7) << "handle_client_file_caps on unknown ino " << m->get_ino() << ", dropping" << dendl;
dout(7) << "handle_client_caps on unknown ino " << m->get_ino() << ", dropping" << dendl;
delete m;
return;
}
@ -950,7 +950,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
if (in)
cap = in->get_client_cap(client);
if (!cap) {
dout(7) << "handle_client_file_caps no cap for client" << client << " on " << *in << dendl;
dout(7) << "handle_client_caps no cap for client" << client << " on " << *in << dendl;
delete m;
return;
}
@ -958,12 +958,12 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
// freezing|frozen?
if (in->is_freezing() || in->is_frozen()) {
dout(7) << "handle_client_file_caps freezing|frozen on " << *in << dendl;
dout(7) << "handle_client_caps freezing|frozen on " << *in << dendl;
in->add_waiter(CInode::WAIT_UNFREEZE, new C_MDS_RetryMessage(mds, m));
return;
}
if (m->get_mseq() < cap->get_mseq()) {
dout(7) << "handle_client_file_caps mseq " << m->get_mseq() << " < " << cap->get_mseq()
dout(7) << "handle_client_caps mseq " << m->get_mseq() << " < " << cap->get_mseq()
<< ", dropping" << dendl;
delete m;
return;
@ -1038,7 +1038,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
}
void Locker::_do_cap_update(CInode *in, int had, int all_wanted, snapid_t follows, MClientFileCaps *m)
void Locker::_do_cap_update(CInode *in, int had, int all_wanted, snapid_t follows, MClientCaps *m)
{
dout(10) << "_do_cap_update had " << cap_string(had) << " on " << *in << dendl;

View File

@ -203,8 +203,8 @@ protected:
void remove_stale_leases(Session *session);
protected:
void handle_client_file_caps(class MClientFileCaps *m);
void _do_cap_update(CInode *in, int had, int wanted, snapid_t follows, MClientFileCaps *m);
void handle_client_caps(class MClientCaps *m);
void _do_cap_update(CInode *in, int had, int wanted, snapid_t follows, MClientCaps *m);
void request_inode_file_caps(CInode *in);

View File

@ -67,7 +67,7 @@
#include "messages/MDentryUnlink.h"
#include "messages/MClientRequest.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MClientSnap.h"
#include "messages/MMDSSlaveRequest.h"
@ -3610,7 +3610,7 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap)
SnapRealm *realm = in->find_snaprealm();
if (realm->have_past_parents_open()) {
dout(10) << "do_cap_import " << session->inst.name << " mseq " << cap->get_mseq() << " on " << *in << dendl;
MClientFileCaps *reap = new MClientFileCaps(CEPH_CAP_OP_IMPORT,
MClientCaps *reap = new MClientCaps(CEPH_CAP_OP_IMPORT,
in->inode,
realm->inode->ino(),
cap->get_last_seq(),

View File

@ -36,7 +36,7 @@
#include "msg/Messenger.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MExportDirDiscover.h"
#include "messages/MExportDirDiscoverAck.h"
@ -895,7 +895,7 @@ void Migrator::finish_export_inode_caps(CInode *in)
Capability *cap = it->second;
dout(7) << "finish_export_inode telling client" << it->first
<< " exported caps on " << *in << dendl;
MClientFileCaps *m = new MClientFileCaps(CEPH_CAP_OP_EXPORT,
MClientCaps *m = new MClientCaps(CEPH_CAP_OP_EXPORT,
in->inode,
in->find_snaprealm()->inode->ino(),
cap->get_last_seq(),

View File

@ -29,7 +29,7 @@
#include "messages/MClientRequest.h"
#include "messages/MClientReply.h"
#include "messages/MClientReconnect.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MClientSnap.h"
#include "messages/MMDSSlaveRequest.h"
@ -422,7 +422,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
inode_t fake_inode;
memset(&fake_inode, 0, sizeof(fake_inode));
fake_inode.ino = p->first;
MClientFileCaps *stale = new MClientFileCaps(CEPH_CAP_OP_EXPORT,
MClientCaps *stale = new MClientCaps(CEPH_CAP_OP_EXPORT,
fake_inode,
0,
0,

View File

@ -12,15 +12,15 @@
*
*/
#ifndef __MCLIENTFILECAPS_H
#define __MCLIENTFILECAPS_H
#ifndef __MCLIENTCAPS_H
#define __MCLIENTCAPS_H
#include "msg/Message.h"
class MClientFileCaps : public Message {
class MClientCaps : public Message {
private:
struct ceph_mds_file_caps h;
struct ceph_mds_caps h;
public:
bufferlist snapbl;
@ -56,15 +56,15 @@ class MClientFileCaps : public Message {
void set_mtime(const utime_t &t) { t.encode_timeval(&h.mtime); }
void set_atime(const utime_t &t) { t.encode_timeval(&h.atime); }
MClientFileCaps() {}
MClientFileCaps(int op,
inode_t& inode,
inodeno_t realm,
long seq,
int caps,
int wanted,
int mseq) :
Message(CEPH_MSG_CLIENT_FILECAPS) {
MClientCaps() {}
MClientCaps(int op,
inode_t& inode,
inodeno_t realm,
long seq,
int caps,
int wanted,
int mseq) :
Message(CEPH_MSG_CLIENT_CAPS) {
h.op = op;
h.ino = inode.ino;
h.seq = seq;
@ -81,7 +81,7 @@ class MClientFileCaps : public Message {
const char *get_type_name() { return "Cfcap";}
void print(ostream& out) {
out << "client_file_caps(" << ceph_cap_op_name(h.op)
out << "client_caps(" << ceph_cap_op_name(h.op)
<< " ino " << inodeno_t(h.ino)
<< " seq " << h.seq
<< " caps " << cap_string(h.caps)

View File

@ -619,7 +619,7 @@ bool OSDMonitor::prepare_remove_snaps(MRemoveSnaps *m)
}
if (max > osdmap.max_snap &&
(__s64)max > pending_inc.new_max_snap) {
max > pending_inc.new_max_snap) {
dout(10) << " new_max_snap " << max << dendl;
pending_inc.new_max_snap = max;
} else {

View File

@ -58,7 +58,7 @@ using namespace std;
#include "messages/MClientRequest.h"
#include "messages/MClientRequestForward.h"
#include "messages/MClientReply.h"
#include "messages/MClientFileCaps.h"
#include "messages/MClientCaps.h"
#include "messages/MClientLease.h"
#include "messages/MClientSnap.h"
@ -253,8 +253,8 @@ decode_message(ceph_msg_header& env, bufferlist& front, bufferlist& data)
case CEPH_MSG_CLIENT_REPLY:
m = new MClientReply;
break;
case CEPH_MSG_CLIENT_FILECAPS:
m = new MClientFileCaps;
case CEPH_MSG_CLIENT_CAPS:
m = new MClientCaps;
break;
case CEPH_MSG_CLIENT_LEASE:
m = new MClientLease;