--- /dev/null
+Install Instructions
+
+Btrfs puts snapshots and subvolumes into the root directory of the FS. This
+directory can only be changed by btrfsctl right now, and normal filesystem
+operations do not work on it. The default subvolume is called 'default',
+and you can create files and directories in mount_point/default
+
+Btrfs uses the crypto manager interface in the kernel for file and
+metadata checksums. You need to compile the kernel with:
+
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_CRC32C=m
+
+cryptomanager and crc32c can be static as well. Once your kernel is
+setup, typing make in the btrfs module sources will build against the
+running kernel. When the build is complete:
+
+modprobe crc32c
+modprobe cryptomgr
+insmod btrfs.ko
+
+The Btrfs utility programs require libuuid to build. This can be found
+in the e2fsprogs sources, and is usually available as libuuid or
+e2fsprogs-devel from various distros.
+
+Building the utilities is just make ; make install. The programs go
+into /usr/local/bin. The commands available are:
+
+mkfs.btrfs: create a filesystem
+
+btrfsctl: control program to create snapshots and subvolumes:
+
+ mount /dev/sda2 /mnt
+ btrfsctl -s new_subvol_name /mnt
+ btrfsctl -s snapshot_of_default /mnt/default
+ btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name
+ btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol
+ ls /mnt
+ default snapshot_of_a_snapshot snapshot_of_new_subvol
+ new_subvol_name snapshot_of_default
+
+ Snapshots and subvolumes cannot be deleted right now, but you can
+ rm -rf all the files and directories inside them.
+
+btrfsck: do a limited check of the FS extent trees.</li>
+
+debug-tree: print all of the FS metadata in text form. Example:
+
+ debug-tree /dev/sda2 >& big_output_file
+
if (buffer_mapped(bh) && bh->b_blocknr == 0) {
struct btrfs_key key;
struct btrfs_path *path;
- char *ptr;
+ char *ptr, *kaddr;
u32 datasize;
/* create an inline extent, and copy the data in */
btrfs_set_file_extent_type(ei,
BTRFS_FILE_EXTENT_INLINE);
ptr = btrfs_file_extent_inline_start(ei);
+ kaddr = kmap_atomic(bh->b_page, KM_USER0);
btrfs_memcpy(root, path->nodes[0]->b_data,
- ptr, bh->b_data, offset + write_bytes);
+ ptr, kaddr + bh_offset(bh),
+ offset + write_bytes);
+ kunmap_atomic(kaddr, KM_USER0);
mark_buffer_dirty(path->nodes[0]);
btrfs_free_path(path);
} else if (buffer_mapped(bh)) {
BTRFS_I(dir)->block_group, S_IFDIR | 0700);
inode->i_op = &btrfs_dir_inode_operations;
inode->i_fop = &btrfs_dir_file_operations;
+ new_root->inode = inode;
ret = btrfs_make_empty_dir(trans, new_root, new_dirid, new_dirid);
BUG_ON(ret);
ret = btrfs_commit_transaction(trans, new_root);
BUG_ON(ret);
- iput(inode);
-
mutex_unlock(&root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(root);
return 0;