Overlay文件系统限制堆叠层数流程

Overlay文件系统是覆盖在基础文件系统上的一种堆栈式文件系统,所以也是一种wrapfs,Documentation有下面的介绍。An overlay-filesystem tries to present afilesystem which is the result over overlaying one filesystem on topof the other.堆栈式文件系统由于内存问题不能一直堆叠,本篇主要来介绍下Overlay的mount流程,旨在梳理如何限制堆栈式文件系统堆叠层数。
摘要由CSDN通过智能技术生成

Overlay文件系统是覆盖在基础文件系统上的一种堆栈式文件系统,所以也是一种wrapfs,Documentation有下面的介绍。

An overlay-filesystem tries to present a
filesystem which is the result over overlaying one filesystem on top
of the other.

堆栈式文件系统由于内存问题不能一直堆叠,本篇主要来介绍下Overlay的mount流程,旨在梳理如何限制堆栈式文件系统堆叠层数。下面的代码基于Kernel 5.10源码。直接从mount_nodev中注册的回调函数看起,前面的部分是常规的初始化流程。

static int ovl_fill_super(struct super_block *sb, void *data, int silent)
{
   
	struct path upperpath = {
    };
	struct dentry *root_dentry;
	struct ovl_entry *oe;
	struct ovl_fs *ofs;
	struct ovl_layer *layers;
	struct cred *cred;
	char *splitlower = NULL;
	unsigned int numlower;
	int err;

	err = -EIO;
	if (WARN_ON(sb->s_user_ns != current_user_ns()))
		goto out;

	sb->s_d_op = &ovl_dentry_operations;  //注册dentry操作函数

	err = -ENOMEM;
	ofs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL);
	if (!ofs)
		goto out;

	err = -ENOMEM;
	ofs->creator_cred = cred = prepare_creds();
	if (!cred)
		goto out_err;

	/* Is there a reason anyone would want not to share whiteouts? */
	ofs->share_whiteout = true;

	ofs->config.index = ovl_index_def;
	ofs->config.uuid = true;
	ofs->config.nfs_export = ovl_nfs_export_def;
	ofs->config.xino = ovl_xino_def();
	ofs->config.metacopy = ovl_metacopy_def;
	err = 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值