分布式存储-CEPH

CephFS MDS内部锁介绍

2018-12-18  本文已影响4人  lihanglucien

MDS锁类型

/*
 * metadata lock types.
 *  - these are bitmasks.. we can compose them
 *  - they also define the lock ordering by the MDS
 *  - a few of these are internal to the mds
 */
#define CEPH_LOCK_DVERSION    1
#define CEPH_LOCK_DN          2
#define CEPH_LOCK_IVERSION    16    /* mds internal */
#define CEPH_LOCK_ISNAP       32
#define CEPH_LOCK_IFILE       64
#define CEPH_LOCK_IAUTH       128
#define CEPH_LOCK_ILINK       256
#define CEPH_LOCK_IDFT        512   /* dir frag tree */
#define CEPH_LOCK_INEST       1024  /* mds internal */
#define CEPH_LOCK_IXATTR      2048
#define CEPH_LOCK_IFLOCK      4096  /* advisory file locks */
#define CEPH_LOCK_INO         8192  /* immutable inode bits; not a lock */
#define CEPH_LOCK_IPOLICY     16384 /* policy lock on dirs. MDS internal */
// -- lock types --
// see CEPH_LOCK_*

inline const char *get_lock_type_name(int t) {
  switch (t) {
  case CEPH_LOCK_DN: return "dn";
  case CEPH_LOCK_DVERSION: return "dversion";
  case CEPH_LOCK_IVERSION: return "iversion";
  case CEPH_LOCK_IFILE: return "ifile";
  case CEPH_LOCK_IAUTH: return "iauth";
  case CEPH_LOCK_ILINK: return "ilink";
  case CEPH_LOCK_IDFT: return "idft";
  case CEPH_LOCK_INEST: return "inest";
  case CEPH_LOCK_IXATTR: return "ixattr";
  case CEPH_LOCK_ISNAP: return "isnap";
  case CEPH_LOCK_INO: return "ino";
  case CEPH_LOCK_IFLOCK: return "iflock";
  case CEPH_LOCK_IPOLICY: return "ipolicy";
  default: ceph_abort(); return 0;
  }
}

  bool acquire_locks(MDRequestRef& mdr,
             set<SimpleLock*> &rdlocks,
             set<SimpleLock*> &wrlocks,
             set<SimpleLock*> &xlocks,
             map<SimpleLock*,mds_rank_t> *remote_wrlocks=NULL,
             CInode *auth_pin_freeze=NULL,
             bool auth_pin_nonblock=false);

todo

上一篇下一篇

猜你喜欢

热点阅读