summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL51
-rw-r--r--kerncompat.h13
-rw-r--r--mkfs.c3
-rw-r--r--radix-tree.h2
4 files changed, 65 insertions, 4 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 00000000..e83ff6e8
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,51 @@
+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
+
diff --git a/kerncompat.h b/kerncompat.h
index abad58cc..86860127 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -71,8 +71,8 @@ struct page {
unsigned long index;
};
-static inline void preempt_enable(void) { do {; } while(0);}
-static inline void preempt_disable(void) { do {; } while(0);}
+#define preempt_enable() do { } while (0)
+#define preempt_disable() do { } while (0)
#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -114,9 +114,16 @@ static inline int test_bit(int nr, const volatile unsigned long *addr)
#define BUG_ON(c) do { if (c) abort(); } while (0)
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - __builtin_offsetof(type,member) );})
+ (type *)( (char *)__mptr - offsetof(type,member) );})
#define ENOMEM 5
#define EEXIST 6
diff --git a/mkfs.c b/mkfs.c
index cead575e..ac990495 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -28,8 +28,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <uuid/uuid.h>
-#include "kerncompat.h"
#include "radix-tree.h"
+#include <linux/fs.h>
+#include "kerncompat.h"
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
diff --git a/radix-tree.h b/radix-tree.h
index 076e5991..d99ea7eb 100644
--- a/radix-tree.h
+++ b/radix-tree.h
@@ -37,6 +37,8 @@
#ifndef _LINUX_RADIX_TREE_H
#define _LINUX_RADIX_TREE_H
+#include "kerncompat.h"
+
#define RADIX_TREE_MAX_TAGS 2
/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */