diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-09-17 16:44:28 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-09-17 17:08:09 +0300 |
commit | 2680d722bf2c5f75225dd9acb3ec9e5a9e2652f4 (patch) | |
tree | af016ede5f300a33ddd3ad66a8c3c0e6bf05774e /fs/ubifs/ubifs.h | |
parent | 8c893a5545ca772744376295690723dcb0b47d96 (diff) | |
download | linux-2680d722bf2c5f75225dd9acb3ec9e5a9e2652f4.tar.gz linux-2680d722bf2c5f75225dd9acb3ec9e5a9e2652f4.tar.bz2 linux-2680d722bf2c5f75225dd9acb3ec9e5a9e2652f4.zip |
UBIFS: introduce new flag for RO due to errors
The R/O state may have various reasons:
1. The UBI volume is R/O
2. The FS is mounted R/O
3. The FS switched to R/O mode because of an error
However, in UBIFS we have only one variable which represents cases
1 and 3 - 'c->ro_media'. Indeed, we set this to 1 if we switch to
R/O mode due to an error, and then we test it in many places to
make sure that we stop writing as soon as the error happens.
But this is very unclean. One consequence of this, for example, is
that in 'ubifs_remount_fs()' we use 'c->ro_media' to check whether
we are in R/O mode because on an error, and we print a message
in this case. However, if we are in R/O mode because the media
is R/O, our message is bogus.
This patch introduces new flag - 'c->ro_error' which is set when
we switch to R/O mode because of an error. It also changes all
"if (c->ro_media)" checks to "if (c->ro_error)" checks, because
this is what the checks actually mean. We do not need to check
for 'c->ro_media' because if the UBI volume is in R/O mode, we
do not allow R/W mounting, and now writes can happen. This is
guaranteed by VFS. But it is good to double-check this, so this
patch also adds many "ubifs_assert(!c->ro_media)" checks.
In the 'ubifs_remount_fs()' function this patch makes a bit more
changes - it fixes the error messages as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/ubifs.h')
-rw-r--r-- | fs/ubifs/ubifs.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index c4dc9b18f73e..f47ebb442d1c 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -1032,6 +1032,7 @@ struct ubifs_debug_info; * @max_leb_cnt: maximum count of logical eraseblocks * @old_leb_cnt: count of logical eraseblocks before re-size * @ro_media: the underlying UBI volume is read-only + * @ro_error: UBIFS switched to R/O mode because an error happened * * @dirty_pg_cnt: number of dirty pages (not used) * @dirty_zn_cnt: number of dirty znodes @@ -1272,7 +1273,8 @@ struct ubifs_info { int leb_cnt; int max_leb_cnt; int old_leb_cnt; - int ro_media; + unsigned int ro_media:1; + unsigned int ro_error:1; atomic_long_t dirty_pg_cnt; atomic_long_t dirty_zn_cnt; |