nilfs2: simplify handling of active state of segments

will reduce some lines of segment constructor.  Previously, the state was
complexly controlled through a list of segments in order to keep
consistency in meta data of usage state of segments.  Instead, this
presents ``calculated'' active flags to userland cleaner program and stop
maintaining its real flag on disk.

Only by this fake flag, the cleaner cannot exactly know if each segment is
reclaimable or not.  However, the recent extension of nilfs_sustat ioctl
struct (nilfs2-extend-nilfs_sustat-ioctl-struct.patch) can prevent the
cleaner from reclaiming in-use segment wrongly.

So, now I can apply this for simplification.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Ryusuke Konishi
2009-04-06 19:01:58 -07:00
committato da Linus Torvalds
parent c96fa464a5
commit cece552074
8 ha cambiato i file con 29 aggiunte e 208 eliminazioni

Vedi File

@@ -463,16 +463,6 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
nilfs_free_segment_entry(ent);
}
/*
* The segment having the latest super root is active, and
* should be deactivated on the next construction for recovery.
*/
err = -ENOMEM;
ent = nilfs_alloc_segment_entry(segnum[0]);
if (unlikely(!ent))
goto failed;
list_add_tail(&ent->list, &ri->ri_used_segments);
/* Allocate new segments for recovery */
err = nilfs_sufile_alloc(sufile, &segnum[0]);
if (unlikely(err))
@@ -757,7 +747,7 @@ int nilfs_recover_logical_segments(struct the_nilfs *nilfs,
goto failed;
}
err = nilfs_attach_segment_constructor(sbi, ri);
err = nilfs_attach_segment_constructor(sbi);
if (unlikely(err))
goto failed;