diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-08-14 01:48:32 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-10-22 20:24:35 -0400 |
commit | b7c0634204993d7c6678c852e4bd118426599111 (patch) | |
tree | 4934238a49a56aaa072b4dea79b836439be760d8 /fs | |
parent | e912a5b66837ee89fb025e67b5efeaa11930c2ce (diff) |
nilfs2: move inode count and block count into root object
This moves sbi->s_inodes_count and sbi->s_blocks_count into nilfs_root
object.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/inode.c | 4 | ||||
-rw-r--r-- | fs/nilfs2/sb.h | 2 | ||||
-rw-r--r-- | fs/nilfs2/segment.c | 4 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 11 |
4 files changed, 10 insertions, 11 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 7e883d5a5033..ca09e4362d66 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -306,7 +306,7 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode) | |||
306 | goto failed_ifile_create_inode; | 306 | goto failed_ifile_create_inode; |
307 | /* reference count of i_bh inherits from nilfs_mdt_read_block() */ | 307 | /* reference count of i_bh inherits from nilfs_mdt_read_block() */ |
308 | 308 | ||
309 | atomic_inc(&sbi->s_inodes_count); | 309 | atomic_inc(&root->inodes_count); |
310 | inode_init_owner(inode, dir, mode); | 310 | inode_init_owner(inode, dir, mode); |
311 | inode->i_ino = ino; | 311 | inode->i_ino = ino; |
312 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 312 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
@@ -715,7 +715,7 @@ void nilfs_evict_inode(struct inode *inode) | |||
715 | end_writeback(inode); | 715 | end_writeback(inode); |
716 | 716 | ||
717 | nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino); | 717 | nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino); |
718 | atomic_dec(&NILFS_SB(sb)->s_inodes_count); | 718 | atomic_dec(&ii->i_root->inodes_count); |
719 | 719 | ||
720 | nilfs_clear_inode(inode); | 720 | nilfs_clear_inode(inode); |
721 | 721 | ||
diff --git a/fs/nilfs2/sb.h b/fs/nilfs2/sb.h index 50c418e6438e..3cc3675c3abe 100644 --- a/fs/nilfs2/sb.h +++ b/fs/nilfs2/sb.h | |||
@@ -44,8 +44,6 @@ struct nilfs_sc_info; | |||
44 | struct nilfs_sb_info { | 44 | struct nilfs_sb_info { |
45 | /* Snapshot status */ | 45 | /* Snapshot status */ |
46 | __u64 s_snapshot_cno; /* Checkpoint number */ | 46 | __u64 s_snapshot_cno; /* Checkpoint number */ |
47 | atomic_t s_inodes_count; | ||
48 | atomic_t s_blocks_count; /* Reserved (might be deleted) */ | ||
49 | 47 | ||
50 | /* Mount options */ | 48 | /* Mount options */ |
51 | unsigned long s_mount_opt; | 49 | unsigned long s_mount_opt; |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 2a6b74e6699d..b75306d642c2 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -856,9 +856,9 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci) | |||
856 | raw_cp->cp_snapshot_list.ssl_next = 0; | 856 | raw_cp->cp_snapshot_list.ssl_next = 0; |
857 | raw_cp->cp_snapshot_list.ssl_prev = 0; | 857 | raw_cp->cp_snapshot_list.ssl_prev = 0; |
858 | raw_cp->cp_inodes_count = | 858 | raw_cp->cp_inodes_count = |
859 | cpu_to_le64(atomic_read(&sbi->s_inodes_count)); | 859 | cpu_to_le64(atomic_read(&sci->sc_root->inodes_count)); |
860 | raw_cp->cp_blocks_count = | 860 | raw_cp->cp_blocks_count = |
861 | cpu_to_le64(atomic_read(&sbi->s_blocks_count)); | 861 | cpu_to_le64(atomic_read(&sci->sc_root->blocks_count)); |
862 | raw_cp->cp_nblk_inc = | 862 | raw_cp->cp_nblk_inc = |
863 | cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); | 863 | cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); |
864 | raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); | 864 | raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 87c57810ae88..acfa74e45f0b 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -429,8 +429,9 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno, int curr_mnt, | |||
429 | err = nilfs_read_inode_common(root->ifile, &raw_cp->cp_ifile_inode); | 429 | err = nilfs_read_inode_common(root->ifile, &raw_cp->cp_ifile_inode); |
430 | if (unlikely(err)) | 430 | if (unlikely(err)) |
431 | goto failed_bh; | 431 | goto failed_bh; |
432 | atomic_set(&sbi->s_inodes_count, le64_to_cpu(raw_cp->cp_inodes_count)); | 432 | |
433 | atomic_set(&sbi->s_blocks_count, le64_to_cpu(raw_cp->cp_blocks_count)); | 433 | atomic_set(&root->inodes_count, le64_to_cpu(raw_cp->cp_inodes_count)); |
434 | atomic_set(&root->blocks_count, le64_to_cpu(raw_cp->cp_blocks_count)); | ||
434 | 435 | ||
435 | nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); | 436 | nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); |
436 | 437 | ||
@@ -449,8 +450,8 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno, int curr_mnt, | |||
449 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 450 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
450 | { | 451 | { |
451 | struct super_block *sb = dentry->d_sb; | 452 | struct super_block *sb = dentry->d_sb; |
452 | struct nilfs_sb_info *sbi = NILFS_SB(sb); | 453 | struct nilfs_root *root = NILFS_I(dentry->d_inode)->i_root; |
453 | struct the_nilfs *nilfs = sbi->s_nilfs; | 454 | struct the_nilfs *nilfs = root->nilfs; |
454 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); | 455 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); |
455 | unsigned long long blocks; | 456 | unsigned long long blocks; |
456 | unsigned long overhead; | 457 | unsigned long overhead; |
@@ -486,7 +487,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
486 | buf->f_bfree = nfreeblocks; | 487 | buf->f_bfree = nfreeblocks; |
487 | buf->f_bavail = (buf->f_bfree >= nrsvblocks) ? | 488 | buf->f_bavail = (buf->f_bfree >= nrsvblocks) ? |
488 | (buf->f_bfree - nrsvblocks) : 0; | 489 | (buf->f_bfree - nrsvblocks) : 0; |
489 | buf->f_files = atomic_read(&sbi->s_inodes_count); | 490 | buf->f_files = atomic_read(&root->inodes_count); |
490 | buf->f_ffree = 0; /* nilfs_count_free_inodes(sb); */ | 491 | buf->f_ffree = 0; /* nilfs_count_free_inodes(sb); */ |
491 | buf->f_namelen = NILFS_NAME_LEN; | 492 | buf->f_namelen = NILFS_NAME_LEN; |
492 | buf->f_fsid.val[0] = (u32)id; | 493 | buf->f_fsid.val[0] = (u32)id; |