diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-04-05 05:30:58 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-04-12 20:53:52 -0400 |
commit | c85399c2da8b86de8f6877980294fa1a4a88a5a4 (patch) | |
tree | 0319b8ab4d8b7da4d614e46949755b8a9ba4eab0 /fs/nilfs2/sufile.h | |
parent | a703018f7bbec8109419318f5d51f235fdce5155 (diff) |
nilfs2: fix possible mismatch of sufile counters on recovery
On-disk counters ndirtysegs and ncleansegs of sufile, can go wrong
after roll-forward recovery because
nilfs_prepare_segment_for_recovery() function marks segments dirty
without adjusting value of these counters.
This fixes the problem by adding a function to sufile which does the
operation adjusting the counters, and by letting the recovery function
use it.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/sufile.h')
-rw-r--r-- | fs/nilfs2/sufile.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h index 449a6e2671b0..a2e2efd4ade1 100644 --- a/fs/nilfs2/sufile.h +++ b/fs/nilfs2/sufile.h | |||
@@ -52,6 +52,8 @@ int nilfs_sufile_update(struct inode *, __u64, int, | |||
52 | struct buffer_head *)); | 52 | struct buffer_head *)); |
53 | void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *, | 53 | void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *, |
54 | struct buffer_head *); | 54 | struct buffer_head *); |
55 | void nilfs_sufile_do_scrap(struct inode *, __u64, struct buffer_head *, | ||
56 | struct buffer_head *); | ||
55 | void nilfs_sufile_do_free(struct inode *, __u64, struct buffer_head *, | 57 | void nilfs_sufile_do_free(struct inode *, __u64, struct buffer_head *, |
56 | struct buffer_head *); | 58 | struct buffer_head *); |
57 | void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *, | 59 | void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *, |
@@ -78,6 +80,16 @@ static inline int nilfs_sufile_cancel_free(struct inode *sufile, __u64 segnum) | |||
78 | } | 80 | } |
79 | 81 | ||
80 | /** | 82 | /** |
83 | * nilfs_sufile_scrap - make a segment garbage | ||
84 | * @sufile: inode of segment usage file | ||
85 | * @segnum: segment number to be freed | ||
86 | */ | ||
87 | static inline int nilfs_sufile_scrap(struct inode *sufile, __u64 segnum) | ||
88 | { | ||
89 | return nilfs_sufile_update(sufile, segnum, 1, nilfs_sufile_do_scrap); | ||
90 | } | ||
91 | |||
92 | /** | ||
81 | * nilfs_sufile_free - free segment | 93 | * nilfs_sufile_free - free segment |
82 | * @sufile: inode of segment usage file | 94 | * @sufile: inode of segment usage file |
83 | * @segnum: segment number to be freed | 95 | * @segnum: segment number to be freed |