2022-08-17 13:14:33
浏览数 (1)
lustre中inode的operations
- 不论是本地文件系统还是分布式文件系统,每个inode会有一些
operations
.针对上层的posix语义的实现。我们这里着重讨论文件的create
操作,create
涉及的file_operation
有ll_file_operations_flock
和ll_file_operations
.
代码语言:javascript
复制// lustre客户端的file_oepration的函数
const struct file_operations *ll_select_file_operations(struct ll_sb_info *sbi)
{
const struct file_operations *fops = &ll_file_operations_noflock;
if (sbi->ll_flags & LL_SBI_FLOCK)
fops = &ll_file_operations_flock;
else if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
fops = &ll_file_operations;
return fops;
}
int ll_read_inode2(struct inode *inode, void *opaque)
{
struct lustre_md *md = opaque;
struct ll_inode_info *lli = ll_i2info(inode);
inode->i_mapping->backing_dev_info = &s2lsi(inode->i_sb)->lsi_bdi;
if (S_ISREG(inode->i_mode)) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
inode->i_op = &ll_file_inode_operations;
inode->i_fop = sbi->ll_fop;
inode->i_mapping->a_ops = (struct address_space_operations *)&ll_aops;
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &ll_dir_inode_operations;
inode->i_fop = &ll_dir_operations;
} else if (S_ISLNK(inode->i_mode)) {
inode->i_op = &ll_fast_symlink_inode_operations;
} else {
inode->i_op = &ll_special_inode_operations;
}
return 0;
}
- linux内核中针对
creat
语义定义SYSCALL_DEFINE2(creat....)
,实际是调用的是内核的ksys_open
函数来执行。creat
函数最终还是