aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/ocfs2.txt11
-rw-r--r--fs/ocfs2/journal.c8
-rw-r--r--fs/ocfs2/ocfs2.h1
-rw-r--r--fs/ocfs2/super.c23
4 files changed, 41 insertions, 2 deletions
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt
index e78abdcc59e..b63bd2d7fcd 100644
--- a/Documentation/filesystems/ocfs2.txt
+++ b/Documentation/filesystems/ocfs2.txt
@@ -61,3 +61,14 @@ data=writeback Data ordering is not preserved, data may be written
61preferred_slot=0(*) During mount, try to use this filesystem slot first. If 61preferred_slot=0(*) During mount, try to use this filesystem slot first. If
62 it is in use by another node, the first empty one found 62 it is in use by another node, the first empty one found
63 will be chosen. Invalid values will be ignored. 63 will be chosen. Invalid values will be ignored.
64commit=nrsec (*) Ocfs2 can be told to sync all its data and metadata
65 every 'nrsec' seconds. The default value is 5 seconds.
66 This means that if you lose your power, you will lose
67 as much as the latest 5 seconds of work (your
68 filesystem will not be damaged though, thanks to the
69 journaling). This default value (or any low value)
70 will hurt performance, but it's good for data-safety.
71 Setting it to 0 will have the same effect as leaving
72 it at the default (5 seconds).
73 Setting it to very large values will improve
74 performance.
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 4f440a88bf5..8b9ce2a729a 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -313,14 +313,18 @@ int ocfs2_journal_dirty_data(handle_t *handle,
313 return err; 313 return err;
314} 314}
315 315
316#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * 5) 316#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD_DEFAULT_MAX_COMMIT_AGE)
317 317
318void ocfs2_set_journal_params(struct ocfs2_super *osb) 318void ocfs2_set_journal_params(struct ocfs2_super *osb)
319{ 319{
320 journal_t *journal = osb->journal->j_journal; 320 journal_t *journal = osb->journal->j_journal;
321 unsigned long commit_interval = OCFS2_DEFAULT_COMMIT_INTERVAL;
322
323 if (osb->osb_commit_interval)
324 commit_interval = osb->osb_commit_interval;
321 325
322 spin_lock(&journal->j_state_lock); 326 spin_lock(&journal->j_state_lock);
323 journal->j_commit_interval = OCFS2_DEFAULT_COMMIT_INTERVAL; 327 journal->j_commit_interval = commit_interval;
324 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER) 328 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER)
325 journal->j_flags |= JFS_BARRIER; 329 journal->j_flags |= JFS_BARRIER;
326 else 330 else
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index f8f866144c6..82802f5672a 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -229,6 +229,7 @@ struct ocfs2_super
229 wait_queue_head_t checkpoint_event; 229 wait_queue_head_t checkpoint_event;
230 atomic_t needs_checkpoint; 230 atomic_t needs_checkpoint;
231 struct ocfs2_journal *journal; 231 struct ocfs2_journal *journal;
232 unsigned long osb_commit_interval;
232 233
233 enum ocfs2_local_alloc_state local_alloc_state; 234 enum ocfs2_local_alloc_state local_alloc_state;
234 struct buffer_head *local_alloc_bh; 235 struct buffer_head *local_alloc_bh;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 479ac50c86d..8044ed97d36 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -83,6 +83,7 @@ MODULE_LICENSE("GPL");
83 83
84struct mount_options 84struct mount_options
85{ 85{
86 unsigned long commit_interval;
86 unsigned long mount_opt; 87 unsigned long mount_opt;
87 unsigned int atime_quantum; 88 unsigned int atime_quantum;
88 signed short slot; 89 signed short slot;
@@ -149,6 +150,7 @@ enum {
149 Opt_data_writeback, 150 Opt_data_writeback,
150 Opt_atime_quantum, 151 Opt_atime_quantum,
151 Opt_slot, 152 Opt_slot,
153 Opt_commit,
152 Opt_err, 154 Opt_err,
153}; 155};
154 156
@@ -164,6 +166,7 @@ static match_table_t tokens = {
164 {Opt_data_writeback, "data=writeback"}, 166 {Opt_data_writeback, "data=writeback"},
165 {Opt_atime_quantum, "atime_quantum=%u"}, 167 {Opt_atime_quantum, "atime_quantum=%u"},
166 {Opt_slot, "preferred_slot=%u"}, 168 {Opt_slot, "preferred_slot=%u"},
169 {Opt_commit, "commit=%u"},
167 {Opt_err, NULL} 170 {Opt_err, NULL}
168}; 171};
169 172
@@ -442,6 +445,8 @@ unlock_osb:
442 osb->s_mount_opt = parsed_options.mount_opt; 445 osb->s_mount_opt = parsed_options.mount_opt;
443 osb->s_atime_quantum = parsed_options.atime_quantum; 446 osb->s_atime_quantum = parsed_options.atime_quantum;
444 osb->preferred_slot = parsed_options.slot; 447 osb->preferred_slot = parsed_options.slot;
448 if (parsed_options.commit_interval)
449 osb->osb_commit_interval = parsed_options.commit_interval;
445 450
446 if (!ocfs2_is_hard_readonly(osb)) 451 if (!ocfs2_is_hard_readonly(osb))
447 ocfs2_set_journal_params(osb); 452 ocfs2_set_journal_params(osb);
@@ -596,6 +601,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
596 osb->s_mount_opt = parsed_options.mount_opt; 601 osb->s_mount_opt = parsed_options.mount_opt;
597 osb->s_atime_quantum = parsed_options.atime_quantum; 602 osb->s_atime_quantum = parsed_options.atime_quantum;
598 osb->preferred_slot = parsed_options.slot; 603 osb->preferred_slot = parsed_options.slot;
604 osb->osb_commit_interval = parsed_options.commit_interval;
599 605
600 sb->s_magic = OCFS2_SUPER_MAGIC; 606 sb->s_magic = OCFS2_SUPER_MAGIC;
601 607
@@ -746,6 +752,7 @@ static int ocfs2_parse_options(struct super_block *sb,
746 mlog_entry("remount: %d, options: \"%s\"\n", is_remount, 752 mlog_entry("remount: %d, options: \"%s\"\n", is_remount,
747 options ? options : "(none)"); 753 options ? options : "(none)");
748 754
755 mopt->commit_interval = 0;
749 mopt->mount_opt = 0; 756 mopt->mount_opt = 0;
750 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; 757 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
751 mopt->slot = OCFS2_INVALID_SLOT; 758 mopt->slot = OCFS2_INVALID_SLOT;
@@ -815,6 +822,18 @@ static int ocfs2_parse_options(struct super_block *sb,
815 if (option) 822 if (option)
816 mopt->slot = (s16)option; 823 mopt->slot = (s16)option;
817 break; 824 break;
825 case Opt_commit:
826 option = 0;
827 if (match_int(&args[0], &option)) {
828 status = 0;
829 goto bail;
830 }
831 if (option < 0)
832 return 0;
833 if (option == 0)
834 option = JBD_DEFAULT_MAX_COMMIT_AGE;
835 mopt->commit_interval = HZ * option;
836 break;
818 default: 837 default:
819 mlog(ML_ERROR, 838 mlog(ML_ERROR,
820 "Unrecognized mount option \"%s\" " 839 "Unrecognized mount option \"%s\" "
@@ -863,6 +882,10 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
863 if (osb->s_atime_quantum != OCFS2_DEFAULT_ATIME_QUANTUM) 882 if (osb->s_atime_quantum != OCFS2_DEFAULT_ATIME_QUANTUM)
864 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum); 883 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum);
865 884
885 if (osb->osb_commit_interval)
886 seq_printf(s, ",commit=%u",
887 (unsigned) (osb->osb_commit_interval / HZ));
888
866 return 0; 889 return 0;
867} 890}
868 891