diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-12 11:36:56 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:48 -0500 |
commit | 8707df38478c8e0958b706f0ea1cdf99d00a9469 (patch) | |
tree | 5bc882fda214b4020f65f1df217e7fae40c10145 /fs/nilfs2 | |
parent | 79739565e15f2adbc482207a0800fc127c84d1a0 (diff) |
nilfs2: separate read method of meta data files on super root block
Will displace nilfs_mdt_read_inode_direct function with an individual
read method: nilfs_dat_read, nilfs_sufile_read, nilfs_cpfile_read.
This provides the opportunity to initialize local variables of each
metadata file after reading the inode.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r-- | fs/nilfs2/cpfile.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/cpfile.h | 1 | ||||
-rw-r--r-- | fs/nilfs2/dat.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/dat.h | 1 | ||||
-rw-r--r-- | fs/nilfs2/sufile.c | 10 | ||||
-rw-r--r-- | fs/nilfs2/sufile.h | 1 | ||||
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 12 |
7 files changed, 39 insertions, 6 deletions
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 2aaefaec1567..d5ad54e204a5 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -928,6 +928,16 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat) | |||
928 | } | 928 | } |
929 | 929 | ||
930 | /** | 930 | /** |
931 | * nilfs_cpfile_read - read cpfile inode | ||
932 | * @cpfile: cpfile inode | ||
933 | * @raw_inode: on-disk cpfile inode | ||
934 | */ | ||
935 | int nilfs_cpfile_read(struct inode *cpfile, struct nilfs_inode *raw_inode) | ||
936 | { | ||
937 | return nilfs_read_inode_common(cpfile, raw_inode); | ||
938 | } | ||
939 | |||
940 | /** | ||
931 | * nilfs_cpfile_new - create cpfile | 941 | * nilfs_cpfile_new - create cpfile |
932 | * @nilfs: nilfs object | 942 | * @nilfs: nilfs object |
933 | * @cpsize: size of a checkpoint entry | 943 | * @cpsize: size of a checkpoint entry |
diff --git a/fs/nilfs2/cpfile.h b/fs/nilfs2/cpfile.h index 8ff2b4f4656b..bc0809e0ab43 100644 --- a/fs/nilfs2/cpfile.h +++ b/fs/nilfs2/cpfile.h | |||
@@ -40,6 +40,7 @@ int nilfs_cpfile_get_stat(struct inode *, struct nilfs_cpstat *); | |||
40 | ssize_t nilfs_cpfile_get_cpinfo(struct inode *, __u64 *, int, void *, unsigned, | 40 | ssize_t nilfs_cpfile_get_cpinfo(struct inode *, __u64 *, int, void *, unsigned, |
41 | size_t); | 41 | size_t); |
42 | 42 | ||
43 | int nilfs_cpfile_read(struct inode *cpfile, struct nilfs_inode *raw_inode); | ||
43 | struct inode *nilfs_cpfile_new(struct the_nilfs *nilfs, size_t cpsize); | 44 | struct inode *nilfs_cpfile_new(struct the_nilfs *nilfs, size_t cpsize); |
44 | 45 | ||
45 | #endif /* _NILFS_CPFILE_H */ | 46 | #endif /* _NILFS_CPFILE_H */ |
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index 239a42234999..eff3169ba10f 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c | |||
@@ -427,6 +427,16 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz, | |||
427 | } | 427 | } |
428 | 428 | ||
429 | /** | 429 | /** |
430 | * nilfs_dat_read - read dat inode | ||
431 | * @dat: dat inode | ||
432 | * @raw_inode: on-disk dat inode | ||
433 | */ | ||
434 | int nilfs_dat_read(struct inode *dat, struct nilfs_inode *raw_inode) | ||
435 | { | ||
436 | return nilfs_read_inode_common(dat, raw_inode); | ||
437 | } | ||
438 | |||
439 | /** | ||
430 | * nilfs_dat_new - create dat file | 440 | * nilfs_dat_new - create dat file |
431 | * @nilfs: nilfs object | 441 | * @nilfs: nilfs object |
432 | * @entry_size: size of a dat entry | 442 | * @entry_size: size of a dat entry |
diff --git a/fs/nilfs2/dat.h b/fs/nilfs2/dat.h index 98f33067cb82..d31c3aab0efe 100644 --- a/fs/nilfs2/dat.h +++ b/fs/nilfs2/dat.h | |||
@@ -53,6 +53,7 @@ int nilfs_dat_freev(struct inode *, __u64 *, size_t); | |||
53 | int nilfs_dat_move(struct inode *, __u64, sector_t); | 53 | int nilfs_dat_move(struct inode *, __u64, sector_t); |
54 | ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned, size_t); | 54 | ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned, size_t); |
55 | 55 | ||
56 | int nilfs_dat_read(struct inode *dat, struct nilfs_inode *raw_inode); | ||
56 | struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size); | 57 | struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size); |
57 | 58 | ||
58 | #endif /* _NILFS_DAT_H */ | 59 | #endif /* _NILFS_DAT_H */ |
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index 6fb707ab7e2c..b344f27238f0 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c | |||
@@ -659,6 +659,16 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf, | |||
659 | } | 659 | } |
660 | 660 | ||
661 | /** | 661 | /** |
662 | * nilfs_sufile_read - read sufile inode | ||
663 | * @sufile: sufile inode | ||
664 | * @raw_inode: on-disk sufile inode | ||
665 | */ | ||
666 | int nilfs_sufile_read(struct inode *sufile, struct nilfs_inode *raw_inode) | ||
667 | { | ||
668 | return nilfs_read_inode_common(sufile, raw_inode); | ||
669 | } | ||
670 | |||
671 | /** | ||
662 | * nilfs_sufile_new - create sufile | 672 | * nilfs_sufile_new - create sufile |
663 | * @nilfs: nilfs object | 673 | * @nilfs: nilfs object |
664 | * @susize: size of a segment usage entry | 674 | * @susize: size of a segment usage entry |
diff --git a/fs/nilfs2/sufile.h b/fs/nilfs2/sufile.h index 50d3191ae4fd..b303a80ac3b1 100644 --- a/fs/nilfs2/sufile.h +++ b/fs/nilfs2/sufile.h | |||
@@ -62,6 +62,7 @@ void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *, | |||
62 | void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *, | 62 | void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *, |
63 | struct buffer_head *); | 63 | struct buffer_head *); |
64 | 64 | ||
65 | int nilfs_sufile_read(struct inode *sufile, struct nilfs_inode *raw_inode); | ||
65 | struct inode *nilfs_sufile_new(struct the_nilfs *nilfs, size_t susize); | 66 | struct inode *nilfs_sufile_new(struct the_nilfs *nilfs, size_t susize); |
66 | 67 | ||
67 | /** | 68 | /** |
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index d4a731fd4e32..bc7760c2a8f2 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -204,18 +204,18 @@ static int nilfs_load_super_root(struct the_nilfs *nilfs, | |||
204 | 204 | ||
205 | nilfs_mdt_set_shadow(nilfs->ns_dat, nilfs->ns_gc_dat); | 205 | nilfs_mdt_set_shadow(nilfs->ns_dat, nilfs->ns_gc_dat); |
206 | 206 | ||
207 | err = nilfs_mdt_read_inode_direct( | 207 | err = nilfs_dat_read(nilfs->ns_dat, (void *)bh_sr->b_data + |
208 | nilfs->ns_dat, bh_sr, NILFS_SR_DAT_OFFSET(inode_size)); | 208 | NILFS_SR_DAT_OFFSET(inode_size)); |
209 | if (unlikely(err)) | 209 | if (unlikely(err)) |
210 | goto failed_sufile; | 210 | goto failed_sufile; |
211 | 211 | ||
212 | err = nilfs_mdt_read_inode_direct( | 212 | err = nilfs_cpfile_read(nilfs->ns_cpfile, (void *)bh_sr->b_data + |
213 | nilfs->ns_cpfile, bh_sr, NILFS_SR_CPFILE_OFFSET(inode_size)); | 213 | NILFS_SR_CPFILE_OFFSET(inode_size)); |
214 | if (unlikely(err)) | 214 | if (unlikely(err)) |
215 | goto failed_sufile; | 215 | goto failed_sufile; |
216 | 216 | ||
217 | err = nilfs_mdt_read_inode_direct( | 217 | err = nilfs_sufile_read(nilfs->ns_sufile, (void *)bh_sr->b_data + |
218 | nilfs->ns_sufile, bh_sr, NILFS_SR_SUFILE_OFFSET(inode_size)); | 218 | NILFS_SR_SUFILE_OFFSET(inode_size)); |
219 | if (unlikely(err)) | 219 | if (unlikely(err)) |
220 | goto failed_sufile; | 220 | goto failed_sufile; |
221 | 221 | ||