Skip to content

Commit

Permalink
nilfs2: separate read method of meta data files on super root block
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
konis committed Nov 20, 2009
1 parent 7973956 commit 8707df3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
10 changes: 10 additions & 0 deletions fs/nilfs2/cpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,16 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat)
return ret;
}

/**
* nilfs_cpfile_read - read cpfile inode
* @cpfile: cpfile inode
* @raw_inode: on-disk cpfile inode
*/
int nilfs_cpfile_read(struct inode *cpfile, struct nilfs_inode *raw_inode)
{
return nilfs_read_inode_common(cpfile, raw_inode);
}

/**
* nilfs_cpfile_new - create cpfile
* @nilfs: nilfs object
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/cpfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int nilfs_cpfile_get_stat(struct inode *, struct nilfs_cpstat *);
ssize_t nilfs_cpfile_get_cpinfo(struct inode *, __u64 *, int, void *, unsigned,
size_t);

int nilfs_cpfile_read(struct inode *cpfile, struct nilfs_inode *raw_inode);
struct inode *nilfs_cpfile_new(struct the_nilfs *nilfs, size_t cpsize);

#endif /* _NILFS_CPFILE_H */
10 changes: 10 additions & 0 deletions fs/nilfs2/dat.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz,
return nvi;
}

/**
* nilfs_dat_read - read dat inode
* @dat: dat inode
* @raw_inode: on-disk dat inode
*/
int nilfs_dat_read(struct inode *dat, struct nilfs_inode *raw_inode)
{
return nilfs_read_inode_common(dat, raw_inode);
}

/**
* nilfs_dat_new - create dat file
* @nilfs: nilfs object
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ int nilfs_dat_freev(struct inode *, __u64 *, size_t);
int nilfs_dat_move(struct inode *, __u64, sector_t);
ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned, size_t);

int nilfs_dat_read(struct inode *dat, struct nilfs_inode *raw_inode);
struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size);

#endif /* _NILFS_DAT_H */
10 changes: 10 additions & 0 deletions fs/nilfs2/sufile.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,16 @@ ssize_t nilfs_sufile_get_suinfo(struct inode *sufile, __u64 segnum, void *buf,
return ret;
}

/**
* nilfs_sufile_read - read sufile inode
* @sufile: sufile inode
* @raw_inode: on-disk sufile inode
*/
int nilfs_sufile_read(struct inode *sufile, struct nilfs_inode *raw_inode)
{
return nilfs_read_inode_common(sufile, raw_inode);
}

/**
* nilfs_sufile_new - create sufile
* @nilfs: nilfs object
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/sufile.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void nilfs_sufile_do_cancel_free(struct inode *, __u64, struct buffer_head *,
void nilfs_sufile_do_set_error(struct inode *, __u64, struct buffer_head *,
struct buffer_head *);

int nilfs_sufile_read(struct inode *sufile, struct nilfs_inode *raw_inode);
struct inode *nilfs_sufile_new(struct the_nilfs *nilfs, size_t susize);

/**
Expand Down
12 changes: 6 additions & 6 deletions fs/nilfs2/the_nilfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,18 @@ static int nilfs_load_super_root(struct the_nilfs *nilfs,

nilfs_mdt_set_shadow(nilfs->ns_dat, nilfs->ns_gc_dat);

err = nilfs_mdt_read_inode_direct(
nilfs->ns_dat, bh_sr, NILFS_SR_DAT_OFFSET(inode_size));
err = nilfs_dat_read(nilfs->ns_dat, (void *)bh_sr->b_data +
NILFS_SR_DAT_OFFSET(inode_size));
if (unlikely(err))
goto failed_sufile;

err = nilfs_mdt_read_inode_direct(
nilfs->ns_cpfile, bh_sr, NILFS_SR_CPFILE_OFFSET(inode_size));
err = nilfs_cpfile_read(nilfs->ns_cpfile, (void *)bh_sr->b_data +
NILFS_SR_CPFILE_OFFSET(inode_size));
if (unlikely(err))
goto failed_sufile;

err = nilfs_mdt_read_inode_direct(
nilfs->ns_sufile, bh_sr, NILFS_SR_SUFILE_OFFSET(inode_size));
err = nilfs_sufile_read(nilfs->ns_sufile, (void *)bh_sr->b_data +
NILFS_SR_SUFILE_OFFSET(inode_size));
if (unlikely(err))
goto failed_sufile;

Expand Down

0 comments on commit 8707df3

Please sign in to comment.