diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-04 10:19:32 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 00:58:31 -0500 |
commit | be667377a8b8cd73e1b923f33fb5be4034aa4bfa (patch) | |
tree | 8baee2f9155728331eeade85ec93547402f4e606 /fs/nilfs2/inode.c | |
parent | ae191838b0251d73b9d0a7254c6938406f5f6320 (diff) |
nilfs2: record used amount of each checkpoint in checkpoint list
This records the number of used blocks per checkpoint in each
checkpoint entry of cpfile. Even though userland tools can get the
block count via nilfs_get_cpinfo ioctl, it was not updated by the
nilfs2 kernel code. This fixes the issue and makes it available for
userland tools to calculate used amount per checkpoint.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Jiro SEKIBA <jir@unicus.jp>
Diffstat (limited to 'fs/nilfs2/inode.c')
-rw-r--r-- | fs/nilfs2/inode.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 2534af8d2b5c..22a816ba3621 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -41,6 +41,24 @@ struct nilfs_iget_args { | |||
41 | int for_gc; | 41 | int for_gc; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | void nilfs_inode_add_blocks(struct inode *inode, int n) | ||
45 | { | ||
46 | struct nilfs_root *root = NILFS_I(inode)->i_root; | ||
47 | |||
48 | inode_add_bytes(inode, (1 << inode->i_blkbits) * n); | ||
49 | if (root) | ||
50 | atomic_add(n, &root->blocks_count); | ||
51 | } | ||
52 | |||
53 | void nilfs_inode_sub_blocks(struct inode *inode, int n) | ||
54 | { | ||
55 | struct nilfs_root *root = NILFS_I(inode)->i_root; | ||
56 | |||
57 | inode_sub_bytes(inode, (1 << inode->i_blkbits) * n); | ||
58 | if (root) | ||
59 | atomic_sub(n, &root->blocks_count); | ||
60 | } | ||
61 | |||
44 | /** | 62 | /** |
45 | * nilfs_get_block() - get a file block on the filesystem (callback function) | 63 | * nilfs_get_block() - get a file block on the filesystem (callback function) |
46 | * @inode - inode struct of the target file | 64 | * @inode - inode struct of the target file |