From b654a2a9fb36abd4453e067eeb3131684e53b6d7 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Thu, 29 Jan 2009 12:59:33 +0200 Subject: [PATCH] --- yaml --- r: 130863 b: refs/heads/master c: b466f17d780c5b72427f36aef22ecdec9f1d0689 h: refs/heads/master i: 130861: df6287051f9361817a13c358bd262dbda84c3d96 130859: 9a20f339bafb3c75bfaf4cc2efbed1bca08c5a76 130855: 638bb7be2f9e4cdc8bb7dd8d32308c31403c1a02 130847: 030652b54d0399c2d1094feff554fe064cf52408 v: v3 --- [refs] | 2 +- trunk/fs/ubifs/gc.c | 18 +++++------------- trunk/fs/ubifs/super.c | 14 +++++++------- trunk/fs/ubifs/ubifs.h | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index a2669f631892..bd3dac435e60 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 227c75c91dbfa037d109ab7ef45b7f5ba9cab6d0 +refs/heads/master: b466f17d780c5b72427f36aef22ecdec9f1d0689 diff --git a/trunk/fs/ubifs/gc.c b/trunk/fs/ubifs/gc.c index bad3339a800d..a711d33b3d3e 100644 --- a/trunk/fs/ubifs/gc.c +++ b/trunk/fs/ubifs/gc.c @@ -830,29 +830,21 @@ int ubifs_gc_end_commit(struct ubifs_info *c) * ubifs_destroy_idx_gc - destroy idx_gc list. * @c: UBIFS file-system description object * - * This function destroys the @c->idx_gc list. It is called when unmounting or - * remounting read-only so locks are not needed. Returns zero in case of - * success and a negative error code in case of failure. + * This function destroys the @c->idx_gc list. It is called when unmounting + * so locks are not needed. Returns zero in case of success and a negative + * error code in case of failure. */ -int ubifs_destroy_idx_gc(struct ubifs_info *c) +void ubifs_destroy_idx_gc(struct ubifs_info *c) { - int ret = 0; - while (!list_empty(&c->idx_gc)) { - int err; struct ubifs_gced_idx_leb *idx_gc; idx_gc = list_entry(c->idx_gc.next, struct ubifs_gced_idx_leb, list); - err = ubifs_change_one_lp(c, idx_gc->lnum, LPROPS_NC, - LPROPS_NC, 0, LPROPS_TAKEN, -1); - if (err && !ret) - ret = err; + c->idx_gc_cnt -= 1; list_del(&idx_gc->list); kfree(idx_gc); } - - return ret; } /** diff --git a/trunk/fs/ubifs/super.c b/trunk/fs/ubifs/super.c index 3ddd754262b4..daa679d3a03e 100644 --- a/trunk/fs/ubifs/super.c +++ b/trunk/fs/ubifs/super.c @@ -1687,10 +1687,6 @@ static void ubifs_remount_ro(struct ubifs_info *c) if (err) ubifs_ro_mode(c, err); - err = ubifs_destroy_idx_gc(c); - if (err) - ubifs_ro_mode(c, err); - free_wbufs(c); vfree(c->orph_buf); c->orph_buf = NULL; @@ -1793,15 +1789,19 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { if (c->ro_media) { - ubifs_msg("cannot re-mount R/W, UBIFS is working in " - "R/O mode"); + ubifs_msg("cannot re-mount due to prior errors"); return -EINVAL; } err = ubifs_remount_rw(c); if (err) return err; - } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) + } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { + if (c->ro_media) { + ubifs_msg("cannot re-mount due to prior errors"); + return -EINVAL; + } ubifs_remount_ro(c); + } if (c->bulk_read == 1) bu_init(c); diff --git a/trunk/fs/ubifs/ubifs.h b/trunk/fs/ubifs/ubifs.h index 29dfa816077b..535f87426791 100644 --- a/trunk/fs/ubifs/ubifs.h +++ b/trunk/fs/ubifs/ubifs.h @@ -1594,7 +1594,7 @@ int ubifs_replay_journal(struct ubifs_info *c); int ubifs_garbage_collect(struct ubifs_info *c, int anyway); int ubifs_gc_start_commit(struct ubifs_info *c); int ubifs_gc_end_commit(struct ubifs_info *c); -int ubifs_destroy_idx_gc(struct ubifs_info *c); +void ubifs_destroy_idx_gc(struct ubifs_info *c); int ubifs_get_idx_gc_leb(struct ubifs_info *c); int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp);