Prechádzať zdrojové kódy

nilfs2: add barrier mount option

Nilfs enables write barriers by default and has "nobarrier" mount
option to disable this feature.  But it lacks the complementary option
and has no way to re-enable the feature on remount.

This adds "barrier" option to resolve this imbalance.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Ryusuke Konishi 15 rokov pred
rodič
commit
773bc4f3b6
2 zmenil súbory, kde vykonal 9 pridanie a 2 odobranie
  1. 4 1
      Documentation/filesystems/nilfs2.txt
  2. 5 1
      fs/nilfs2/super.c

+ 4 - 1
Documentation/filesystems/nilfs2.txt

@@ -49,7 +49,10 @@ Mount options
 NILFS2 supports the following mount options:
 NILFS2 supports the following mount options:
 (*) == default
 (*) == default
 
 
-nobarrier		Disables barriers.
+barrier(*)		This enables/disables the use of write barriers.  This
+nobarrier		requires an IO stack which can support barriers, and
+			if nilfs gets an error on a barrier write, it will
+			disable again with a warning.
 errors=continue		Keep going on a filesystem error.
 errors=continue		Keep going on a filesystem error.
 errors=remount-ro(*)	Remount the filesystem read-only on an error.
 errors=remount-ro(*)	Remount the filesystem read-only on an error.
 errors=panic		Panic and halt the machine if an error occurs.
 errors=panic		Panic and halt the machine if an error occurs.

+ 5 - 1
fs/nilfs2/super.c

@@ -603,7 +603,7 @@ static const struct export_operations nilfs_export_ops = {
 
 
 enum {
 enum {
 	Opt_err_cont, Opt_err_panic, Opt_err_ro,
 	Opt_err_cont, Opt_err_panic, Opt_err_ro,
-	Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery,
+	Opt_barrier, Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery,
 	Opt_discard, Opt_err,
 	Opt_discard, Opt_err,
 };
 };
 
 
@@ -611,6 +611,7 @@ static match_table_t tokens = {
 	{Opt_err_cont, "errors=continue"},
 	{Opt_err_cont, "errors=continue"},
 	{Opt_err_panic, "errors=panic"},
 	{Opt_err_panic, "errors=panic"},
 	{Opt_err_ro, "errors=remount-ro"},
 	{Opt_err_ro, "errors=remount-ro"},
+	{Opt_barrier, "barrier"},
 	{Opt_nobarrier, "nobarrier"},
 	{Opt_nobarrier, "nobarrier"},
 	{Opt_snapshot, "cp=%u"},
 	{Opt_snapshot, "cp=%u"},
 	{Opt_order, "order=%s"},
 	{Opt_order, "order=%s"},
@@ -636,6 +637,9 @@ static int parse_options(char *options, struct super_block *sb)
 
 
 		token = match_token(p, tokens, args);
 		token = match_token(p, tokens, args);
 		switch (token) {
 		switch (token) {
+		case Opt_barrier:
+			nilfs_set_opt(sbi, BARRIER);
+			break;
 		case Opt_nobarrier:
 		case Opt_nobarrier:
 			nilfs_clear_opt(sbi, BARRIER);
 			nilfs_clear_opt(sbi, BARRIER);
 			break;
 			break;