Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5739bba authored by Chris Mason's avatar Chris Mason Committed by David Woodhouse
Browse files

Btrfs: snapshot progress

parent 0f7d52f4
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ struct btrfs_csum_item {
} __attribute__ ((__packed__));

struct btrfs_inode_map_item {
	struct btrfs_disk_key key;
	u32 refs;
} __attribute__ ((__packed__));

struct crypto_hash;
@@ -883,6 +883,17 @@ static inline void btrfs_set_file_extent_num_blocks(struct
	e->num_blocks = cpu_to_le64(val);
}

static inline u32 btrfs_inode_map_refs(struct btrfs_inode_map_item *m)
{
	return le32_to_cpu(m->refs);
}

static inline void btrfs_set_inode_map_refs(struct btrfs_inode_map_item *m,
					    u32 val)
{
	m->refs = cpu_to_le32(val);
}

static inline struct btrfs_root *btrfs_sb(struct super_block *sb)
{
	return sb->s_fs_info;
@@ -925,6 +936,8 @@ static inline void btrfs_mark_buffer_dirty(struct buffer_head *bh)
	btrfs_item_offset((leaf)->items + (slot))))

/* extent-item.c */
int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
		       struct btrfs_root *root);
struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
					    struct btrfs_root *root);
int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
+4 −2
Original line number Diff line number Diff line
@@ -55,12 +55,14 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
	btrfs_set_dir_flags(dir_item, 0);
	btrfs_set_dir_name_len(dir_item, name_len);
	name_ptr = (char *)(dir_item + 1);

	btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
	btrfs_mark_buffer_dirty(path->nodes[0]);

	/* FIXME, use some real flag for selecting the extra index */
	if (root == root->fs_info->tree_root)
		goto out;

	btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
	btrfs_mark_buffer_dirty(path->nodes[0]);
	btrfs_release_path(root, path);

	btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
+0 −4
Original line number Diff line number Diff line
@@ -16,10 +16,6 @@ static int check_tree_block(struct btrfs_root *root, struct buffer_head *buf)
	if (buf->b_blocknr != btrfs_header_blocknr(&node->header)) {
		BUG();
	}
	if (root->node && btrfs_header_parentid(&node->header) !=
	    btrfs_header_parentid(btrfs_buffer_header(root->node))) {
		BUG();
	}
	return 0;
}

+6 −0
Original line number Diff line number Diff line
@@ -77,6 +77,12 @@ static int lookup_block_ref(struct btrfs_trans_handle *trans, struct btrfs_root
	return 0;
}

int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
		       struct btrfs_root *root)
{
	return inc_block_ref(trans, root, root->node->b_blocknr, 1);
}

int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
		  struct buffer_head *buf)
{

fs/btrfs/ioctl.h

0 → 100644
+13 −0
Original line number Diff line number Diff line
#ifndef __IOCTL_
#define __IOCTL_
#include <linux/ioctl.h>

#define BTRFS_IOCTL_MAGIC 0x94
#define BTRFS_VOL_NAME_MAX 255
struct btrfs_ioctl_vol_args {
	char name[BTRFS_VOL_NAME_MAX + 1];
};

#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
				   struct btrfs_ioctl_vol_args)
#endif
Loading