Skip to content

feat(fs): 补充mount系统调用,增加对硬盘挂载 & ext4文件系统的支持 #1182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 55 commits into
base: master
Choose a base branch
from

Conversation

sparkzky
Copy link
Collaborator

No description provided.

Samuka007 and others added 22 commits May 10, 2025 09:17
Signed-off-by: sparkzky <[email protected]>
@github-actions github-actions bot added the enhancement New feature or request label May 28, 2025
@sparkzky sparkzky changed the title feat(fs): 补充mount调用,增加对ext4类型文件系统的支持 feat(fs): 补充mount系统调用,增加对ext4类型文件系统的支持 May 28, 2025
@sparkzky sparkzky added the A-fs Area: 文件系统 label May 28, 2025
@sparkzky sparkzky requested a review from fslongjin May 28, 2025 01:41
Copy link
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

然后,这个ext4的实现有无更具体的测试方法&用例的说明?麻烦补充该文件系统相关信息&对mount机制的修改到文档里面。

我还很好奇一个问题,这个ext4在dragonos里面读写&创建多个目录等等暴力测试之后,回到linux里面fsck会不会报错?

Comment on lines 302 to 322
pub fn new_ref(&self, inode: u32) -> Result<Arc<Self>, SystemError> {
if self
.concret_fs()
.getattr(inode)
.map_err(SystemError::from)?
.ftype
!= another_ext4::FileType::Directory
{
Ok(Arc::new_cyclic(|me| Ext4Inode {
inode,
fs_ptr: self.fs_ptr.clone(),
page_cache: Some(PageCache::new(Some(me.clone() as Weak<dyn IndexNode>))),
}))
} else {
Ok(Arc::new(Ext4Inode {
inode,
fs_ptr: self.fs_ptr.clone(),
page_cache: None,
}))
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目录也可以有page cache鸭

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if !inode.0.lock().inode_type.is_dir() {
let page_cache = PageCache::new(Some(Arc::downgrade(&inode) as Weak<dyn IndexNode>));
inode.0.lock().page_cache = Some(page_cache);
}

page cache其实没有测试,只是初步按照 fat 里的写法实现了一个

@sparkzky sparkzky requested a review from fslongjin June 8, 2025 14:47
@fslongjin fslongjin changed the title feat(fs): 补充mount系统调用,增加对硬盘挂载的支持 feat(fs): 补充mount系统调用,增加对硬盘挂载 & ext4文件系统的支持 Jun 10, 2025
Copy link
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
测试程序test-mount挂载ramfs失败。

@fslongjin
Copy link
Member

需要补充文档。

@sparkzky sparkzky requested a review from fslongjin June 10, 2025 14:10
Copy link
Member

@fslongjin fslongjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.dragonos.org.cn/kernel/filesystem/vfs/index.html

MountableFS不是一种文件系统类型,这个我理解是与内核的挂载机制比较关联的。因此请把文档写到vfs下面。

并且,文档需要添加一些关于相关设计的整体的描述(可以结合ascii 图或者mermaid图),不要像个api文档一样,贴一堆代码。
如果是代码相关的内容,直接写代码注释就好了。文档是为了给开发者进行原理性质的讲解。(虽然现在有很多写的不好的文档,全都是代码在那,后面得改)

a GOOD Example: https://docs.dragonos.org.cn/kernel/ipc/signal.html

@fslongjin
Copy link
Member

另一个问题就是,没有任何教程教我如何挂载ext4的文件系统到dragonos里面。至少我现在看了脚本也还不怎么清楚相关操作是怎么做的。

@sparkzky sparkzky requested a review from fslongjin June 12, 2025 10:08
sparkzky added 2 commits June 12, 2025 18:10
Signed-off-by: sparkzky <[email protected]>
Signed-off-by: sparkzky <[email protected]>
Signed-off-by: sparkzky <[email protected]>
@sparkzky sparkzky requested a review from fslongjin June 12, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-fs Area: 文件系统 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: 将把磁盘、分区注册到devfs
4 participants