summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segbuf.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 19:01:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:31:20 -0700
commitcece552074c591970353ad48308d65f110aeaf28 (patch)
tree2dcca7913d38df89711504f5daeecccfedb5a3eb /fs/nilfs2/segbuf.c
parentc96fa464a567a2a8796009af0e79bc68af73f485 (diff)
downloadop-kernel-dev-cece552074c591970353ad48308d65f110aeaf28.zip
op-kernel-dev-cece552074c591970353ad48308d65f110aeaf28.tar.gz
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>
Diffstat (limited to 'fs/nilfs2/segbuf.c')
-rw-r--r--fs/nilfs2/segbuf.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index 3d3ea83..1e68821 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -64,27 +64,17 @@ struct nilfs_segment_buffer *nilfs_segbuf_new(struct super_block *sb)
INIT_LIST_HEAD(&segbuf->sb_list);
INIT_LIST_HEAD(&segbuf->sb_segsum_buffers);
INIT_LIST_HEAD(&segbuf->sb_payload_buffers);
- segbuf->sb_segent = NULL;
return segbuf;
}
void nilfs_segbuf_free(struct nilfs_segment_buffer *segbuf)
{
- struct nilfs_segment_entry *ent = segbuf->sb_segent;
-
- if (ent != NULL && list_empty(&ent->list)) {
- /* free isolated segment list head */
- nilfs_free_segment_entry(segbuf->sb_segent);
- segbuf->sb_segent = NULL;
- }
kmem_cache_free(nilfs_segbuf_cachep, segbuf);
}
-int nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum,
+void nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum,
unsigned long offset, struct the_nilfs *nilfs)
{
- struct nilfs_segment_entry *ent;
-
segbuf->sb_segnum = segnum;
nilfs_get_segment_range(nilfs, segnum, &segbuf->sb_fseg_start,
&segbuf->sb_fseg_end);
@@ -92,18 +82,6 @@ int nilfs_segbuf_map(struct nilfs_segment_buffer *segbuf, __u64 segnum,
segbuf->sb_pseg_start = segbuf->sb_fseg_start + offset;
segbuf->sb_rest_blocks =
segbuf->sb_fseg_end - segbuf->sb_pseg_start + 1;
-
- /* Attach a segment list head */
- ent = segbuf->sb_segent;
- if (ent == NULL) {
- segbuf->sb_segent = nilfs_alloc_segment_entry(segnum);
- if (unlikely(!segbuf->sb_segent))
- return -ENOMEM;
- } else {
- BUG_ON(ent->bh_su || !list_empty(&ent->list));
- ent->segnum = segnum;
- }
- return 0;
}
void nilfs_segbuf_set_next_segnum(struct nilfs_segment_buffer *segbuf,
OpenPOWER on IntegriCloud