aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-04-02 16:49:40 -0400
committerChris Mason <chris.mason@oracle.com>2009-04-02 16:49:40 -0400
commit3a5e14048a0a81276d284cbda441507a17e26147 (patch)
tree42464c2455216b008bf27c13496d001bb85d3564
parenta9572a15a854bd40453a6b7b4dd9d29132f64c64 (diff)
Btrfs: notreelog mount option
Add a 'notreelog' mount option to disable the tree log (used by fsync, O_SYNC writes). This is much slower, but the tree logging produces inconsistent views into the FS for ceph. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/ctree.h1
-rw-r--r--fs/btrfs/super.c10
-rw-r--r--fs/btrfs/tree-log.c5
3 files changed, 15 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b82931f97ef3..1e99a9948637 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1036,6 +1036,7 @@ struct btrfs_root {
1036#define BTRFS_MOUNT_SSD (1 << 3) 1036#define BTRFS_MOUNT_SSD (1 << 3)
1037#define BTRFS_MOUNT_DEGRADED (1 << 4) 1037#define BTRFS_MOUNT_DEGRADED (1 << 4)
1038#define BTRFS_MOUNT_COMPRESS (1 << 5) 1038#define BTRFS_MOUNT_COMPRESS (1 << 5)
1039#define BTRFS_MOUNT_NOTREELOG (1 << 6)
1039 1040
1040#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1041#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
1041#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) 1042#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 2ceb40b794a8..3baa2c109e55 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -67,7 +67,8 @@ static void btrfs_put_super(struct super_block *sb)
67enum { 67enum {
68 Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, 68 Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow,
69 Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, 69 Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
70 Opt_ssd, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_err, 70 Opt_ssd, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_notreelog,
71 Opt_err,
71}; 72};
72 73
73static match_table_t tokens = { 74static match_table_t tokens = {
@@ -84,6 +85,7 @@ static match_table_t tokens = {
84 {Opt_compress, "compress"}, 85 {Opt_compress, "compress"},
85 {Opt_ssd, "ssd"}, 86 {Opt_ssd, "ssd"},
86 {Opt_noacl, "noacl"}, 87 {Opt_noacl, "noacl"},
88 {Opt_notreelog, "notreelog"},
87 {Opt_err, NULL}, 89 {Opt_err, NULL},
88}; 90};
89 91
@@ -223,6 +225,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
223 case Opt_noacl: 225 case Opt_noacl:
224 root->fs_info->sb->s_flags &= ~MS_POSIXACL; 226 root->fs_info->sb->s_flags &= ~MS_POSIXACL;
225 break; 227 break;
228 case Opt_notreelog:
229 printk(KERN_INFO "btrfs: disabling tree log\n");
230 btrfs_set_opt(info->mount_opt, NOTREELOG);
231 break;
226 default: 232 default:
227 break; 233 break;
228 } 234 }
@@ -412,6 +418,8 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
412 seq_puts(seq, ",compress"); 418 seq_puts(seq, ",compress");
413 if (btrfs_test_opt(root, SSD)) 419 if (btrfs_test_opt(root, SSD))
414 seq_puts(seq, ",ssd"); 420 seq_puts(seq, ",ssd");
421 if (btrfs_test_opt(root, NOTREELOG))
422 seq_puts(seq, ",notreelog");
415 if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) 423 if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
416 seq_puts(seq, ",noacl"); 424 seq_puts(seq, ",noacl");
417 return 0; 425 return 0;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2871609641f5..c047eea4093f 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2898,6 +2898,11 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
2898 2898
2899 sb = inode->i_sb; 2899 sb = inode->i_sb;
2900 2900
2901 if (btrfs_test_opt(root, NOTREELOG)) {
2902 ret = 1;
2903 goto end_no_trans;
2904 }
2905
2901 if (root->fs_info->last_trans_log_full_commit > 2906 if (root->fs_info->last_trans_log_full_commit >
2902 root->fs_info->last_trans_committed) { 2907 root->fs_info->last_trans_committed) {
2903 ret = 1; 2908 ret = 1;