針對文件的inode的操做體如今數據結構struct inode_operations中,具體內容以下:node
const struct inode_operations ceph_file_iops = {數組
.permission = ceph_permission,緩存
.setattr = ceph_setattr,數據結構
.getattr = ceph_getattr,函數
.setxattr = generic_setxattr,ui
.getxattr = generic_getxattr,進程
.listxattr = ceph_listxattr,內存
.removexattr = generic_removexattr,rem
.get_acl = ceph_get_acl,get
.set_acl = ceph_set_acl,
};
ceph_permission(struct inode *inode, int mask) 檢查inode是否有mask指定的訪問權限
|__調用ceph_do_getattr()函數從本地緩存或mds集羣中獲得CEPH_CAP_AUTH_SHARED對應的權限
|__調用generic_permission()函數作常規的權限檢查
ceph_setattr(struct dentry *dentry, struct iattr *attr) 設置文件屬性時調用該函數
|__調用__ceph_setattr()函數
|__調用ceph_mdsc_create_request()函數建立mds集羣請求
|__根據設置具體屬性的內容如:ATTR_UID/ATTR_GID/ATTR_MODE/ATTR_ATIME/ATTR_MTIME/ATTR_SIZE/ATTR_CTIME設置請求數據結構中的具體項
|__調用ceph_mdsc_do_reqeust()函數將請求同步發送給mds進程
ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 獲取文件屬性時調用該函數
|__調用ceph_do_getattr(CEPH_STAT_CAP_INODE_ALL)函數從mds集羣中讀取inode的全部屬性值
|__調用generic_fillattr()函數設置通用的屬性值到stat中
|__將cephfs相關的屬性值設置到stat中
ceph_listxattr(struct dentry *dentry, char *names, size_t size) 列出inode的xattrs時該函數被調用
|__若xattrs的version爲0
|__調用ceph_do_getattr(CEPH_STAT_CAP_XATTR)函數從mds集羣中讀取xattr信息
|__調用__build_xattrs()函數建立xattr屬性
|__調用__copy_xattr_names()函數將xattr屬性的全部名字信息複製到names數組中
ceph_get_acl(struct inode *inode, int type) 讀取inode的acl信息時調用該函數
|__調用__ceph_getxattr()函數從mds集羣中讀取XATTR_NAME_POSIX_ACL_ACCESS或XATTR_NAME_POSIX_ACL_DEFUALT的屬性值
|__調用posix_acl_from_xattr()函數將acl信息讀取到內存中的struct posix_acl數據結構中
|__調用ceph_set_cache_acl()函數將內存中的struct posix_acl數據結構寫入到cache中
ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) 設置inode的acl信息時調用該函數
|__調用posix_acl_xattr_size()函數獲得xattr的大小
|__調用posix_acl_to_xattr()函數將acl轉換成xattr格式
|__調用__ceph_setxattr()函數將acl轉換的xattr數據寫入到mds集羣
|__調用ceph_set_cached_acl()函數將新的acl信息寫入到cache中