/*
Copyright 2005-2010 Jakub Kruszona-Zawadzki, Gemius SA.
This file is part of MooseFS.
MooseFS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
MooseFS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MooseFS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <sys/stat.h>
#include <inttypes.h>
#include <errno.h>
#include "MFSCommunication.h"
// #define CACHENOTIFY 1
#ifndef METARESTORE
#include "matoclserv.h"
#include "matocsserv.h"
#endif
#include "chunks.h"
#include "filesystem.h"
#include "datapack.h"
#include "slogger.h"
#include "massert.h"
#ifndef METARESTORE
#include "datacachemgr.h"
#include "cfg.h"
#include "main.h"
#include "changelog.h"
#endif
#define USE_FREENODE_BUCKETS 1
#define USE_CUIDREC_BUCKETS 1
#define EDGEHASH 1
#define NODEHASHBITS (22)
#define NODEHASHSIZE (1<<NODEHASHBITS)
#define NODEHASHPOS(nodeid) ((nodeid)&(NODEHASHSIZE-1))
#ifdef EDGEHASH
#define EDGEHASHBITS (22)
#define EDGEHASHSIZE (1<<EDGEHASHBITS)
#define EDGEHASHPOS(hash) ((hash)&(EDGEHASHSIZE-1))
#define LOOKUPNOHASHLIMIT 10
#endif
#define XATTR_INODE_HASH_SIZE 65536
#define XATTR_DATA_HASH_SIZE 524288
/*
#ifdef CACHENOTIFY
#define ATTR_CACHE_DISABLE_DELTA 10
#define ATTR_CACHE_ENABLE_DELTA 120
#endif
*/
//#define GOAL(x) ((x)&0xF)
//#define DELETE(x) (((x)>>4)&1)
//#define SETGOAL(x,y) ((x)=((x)&0xF0)|((y)&0xF))
//#define SETDELETE(x,y) ((x)=((x)&0xF)|((y)&0x10))
#define DEFAULT_GOAL 1
#define DEFAULT_TRASHTIME 86400
#define MAXFNAMELENG 255
#define MAX_INDEX 0x7FFFFFFF
#define CHIDS_NO 0
#define CHIDS_YES 1
#define CHIDS_AUTO 2
#ifndef METARESTORE
typedef struct _bstnode {
uint32_t val,count;
struct _bstnode *left,*right;
} bstnode;
#endif
typedef struct _sessionidrec {
uint32_t sessionid;
struct _sessionidrec *next;
} sessionidrec;
struct _fsnode;
typedef struct _fsedge {
struct _fsnode *child,*parent;
struct _fsedge *nextchild,*nextparent;
struct _fsedge **prevchild,**prevparent;
#ifdef EDGEHASH
struct _fsedge *next,**prev;
#endif
uint16_t nleng;
// uint16_t nhash;
uint8_t *name;
} fsedge;
#ifndef METARESTORE
typedef struct _statsrecord {
uint32_t inodes;
uint32_t dirs;
uint32_t files;
uint32_t chunks;
uint64_t length;
uint64_t size;
uint64_t realsize;
} statsrecord;
#endif
typedef struct _quotanode {
uint8_t exceeded; // hard quota exceeded or soft quota reached time limit
uint8_t flags;
uint32_t stimestamp; // time when soft quota exceeded
uint32_t sinodes,hinodes;
uint64_t slength,hlength;
uint64_t ssize,hsize;
uint64_t srealsize,hrealsize;
struct _fsnode *node;
struct _quotanode *next,**prev;
} quotanode;
static quotanode *quotahead;
typedef struct _xattr_data_entry {
uint32_t inode;
uint8_t anleng;
uint32_t avleng;
uint8_t *attrname;
uint8_t *attrvalue;
struct _xattr_data_entry **previnode,*nextinode;
struct _xattr_data_entry **prev,*next;
} xattr_data_entry;
typedef struct _xattr_inode_entry {
uint32_t inode;
uint32_t anleng;
uint32_t avleng;
struct _xattr_data_entry *data_head;
struct _xattr_inode_entry *next;
} xattr_inode_entry;
static xattr_inode_entry **xattr_inode_hash;
static xattr_data_entry **xattr_data_hash;
#ifndef METARESTORE
static uint32_t QuotaTimeLimit;
#endif
typedef struct _fsnode {
uint32_t id;
uint32_t ctime,mtime,atime;
uint8_t type;
uint8_t goal;
uint16_t mode; // only 12 lowest bits are used for mode, in unix standard upper 4 are used for object type, but since there is field "type" this bits can be used as extra flags
uint32_t uid;
uint32_t gid;
uint32_t trashtime;
union _data {
struct _ddata { // type==TYPE_DIRECTORY
fsedge *children;
uint32_t nlink;
uint32_t elements;
// uint8_t quotaexceeded:1; // quota exceeded
#ifndef METARESTORE
statsrecord *stats;
#endif
quotanode *quota;
} ddata;
struct _sdata { // type==TYPE_SYMLINK
uint32_t pleng;
uint8_t *path;
/*
#ifdef CACHENOTIFY
uint32_t lastattrchange; // even - store attr in cache / odd - do not store attr in cache
#endif
*/
} sdata;
struct _devdata {
uint32_t rdev; // type==TYPE_BLOCKDEV ; type==TYPE_CHARDEV
/*
#ifdef CACHENOTIFY
uint32_t lastattrchange; // even - store attr in cache / odd - do not store attr in cache
#endif
*/
} devdata;
struct _fdata { // type==TYPE_FILE ; type==TYPE_TRASH ; type==TYPE_RESERVED
uint64_t length;
uint64_t *chunktab;
uint32_t chunks;
/*
#ifdef CACHENOTIFY
uint32_t lastattrchange; // even - store attr in cache / odd - do not store attr in cache
#endif
*/
sessionidrec *sessionids;
} fdata;
/*
#ifdef CACHENOTIFY
struct _odata {
uint32_t lastattrchange; // even - store attr in cache / odd - do not store attr in cache
} odata;
#endif
*/
} data;
fsedge *parents;
struct _fsnode *next;
} fsnode;
typedef struct _freenode {
uint32_t id;
uint32_t ftime;
struct _freenode *next;
} freenode;
static uint32_t *freebitmask;
static uint32_t bitmasksize;
static uint32_t searchpos;
static freenode *freelist,**freetail;
static fsedge *trash;
static fsedge *reserved;
static fsnode *root;
static fsnode* nodehash[NODEHASHSIZE];
#ifdef EDGEHASH
static fsedge* edgehash[EDGEHASHSIZE];
#endif
static uint32_t maxnodeid;
static uint32_t nextsessionid;
static uint32_t nodes;
static uint64_t metaversion;
static uint64_t trashspace;
static uint64_t reservedspace;
static uint32_t trashnodes;
static uint32_t reservednodes;
static uint32_t filenodes;
static uint32_t dirnodes;
#ifndef METARESTORE
static uint32_t BackMetaCopies;
#define MSGBUFFSIZE 1000000
#define ERRORS_LOG_MAX 500
static uint32_t fsinfo_files=0;
static uint32_t fsinfo_ugfiles=0;
static uint32_t fsinfo_mfiles=0;
static uint32_t fsinfo_chunks=0;
static uint32_t fsinfo_ugchunks=0;
static uint32_t fsinfo_mchunks=0;
static char *fsinfo_msgbuff=NULL;
static uint32_t fsinfo_msgbuffleng=0;
static uint32_t fsinfo_loopstart=0;
static uint32_t fsinfo_loopend=0;
static uint32_t test_start_time;
static uint32_t stats_statfs=0;
static uint32_t stats_getattr=0;
static uint32_t stats_setattr=0;
static uint32_t stats_lookup=0;
static uint32_t stats_mkdir=0;
static uint32_t stats_rmdir=0;
static uint32_t stats_symlink=0;
static uint32_t stats_readlink=0;
static uint32_t stats_mknod=0;
static uint32_t stats_unlink=0;
static uint32_t stats_rename=0;
static uint32_t stats_link=0;
static uint32_t stats_readdir=0;
static uint32_t stats_open=0;
static uint32_t stats_read=0;
static uint32_t stats_write=0;
void fs_stats(uint32_t stats[16]) {
stats[0] = stats_statfs;
stats[1] = stats_getattr;
stats[2] = stats_setattr;
stats[3] = stats_lookup;
stats[4] = stats_mkdir;
stats[5] = stats_rmdir;
stats[6] = stats_symlink;
stats[7] = stats_readlink;
stats[8] = stats_mknod;
stats[9] = stats_unlink;
stats[10] = stats_rename;
stats[11] = stats_link;
stats[12] = stats_readdir;
stats[13] = stats_open;
stats[14] = stats_read;
stats[15] = stats_write;
stats_statfs=0;
stats_getattr=0;
stats_setattr=0;
stats_lookup=0;
stats_mkdir=0;
stats_rmdir=0;
stats_symlink=0;
stats_readlink=0;
stats_mknod=0;
stats_unlink=0;
stats_rename=0;
stats_link=0;
stats_readdir=0;
stats_open=0;
stats_read=0;
stats_write=0;
}
#endif
#ifdef USE_FREENODE_BUCKETS
#define FREENODE_BUCKET_SIZE 5000
typedef struct _freenode_bucket {
freenode bucket[FREENODE_BUCKET_SIZE];
uint32_t firstfree;
struct _freenode_bucket *next;
} freenode_bucket;
static freenode_bucket *fnbhead = NULL;
static freenod
没有合适的资源?快使用搜索试试~ 我知道了~
mfs-1.6.27-1.gz
需积分: 10 38 下载量 49 浏览量
2013-08-08
09:54:05
上传
评论
收藏 754KB GZ 举报
温馨提示
共223个文件
h:51个
c:46个
1:18个
mfs-1.6.27-1.gz moosefs+corosync_分布式存储+高可用
资源推荐
资源详情
资源评论
收起资源包目录
mfs-1.6.27-1.gz (223个子文件)
mfstools.1 9KB
mfsfileinfo.1 20B
mfsfilerepair.1 20B
mfsrgettrashtime.1 20B
mfsrsettrashtime.1 20B
mfsmakesnapshot.1 20B
mfssetgoal.1 20B
mfsrsetgoal.1 20B
mfsrgetgoal.1 20B
mfsseteattr.1 20B
mfsdirinfo.1 20B
mfsdeleattr.1 20B
mfsgetgoal.1 20B
mfscheckfile.1 20B
mfsgeteattr.1 20B
mfssettrashtime.1 20B
mfsappendchunks.1 20B
mfsgettrashtime.1 20B
mfsmaster.cfg.5 4KB
mfsexports.cfg.5 4KB
mfschunkserver.cfg.5 3KB
mfsmetalogger.cfg.5 2KB
mfstopology.cfg.5 2KB
mfshdd.cfg.5 1KB
moosefs.7 4KB
mfs.7 19B
mfsmount.8 5KB
mfschunkserver.8 4KB
mfsmaster.8 3KB
mfsmetalogger.8 3KB
mfsmetarestore.8 2KB
mfscgiserv.8 1KB
configure.ac 10KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 954B
Makefile.am 946B
Makefile.am 925B
Makefile.am 515B
Makefile.am 507B
Makefile.am 468B
Makefile.am 467B
Makefile.am 165B
filesystem.c 217KB
hddspacemgr.c 123KB
matoclserv.c 114KB
mfs_fuse.c 92KB
mfstools.c 75KB
chunks.c 70KB
mastercomm.c 67KB
matocsserv.c 54KB
csserv.c 52KB
charts.c 49KB
masterconn.c 34KB
writedata.c 29KB
main.c 29KB
main.c 27KB
mfs_meta_fuse.c 25KB
masterconn.c 25KB
exports.c 23KB
restore.c 22KB
matomlserv.c 20KB
replicator.c 20KB
mfsmetadump.c 14KB
bgjobs.c 13KB
readdata.c 13KB
strerr.c 12KB
sockets.c 11KB
main.c 10KB
topology.c 10KB
chartsdata.c 10KB
datacachemgr.c 8KB
chartsdata.c 8KB
cscomm.c 7KB
md5.c 7KB
dirattrcache.c 7KB
crc.c 6KB
itree.c 6KB
chunkloccache.c 6KB
pcqueue.c 6KB
oplog.c 5KB
cfg.c 5KB
symlinkcache.c 5KB
stats.c 5KB
masterproxy.c 4KB
csdb.c 4KB
merger.c 3KB
random.c 3KB
changelog.c 2KB
mfsexports.cfg 4KB
mfstopology.cfg 1KB
mfsmount.cfg 404B
mfshdd.cfg 57B
mfs.cgi 105KB
chart.cgi 2KB
changelog 16KB
compat 2B
mfs-master.conffiles 84B
mfs-chunkserver.conffiles 56B
mfs-metalogger.conffiles 31B
共 223 条
- 1
- 2
- 3
资源评论
sdfsdgFSDF
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 什么是后端开发-关于后端开发的一些小介绍分享
- Jurassic Pack Vol. II Dinosaurs 侏罗纪包卷恐龙二号Unity游戏模型资源unitypackage
- Jurassic Pack Vol. III Dinosaurs 侏罗纪包卷恐龙三号Unity游戏模型资源unitypackag
- Ultimate Seating Controller 终极座椅控制器Unity游戏开发插件资源unitypackage
- 什么是人工智能-关于人工智能的相关介绍说明
- Figma Converter for Unity适用Unity的Figma转换器Unity游戏开发插件unitypackage
- Creepy Animatronic Anims 令人毛骨悚然的电子动画Unity游戏动画插件资源unitypackage
- Rankings & Leaderboards 排名和排行榜Unity游戏开发插件资源unitypackage
- Semantic Color Palette 语义调色板Unity游戏开发插件资源unitypackage
- Low Poly Nature:Lush and Diverse Environments低聚自然郁郁Unity低多边形模型资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功