mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
*** empty log message ***
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@130 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
edbb52f06c
commit
7498ac942e
@ -51,7 +51,7 @@ class BasicLock {
|
||||
}
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream& out, BasicLock& l) {
|
||||
inline ostream& operator<<(ostream& out, BasicLock& l) {
|
||||
static char* __lock_states[] = {
|
||||
"sync",
|
||||
"prelock",
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "messages/MInodeUnlink.h"
|
||||
#include "messages/MInodeUnlinkAck.h"
|
||||
|
||||
#include "messages/MLock.h"
|
||||
|
||||
#include "messages/MInodeSyncStart.h"
|
||||
#include "messages/MInodeSyncAck.h"
|
||||
#include "messages/MInodeSyncRelease.h"
|
||||
@ -1736,9 +1738,7 @@ INODES:
|
||||
- truncate ... need to stop writers for the atomic truncate operation
|
||||
- need a full lock
|
||||
|
||||
|
||||
|
||||
|
||||
????
|
||||
|
||||
|
||||
ALSO:
|
||||
@ -1747,10 +1747,43 @@ ALSO:
|
||||
denlock - dentry lock (prior to unlink, rename)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
void MDCache::handle_lock(MLock *m)
|
||||
{
|
||||
// action type
|
||||
switch (m->get_otype()) {
|
||||
case LOCK_OTYPE_INO:
|
||||
CInode *in = get_inode(m->get_ino());
|
||||
|
||||
break;
|
||||
|
||||
case LOCK_OTYPE_DIRINO:
|
||||
CInode *in = get_inode(m->get_ino());
|
||||
CDir *dir = in->dir;
|
||||
break;
|
||||
|
||||
|
||||
case LOCK_OTYPE_DN:
|
||||
CInode *in = get_inode(m->get_ino());
|
||||
CDir *dir = in->dir;
|
||||
CDentry = dir->lookup(m->get_dn());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
OLD LOCK CRAP
|
||||
|
||||
|
||||
OLD CRAP:
|
||||
(old):
|
||||
sync - soft metadata.. no reads/writes can proceed. (eg no stat)
|
||||
lock - hard(+soft) metadata.. path traversals stop etc. (??)
|
||||
@ -1800,6 +1833,9 @@ NAMESPACE:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* soft sync locks: mtime, size, etc.
|
||||
*/
|
||||
|
||||
|
@ -42,6 +42,9 @@ class MInodeSyncRecall;
|
||||
class MInodeLockStart;
|
||||
class MInodeLockAck;
|
||||
class MInodeLockRelease;
|
||||
|
||||
class MLock;
|
||||
|
||||
class MDirSyncStart;
|
||||
class MDirSyncAck;
|
||||
class MDirSyncRelease;
|
||||
@ -313,6 +316,8 @@ class MDCache {
|
||||
void handle_inode_lock_ack(MInodeLockAck *m);
|
||||
void handle_inode_lock_release(MInodeLockRelease *m);
|
||||
|
||||
void handle_lock(MLock *m);
|
||||
|
||||
|
||||
// -- sync : dirs --
|
||||
void dir_sync_start(CDir *dir);
|
||||
|
109
ceph/messages/MLock.h
Normal file
109
ceph/messages/MLock.h
Normal file
@ -0,0 +1,109 @@
|
||||
#ifndef __MLOCK_H
|
||||
#define __MLOCK_H
|
||||
|
||||
#include "include/Message.h"
|
||||
|
||||
#define LOCK_OTYPE_INO 1
|
||||
#define LOCK_OTYPE_DIRINO 2
|
||||
#define LOCK_OTYPE_DN 3
|
||||
|
||||
// basic messages
|
||||
#define LOCK_AC_LOCK 1
|
||||
#define LOCK_AC_LOCKACK 2
|
||||
#define LOCK_AC_SYNC 3
|
||||
#define LOCK_AC_SYNCACK 4
|
||||
#define LOCK_AC_REQSYNC 5
|
||||
#define LOCK_AC_DELETE 6
|
||||
#define LOCK_AC_DELETEACK 7
|
||||
|
||||
// async messages
|
||||
#define LOCK_AC_ASYNC 8
|
||||
#define LOCK_AC_ASYNCACK 9
|
||||
#define LOCK_AC_REQASYNC 10
|
||||
|
||||
|
||||
class MLock : public Message {
|
||||
int asker; // who is initiating this request
|
||||
int action; // action type
|
||||
|
||||
char otype; // lock object type
|
||||
inodeno_t ino; // ino ref, or possibly
|
||||
string dn; // dentry name
|
||||
crope data; // and possibly some data
|
||||
|
||||
public:
|
||||
inodeno_t get_ino() { return ino; }
|
||||
string& get_dn() { return dn; }
|
||||
crope& get_data() { return data; }
|
||||
int get_asker() { return asker; }
|
||||
int get_action() { return action; }
|
||||
int get_otype() { return otype; }
|
||||
|
||||
MLock() {}
|
||||
MLock(int action, int asker) :
|
||||
Message(MSG_MDS_LOCK) {
|
||||
this->action = action;
|
||||
this->asker = asker;
|
||||
}
|
||||
virtual char *get_type_name() { return "ILock"; }
|
||||
|
||||
void set_ino(inodeno_t ino) {
|
||||
otype = LOCK_OTYPE_INO;
|
||||
this->ino = ino;
|
||||
}
|
||||
void set_dirino(inodeno_t dirino) {
|
||||
otype = LOCK_OTYPE_DIRINO;
|
||||
this->ino = ino;
|
||||
}
|
||||
void set_dn(inodeno_t dirino, string& dn) {
|
||||
otype = LOCK_OTYPE_DN;
|
||||
this->ino = dirino;
|
||||
this->dn = dn;
|
||||
}
|
||||
void set_data(crope& data) {
|
||||
this->data = data;
|
||||
}
|
||||
|
||||
virtual int decode_payload(crope s) {
|
||||
int off = 0;
|
||||
s.copy(off,sizeof(action), (char*)&action);
|
||||
off += sizeof(action);
|
||||
|
||||
s.copy(off,sizeof(asker), (char*)&asker);
|
||||
off += sizeof(asker);
|
||||
|
||||
s.copy(off,sizeof(otype), (char*)&otype);
|
||||
off += sizeof(otype);
|
||||
|
||||
s.copy(off,sizeof(inodeno_t), (char*)&ino);
|
||||
off += sizeof(ino);
|
||||
|
||||
dn = s.c_str() + off;
|
||||
off += dn.length() + 1;
|
||||
|
||||
int len;
|
||||
s.copy(off, sizeof(len), (char*)&len);
|
||||
off += sizeof(len);
|
||||
data = s.substr(off, len);
|
||||
off += len;
|
||||
}
|
||||
virtual crope get_payload() {
|
||||
crope s;
|
||||
s.append((char*)&action, sizeof(action));
|
||||
s.append((char*)&asker, sizeof(asker));
|
||||
|
||||
s.append((char*)&otype, sizeof(otype));
|
||||
|
||||
s.append((char*)&ino, sizeof(inodeno_t));
|
||||
|
||||
s.append((char*)dn.c_str(), dn.length()+1);
|
||||
|
||||
int len = data.length();
|
||||
s.append((char*)len, sizeof(len));
|
||||
s.append(data);
|
||||
return s;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -66,6 +66,8 @@
|
||||
|
||||
#define MSG_MDS_RENAMELOCALFILE 300
|
||||
|
||||
#define MSG_MDS_LOCK 500
|
||||
|
||||
#define MSG_MDS_SHUTDOWNSTART 900
|
||||
#define MSG_MDS_SHUTDOWNFINISH 901
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user