aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-06-28 04:49:30 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-22 21:02:10 -0400
commitc8a11c8a1455c380286cfd3d3442e2b60edee49a (patch)
tree351227134573d3a95855fe8a4b352c8baf20efb9 /fs
parent7ecaa46cfea453238a369b3019739d50ff5d7c37 (diff)
nilfs2: add nilfs_set_error
This function marks error state and write it on super blocks. This is a preparation for making super block writeback alternately. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/super.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index f23a31b04e14..4a85dfb70b8e 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -74,6 +74,19 @@ struct kmem_cache *nilfs_btree_path_cache;
74 74
75static int nilfs_remount(struct super_block *sb, int *flags, char *data); 75static int nilfs_remount(struct super_block *sb, int *flags, char *data);
76 76
77static void nilfs_set_error(struct nilfs_sb_info *sbi)
78{
79 struct the_nilfs *nilfs = sbi->s_nilfs;
80
81 down_write(&nilfs->ns_sem);
82 if (!(nilfs->ns_mount_state & NILFS_ERROR_FS)) {
83 nilfs->ns_mount_state |= NILFS_ERROR_FS;
84 nilfs->ns_sbp[0]->s_state |= cpu_to_le16(NILFS_ERROR_FS);
85 nilfs_commit_super(sbi, 1);
86 }
87 up_write(&nilfs->ns_sem);
88}
89
77/** 90/**
78 * nilfs_error() - report failure condition on a filesystem 91 * nilfs_error() - report failure condition on a filesystem
79 * 92 *
@@ -99,16 +112,7 @@ void nilfs_error(struct super_block *sb, const char *function,
99 va_end(args); 112 va_end(args);
100 113
101 if (!(sb->s_flags & MS_RDONLY)) { 114 if (!(sb->s_flags & MS_RDONLY)) {
102 struct the_nilfs *nilfs = sbi->s_nilfs; 115 nilfs_set_error(sbi);
103
104 down_write(&nilfs->ns_sem);
105 if (!(nilfs->ns_mount_state & NILFS_ERROR_FS)) {
106 nilfs->ns_mount_state |= NILFS_ERROR_FS;
107 nilfs->ns_sbp[0]->s_state |=
108 cpu_to_le16(NILFS_ERROR_FS);
109 nilfs_commit_super(sbi, 1);
110 }
111 up_write(&nilfs->ns_sem);
112 116
113 if (nilfs_test_opt(sbi, ERRORS_RO)) { 117 if (nilfs_test_opt(sbi, ERRORS_RO)) {
114 printk(KERN_CRIT "Remounting filesystem read-only\n"); 118 printk(KERN_CRIT "Remounting filesystem read-only\n");