diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-06-12 11:36:58 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-06-12 11:36:58 -0400 |
commit | 340887809d92a4dd6c71caa97d658cef32c098c3 (patch) | |
tree | 4767f84fa4b066ac57c5df15741bda47766fe8ce | |
parent | 6cbd55707802b98843f953d1ae6d8f5bcd9a76c0 (diff) |
Btrfs: i386 fixes from axboe
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/INSTALL | 51 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/file.c | 7 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 1 |
5 files changed, 59 insertions, 5 deletions
diff --git a/fs/btrfs/INSTALL b/fs/btrfs/INSTALL new file mode 100644 index 000000000000..e83ff6e8c8d5 --- /dev/null +++ b/fs/btrfs/INSTALL | |||
@@ -0,0 +1,51 @@ | |||
1 | Install Instructions | ||
2 | |||
3 | Btrfs puts snapshots and subvolumes into the root directory of the FS. This | ||
4 | directory can only be changed by btrfsctl right now, and normal filesystem | ||
5 | operations do not work on it. The default subvolume is called 'default', | ||
6 | and you can create files and directories in mount_point/default | ||
7 | |||
8 | Btrfs uses the crypto manager interface in the kernel for file and | ||
9 | metadata checksums. You need to compile the kernel with: | ||
10 | |||
11 | CONFIG_CRYPTO=y | ||
12 | CONFIG_CRYPTO_MANAGER=m | ||
13 | CONFIG_CRYPTO_CRC32C=m | ||
14 | |||
15 | cryptomanager and crc32c can be static as well. Once your kernel is | ||
16 | setup, typing make in the btrfs module sources will build against the | ||
17 | running kernel. When the build is complete: | ||
18 | |||
19 | modprobe crc32c | ||
20 | modprobe cryptomgr | ||
21 | insmod btrfs.ko | ||
22 | |||
23 | The Btrfs utility programs require libuuid to build. This can be found | ||
24 | in the e2fsprogs sources, and is usually available as libuuid or | ||
25 | e2fsprogs-devel from various distros. | ||
26 | |||
27 | Building the utilities is just make ; make install. The programs go | ||
28 | into /usr/local/bin. The commands available are: | ||
29 | |||
30 | mkfs.btrfs: create a filesystem | ||
31 | |||
32 | btrfsctl: control program to create snapshots and subvolumes: | ||
33 | |||
34 | mount /dev/sda2 /mnt | ||
35 | btrfsctl -s new_subvol_name /mnt | ||
36 | btrfsctl -s snapshot_of_default /mnt/default | ||
37 | btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name | ||
38 | btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol | ||
39 | ls /mnt | ||
40 | default snapshot_of_a_snapshot snapshot_of_new_subvol | ||
41 | new_subvol_name snapshot_of_default | ||
42 | |||
43 | Snapshots and subvolumes cannot be deleted right now, but you can | ||
44 | rm -rf all the files and directories inside them. | ||
45 | |||
46 | btrfsck: do a limited check of the FS extent trees.</li> | ||
47 | |||
48 | debug-tree: print all of the FS metadata in text form. Example: | ||
49 | |||
50 | debug-tree /dev/sda2 >& big_output_file | ||
51 | |||
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8c68a64c0ceb..b0ebba6f2e46 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -106,7 +106,7 @@ struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root, | |||
106 | int err; | 106 | int err; |
107 | u64 first_block = index << (PAGE_CACHE_SHIFT - blockbits); | 107 | u64 first_block = index << (PAGE_CACHE_SHIFT - blockbits); |
108 | 108 | ||
109 | page = grab_cache_page(mapping, index); | 109 | page = find_or_create_page(mapping, index, GFP_NOFS); |
110 | if (!page) | 110 | if (!page) |
111 | return NULL; | 111 | return NULL; |
112 | 112 | ||
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 566e526b60ff..83836fb3d4e9 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -112,7 +112,7 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
112 | if (buffer_mapped(bh) && bh->b_blocknr == 0) { | 112 | if (buffer_mapped(bh) && bh->b_blocknr == 0) { |
113 | struct btrfs_key key; | 113 | struct btrfs_key key; |
114 | struct btrfs_path *path; | 114 | struct btrfs_path *path; |
115 | char *ptr; | 115 | char *ptr, *kaddr; |
116 | u32 datasize; | 116 | u32 datasize; |
117 | 117 | ||
118 | /* create an inline extent, and copy the data in */ | 118 | /* create an inline extent, and copy the data in */ |
@@ -135,8 +135,11 @@ static int dirty_and_release_pages(struct btrfs_trans_handle *trans, | |||
135 | btrfs_set_file_extent_type(ei, | 135 | btrfs_set_file_extent_type(ei, |
136 | BTRFS_FILE_EXTENT_INLINE); | 136 | BTRFS_FILE_EXTENT_INLINE); |
137 | ptr = btrfs_file_extent_inline_start(ei); | 137 | ptr = btrfs_file_extent_inline_start(ei); |
138 | kaddr = kmap_atomic(bh->b_page, KM_USER0); | ||
138 | btrfs_memcpy(root, path->nodes[0]->b_data, | 139 | btrfs_memcpy(root, path->nodes[0]->b_data, |
139 | ptr, bh->b_data, offset + write_bytes); | 140 | ptr, kaddr + bh_offset(bh), |
141 | offset + write_bytes); | ||
142 | kunmap_atomic(kaddr, KM_USER0); | ||
140 | mark_buffer_dirty(path->nodes[0]); | 143 | mark_buffer_dirty(path->nodes[0]); |
141 | btrfs_free_path(path); | 144 | btrfs_free_path(path); |
142 | } else if (buffer_mapped(bh)) { | 145 | } else if (buffer_mapped(bh)) { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 46f869d6d0fb..d3d5a4cdb6af 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1754,6 +1754,7 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen) | |||
1754 | BTRFS_I(dir)->block_group, S_IFDIR | 0700); | 1754 | BTRFS_I(dir)->block_group, S_IFDIR | 0700); |
1755 | inode->i_op = &btrfs_dir_inode_operations; | 1755 | inode->i_op = &btrfs_dir_inode_operations; |
1756 | inode->i_fop = &btrfs_dir_file_operations; | 1756 | inode->i_fop = &btrfs_dir_file_operations; |
1757 | new_root->inode = inode; | ||
1757 | 1758 | ||
1758 | ret = btrfs_make_empty_dir(trans, new_root, new_dirid, new_dirid); | 1759 | ret = btrfs_make_empty_dir(trans, new_root, new_dirid, new_dirid); |
1759 | BUG_ON(ret); | 1760 | BUG_ON(ret); |
@@ -1766,8 +1767,6 @@ static int create_subvol(struct btrfs_root *root, char *name, int namelen) | |||
1766 | ret = btrfs_commit_transaction(trans, new_root); | 1767 | ret = btrfs_commit_transaction(trans, new_root); |
1767 | BUG_ON(ret); | 1768 | BUG_ON(ret); |
1768 | 1769 | ||
1769 | iput(inode); | ||
1770 | |||
1771 | mutex_unlock(&root->fs_info->fs_mutex); | 1770 | mutex_unlock(&root->fs_info->fs_mutex); |
1772 | btrfs_btree_balance_dirty(root); | 1771 | btrfs_btree_balance_dirty(root); |
1773 | return 0; | 1772 | return 0; |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 30914521cf01..cd4f1d140385 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/sched.h> | ||
21 | #include "ctree.h" | 22 | #include "ctree.h" |
22 | #include "disk-io.h" | 23 | #include "disk-io.h" |
23 | #include "transaction.h" | 24 | #include "transaction.h" |