summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segment.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 19:01:54 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:31:19 -0700
commit2c2e52fc4fca251e68f90821c9ff5cb18be4df58 (patch)
treefb0b86203bb5f4dda4d5907e29bd2b1b6cc0be90 /fs/nilfs2/segment.c
parent7a9461939a46345860622ea36ff267ee4446f00f (diff)
downloadblackbird-op-linux-2c2e52fc4fca251e68f90821c9ff5cb18be4df58.tar.gz
blackbird-op-linux-2c2e52fc4fca251e68f90821c9ff5cb18be4df58.zip
nilfs2: extend nilfs_sustat ioctl struct
This adds a new argument to the nilfs_sustat structure. The extended field allows to delete volatile active state of segments, which was needed to protect freshly-created segments from garbage collection but has confused code dealing with segments. This extension alleviates the mess and gives room for further simplifications. The volatile active flag is not persistent, so it's eliminable on this occasion without affecting compatibility other than the ioctl change. 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>
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r--fs/nilfs2/segment.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 5db12d774a03..24d0fbd4271c 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2229,13 +2229,6 @@ static void nilfs_segctor_reactivate_segments(struct nilfs_sc_info *sci,
nilfs_segment_usage_set_active(ent->raw_su);
nilfs_close_segment_entry(ent, sufile);
}
-
- down_write(&nilfs->ns_sem);
- head = &nilfs->ns_used_segments;
- list_for_each_entry(ent, head, list) {
- nilfs_segment_usage_set_volatile_active(ent->raw_su);
- }
- up_write(&nilfs->ns_sem);
}
static int nilfs_segctor_deactivate_segments(struct nilfs_sc_info *sci,
@@ -2244,7 +2237,6 @@ static int nilfs_segctor_deactivate_segments(struct nilfs_sc_info *sci,
struct nilfs_segment_buffer *segbuf, *last;
struct nilfs_segment_entry *ent;
struct inode *sufile = nilfs->ns_sufile;
- struct list_head *head;
int err;
last = NILFS_LAST_SEGBUF(&sci->sc_segbufs);
@@ -2265,22 +2257,13 @@ static int nilfs_segctor_deactivate_segments(struct nilfs_sc_info *sci,
BUG_ON(!buffer_dirty(ent->bh_su));
}
- head = &sci->sc_active_segments;
- list_for_each_entry(ent, head, list) {
+ list_for_each_entry(ent, &sci->sc_active_segments, list) {
err = nilfs_open_segment_entry(ent, sufile);
if (unlikely(err))
goto failed;
nilfs_segment_usage_clear_active(ent->raw_su);
BUG_ON(!buffer_dirty(ent->bh_su));
}
-
- down_write(&nilfs->ns_sem);
- head = &nilfs->ns_used_segments;
- list_for_each_entry(ent, head, list) {
- /* clear volatile active for segments of older generations */
- nilfs_segment_usage_clear_volatile_active(ent->raw_su);
- }
- up_write(&nilfs->ns_sem);
return 0;
failed:
@@ -2304,19 +2287,15 @@ static void nilfs_segctor_bead_completed_segments(struct nilfs_sc_info *sci)
}
}
-static void
-__nilfs_segctor_commit_deactivate_segments(struct nilfs_sc_info *sci,
- struct the_nilfs *nilfs)
-
+static void nilfs_segctor_commit_deactivate_segments(struct nilfs_sc_info *sci,
+ struct the_nilfs *nilfs)
{
- struct nilfs_segment_entry *ent;
-
- list_splice_init(&sci->sc_active_segments,
- nilfs->ns_used_segments.prev);
+ struct nilfs_segment_entry *ent, *n;
- list_for_each_entry(ent, &nilfs->ns_used_segments, list) {
- nilfs_segment_usage_set_volatile_active(ent->raw_su);
- /* These segments are kept open */
+ list_for_each_entry_safe(ent, n, &sci->sc_active_segments, list) {
+ list_del(&ent->list);
+ nilfs_close_segment_entry(ent, nilfs->ns_sufile);
+ nilfs_free_segment_entry(ent);
}
}
@@ -2405,8 +2384,8 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
if (has_sr) {
down_write(&nilfs->ns_sem);
nilfs_update_last_segment(sbi, 1);
- __nilfs_segctor_commit_deactivate_segments(sci, nilfs);
up_write(&nilfs->ns_sem);
+ nilfs_segctor_commit_deactivate_segments(sci, nilfs);
nilfs_segctor_commit_free_segments(sci);
nilfs_segctor_clear_metadata_dirty(sci);
}
OpenPOWER on IntegriCloud