Skip to content

Commit a88998f

Browse files
Qu Wenruomasoncl
authored andcommitted
btrfs: Add treelog mount option.
Add treelog mount option to enable tree log with remount option. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
1 parent d399167 commit a88998f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Documentation/filesystems/btrfs.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ Options with (*) are default options and will not show in the mount options.
164164
Enable/disable data checksumming for newly created files.
165165
Datasum implies datacow.
166166

167+
treelog(*)
167168
notreelog
168-
Disable the tree logging used for fsync and O_SYNC writes.
169+
Enable/disable the tree logging used for fsync and O_SYNC writes.
169170

170171
recovery
171172
Enable autorecovery attempts if a bad tree root is found at mount time.

fs/btrfs/super.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ enum {
325325
Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree,
326326
Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard,
327327
Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow,
328-
Opt_datasum,
328+
Opt_datasum, Opt_treelog,
329329
Opt_err,
330330
};
331331

@@ -353,6 +353,7 @@ static match_table_t tokens = {
353353
{Opt_acl, "acl"},
354354
{Opt_noacl, "noacl"},
355355
{Opt_notreelog, "notreelog"},
356+
{Opt_treelog, "treelog"},
356357
{Opt_flushoncommit, "flushoncommit"},
357358
{Opt_noflushoncommit, "noflushoncommit"},
358359
{Opt_ratio, "metadata_ratio=%d"},
@@ -579,6 +580,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
579580
btrfs_info(root->fs_info, "disabling tree log");
580581
btrfs_set_opt(info->mount_opt, NOTREELOG);
581582
break;
583+
case Opt_treelog:
584+
if (btrfs_test_opt(root, NOTREELOG))
585+
btrfs_info(root->fs_info, "enabling tree log");
586+
btrfs_clear_opt(info->mount_opt, NOTREELOG);
587+
break;
582588
case Opt_flushoncommit:
583589
btrfs_info(root->fs_info, "turning on flush-on-commit");
584590
btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT);

0 commit comments

Comments
 (0)