diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-04-06 22:01:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:20 -0400 |
commit | cece552074c591970353ad48308d65f110aeaf28 (patch) | |
tree | 2dcca7913d38df89711504f5daeecccfedb5a3eb /fs/nilfs2/sufile.c | |
parent | c96fa464a567a2a8796009af0e79bc68af73f485 (diff) |
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/sufile.c')
-rw-r--r-- | fs/nilfs2/sufile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index 4cf47e03a3ab..c774cf397e2f 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c | |||
@@ -158,7 +158,6 @@ int nilfs_sufile_alloc(struct inode *sufile, __u64 *segnump) | |||
158 | if (!nilfs_segment_usage_clean(su)) | 158 | if (!nilfs_segment_usage_clean(su)) |
159 | continue; | 159 | continue; |
160 | /* found a clean segment */ | 160 | /* found a clean segment */ |
161 | nilfs_segment_usage_set_active(su); | ||
162 | nilfs_segment_usage_set_dirty(su); | 161 | nilfs_segment_usage_set_dirty(su); |
163 | kunmap_atomic(kaddr, KM_USER0); | 162 | kunmap_atomic(kaddr, KM_USER0); |
164 | 163 | ||
@@ -591,6 +590,7 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, | |||
591 | struct buffer_head *su_bh; | 590 | struct buffer_head *su_bh; |
592 | struct nilfs_segment_usage *su; | 591 | struct nilfs_segment_usage *su; |
593 | size_t susz = NILFS_MDT(sufile)->mi_entry_size; | 592 | size_t susz = NILFS_MDT(sufile)->mi_entry_size; |
593 | struct the_nilfs *nilfs = NILFS_MDT(sufile)->mi_nilfs; | ||
594 | void *kaddr; | 594 | void *kaddr; |
595 | unsigned long nsegs, segusages_per_block; | 595 | unsigned long nsegs, segusages_per_block; |
596 | ssize_t n; | 596 | ssize_t n; |
@@ -623,7 +623,11 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, | |||
623 | for (j = 0; j < n; j++, su = (void *)su + susz) { | 623 | for (j = 0; j < n; j++, su = (void *)su + susz) { |
624 | si[i + j].sui_lastmod = le64_to_cpu(su->su_lastmod); | 624 | si[i + j].sui_lastmod = le64_to_cpu(su->su_lastmod); |
625 | si[i + j].sui_nblocks = le32_to_cpu(su->su_nblocks); | 625 | si[i + j].sui_nblocks = le32_to_cpu(su->su_nblocks); |
626 | si[i + j].sui_flags = le32_to_cpu(su->su_flags); | 626 | si[i + j].sui_flags = le32_to_cpu(su->su_flags) & |
627 | ~(1UL << NILFS_SEGMENT_USAGE_ACTIVE); | ||
628 | if (nilfs_segment_is_active(nilfs, segnum + i + j)) | ||
629 | si[i + j].sui_flags |= | ||
630 | (1UL << NILFS_SEGMENT_USAGE_ACTIVE); | ||
627 | } | 631 | } |
628 | kunmap_atomic(kaddr, KM_USER0); | 632 | kunmap_atomic(kaddr, KM_USER0); |
629 | brelse(su_bh); | 633 | brelse(su_bh); |