[CRIU] [PATCH 1/3] mount: Introduce BTRFS engine

Pavel Emelyanov xemul at parallels.com
Fri Nov 29 06:47:48 PST 2013


> @@ -1676,6 +1677,9 @@ int cr_dump_tasks(pid_t pid)
>  	if (cpu_init())
>  		goto err;
>  
> +	if (btrfs_init())
> +		goto err;
> +
>  	if (vdso_init())
>  		goto err;
>  

Move to collect_mount_info().

> @@ -1803,6 +1807,7 @@ err:
>  	free_pstree(root_item);
>  	free_file_locks();
>  	free_link_remaps();
> +	btrfs_fini();
>  
>  	close_service_fd(CR_PROC_FD_OFF);
>  

Not needed, as mount infos are not released either.

> +static LIST_HEAD(btrfs_mount_head);

This list is not needed. Put void *private link from mount-info
to brtfs_root struct and (later, much later) release them altogether.

> +struct btrfs_subvol_node {
> +	struct rb_node			rb_node;
> +	struct list_head		sibling;

List is used purely for releasing. Can be either removed or
reworked using rbtree.

> +
> +	struct btrfs_subvol_root	*subvol_root;
> +
> +	u64				root_id;
> +	u64				ref_tree;
> +	u64				dir_id;
> +
> +	struct rb_node			rb_dev;
> +	dev_t				st_dev;
> +	ino_t				st_ino;

st_ino it completely unused.

> +
> +	char				*name;
> +	char				*path;
> +	char				*full;
> +	int				deleted;

Plz, comment the fields.

> +};

> +int btrfs_parse_entry(struct mount_info *m)
> +{
> +	struct btrfs_ioctl_search_args tree_args;
> +	struct btrfs_ioctl_search_header sh;
> +	struct btrfs_ioctl_search_key *sk = &tree_args.key;
> +
> +	struct btrfs_subvol_root *r;
> +
> +	unsigned long off, i;
> +	int ret, fd = -1;
> +
> +	memzero(&tree_args, sizeof(tree_args));
> +
> +	sk->tree_id		= 1;
> +	sk->max_type		= BTRFS_ROOT_BACKREF_KEY;
> +	sk->min_type		= BTRFS_ROOT_ITEM_KEY;
> +	sk->min_objectid	= BTRFS_FIRST_FREE_OBJECTID;
> +	sk->max_objectid	= BTRFS_LAST_FREE_OBJECTID;
> +	sk->max_offset		= (u64)-1;
> +	sk->max_transid		= (u64)-1;
> +	sk->nr_items		= 4096;
> +
> +	fd = open(m->mountpoint, O_RDONLY);
> +	if (fd < 0) {
> +		pr_perror("Can't open mountpoint %s", m->mountpoint);
> +		return -1;
> +	}
> +

Mountpoint can be unreachable. The open_mountpoint() handles this.


More information about the CRIU mailing list