aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorVyacheslav Dubeyko <slava@dubeyko.com>2013-07-03 18:08:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:08:01 -0400
commite5f7f84843154db8b6ef5b2ac5e286f72212f54e (patch)
treee3d11da3a3b6bb3777998b9bc2919e48d47cddf6 /fs
parentc7ef972c440fc9f1eda28b450cd30ad15c4d60cf (diff)
] nilfs2: use atomic64_t type for inodes_count and blocks_count fields in nilfs_root struct
The cp_inodes_count and cp_blocks_count are represented as __le64 type in on-disk structure (struct nilfs_checkpoint). But analogous fields in in-core structure (struct nilfs_root) are represented by atomic_t type. This patch replaces atomic_t on atomic64_t type in representation of inodes_count and blocks_count fields in struct nilfs_root. Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com> Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Acked-by: Joern Engel <joern@logfs.org> Cc: Clemens Eisserer <linuxhippy@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/ifile.c2
-rw-r--r--fs/nilfs2/inode.c8
-rw-r--r--fs/nilfs2/segment.c4
-rw-r--r--fs/nilfs2/super.c8
-rw-r--r--fs/nilfs2/the_nilfs.c4
-rw-r--r--fs/nilfs2/the_nilfs.h4
6 files changed, 16 insertions, 14 deletions
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
index d788a5928351..6548c7851b48 100644
--- a/fs/nilfs2/ifile.c
+++ b/fs/nilfs2/ifile.c
@@ -174,7 +174,7 @@ int nilfs_ifile_count_free_inodes(struct inode *ifile,
174 *nmaxinodes = 0; 174 *nmaxinodes = 0;
175 *nfreeinodes = 0; 175 *nfreeinodes = 0;
176 176
177 nused = atomic_read(&NILFS_I(ifile)->i_root->inodes_count); 177 nused = atomic64_read(&NILFS_I(ifile)->i_root->inodes_count);
178 err = nilfs_palloc_count_max_entries(ifile, nused, nmaxinodes); 178 err = nilfs_palloc_count_max_entries(ifile, nused, nmaxinodes);
179 if (likely(!err)) 179 if (likely(!err))
180 *nfreeinodes = *nmaxinodes - nused; 180 *nfreeinodes = *nmaxinodes - nused;
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index bccfec8343c5..b1a5277cfd18 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -54,7 +54,7 @@ void nilfs_inode_add_blocks(struct inode *inode, int n)
54 54
55 inode_add_bytes(inode, (1 << inode->i_blkbits) * n); 55 inode_add_bytes(inode, (1 << inode->i_blkbits) * n);
56 if (root) 56 if (root)
57 atomic_add(n, &root->blocks_count); 57 atomic64_add(n, &root->blocks_count);
58} 58}
59 59
60void nilfs_inode_sub_blocks(struct inode *inode, int n) 60void nilfs_inode_sub_blocks(struct inode *inode, int n)
@@ -63,7 +63,7 @@ void nilfs_inode_sub_blocks(struct inode *inode, int n)
63 63
64 inode_sub_bytes(inode, (1 << inode->i_blkbits) * n); 64 inode_sub_bytes(inode, (1 << inode->i_blkbits) * n);
65 if (root) 65 if (root)
66 atomic_sub(n, &root->blocks_count); 66 atomic64_sub(n, &root->blocks_count);
67} 67}
68 68
69/** 69/**
@@ -369,7 +369,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
369 goto failed_ifile_create_inode; 369 goto failed_ifile_create_inode;
370 /* reference count of i_bh inherits from nilfs_mdt_read_block() */ 370 /* reference count of i_bh inherits from nilfs_mdt_read_block() */
371 371
372 atomic_inc(&root->inodes_count); 372 atomic64_inc(&root->inodes_count);
373 inode_init_owner(inode, dir, mode); 373 inode_init_owner(inode, dir, mode);
374 inode->i_ino = ino; 374 inode->i_ino = ino;
375 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 375 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
@@ -801,7 +801,7 @@ void nilfs_evict_inode(struct inode *inode)
801 801
802 ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino); 802 ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
803 if (!ret) 803 if (!ret)
804 atomic_dec(&ii->i_root->inodes_count); 804 atomic64_dec(&ii->i_root->inodes_count);
805 805
806 nilfs_clear_inode(inode); 806 nilfs_clear_inode(inode);
807 807
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index a5752a589932..bd88a7461063 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -835,9 +835,9 @@ static int nilfs_segctor_fill_in_checkpoint(struct nilfs_sc_info *sci)
835 raw_cp->cp_snapshot_list.ssl_next = 0; 835 raw_cp->cp_snapshot_list.ssl_next = 0;
836 raw_cp->cp_snapshot_list.ssl_prev = 0; 836 raw_cp->cp_snapshot_list.ssl_prev = 0;
837 raw_cp->cp_inodes_count = 837 raw_cp->cp_inodes_count =
838 cpu_to_le64(atomic_read(&sci->sc_root->inodes_count)); 838 cpu_to_le64(atomic64_read(&sci->sc_root->inodes_count));
839 raw_cp->cp_blocks_count = 839 raw_cp->cp_blocks_count =
840 cpu_to_le64(atomic_read(&sci->sc_root->blocks_count)); 840 cpu_to_le64(atomic64_read(&sci->sc_root->blocks_count));
841 raw_cp->cp_nblk_inc = 841 raw_cp->cp_nblk_inc =
842 cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); 842 cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc);
843 raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); 843 raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime);
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 7d257e78fbad..1427de5ebf4d 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -554,8 +554,10 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
554 if (err) 554 if (err)
555 goto failed_bh; 555 goto failed_bh;
556 556
557 atomic_set(&root->inodes_count, le64_to_cpu(raw_cp->cp_inodes_count)); 557 atomic64_set(&root->inodes_count,
558 atomic_set(&root->blocks_count, le64_to_cpu(raw_cp->cp_blocks_count)); 558 le64_to_cpu(raw_cp->cp_inodes_count));
559 atomic64_set(&root->blocks_count,
560 le64_to_cpu(raw_cp->cp_blocks_count));
559 561
560 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); 562 nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
561 563
@@ -647,7 +649,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
647 * curent inodes count as maximum possible and 649 * curent inodes count as maximum possible and
648 * zero as free inodes value. 650 * zero as free inodes value.
649 */ 651 */
650 nmaxinodes = atomic_read(&root->inodes_count); 652 nmaxinodes = atomic64_read(&root->inodes_count);
651 nfreeinodes = 0; 653 nfreeinodes = 0;
652 err = 0; 654 err = 0;
653 } else 655 } else
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 41e6a04a561f..94c451ce6d24 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -764,8 +764,8 @@ nilfs_find_or_create_root(struct the_nilfs *nilfs, __u64 cno)
764 new->ifile = NULL; 764 new->ifile = NULL;
765 new->nilfs = nilfs; 765 new->nilfs = nilfs;
766 atomic_set(&new->count, 1); 766 atomic_set(&new->count, 1);
767 atomic_set(&new->inodes_count, 0); 767 atomic64_set(&new->inodes_count, 0);
768 atomic_set(&new->blocks_count, 0); 768 atomic64_set(&new->blocks_count, 0);
769 769
770 rb_link_node(&new->rb_node, parent, p); 770 rb_link_node(&new->rb_node, parent, p);
771 rb_insert_color(&new->rb_node, &nilfs->ns_cptree); 771 rb_insert_color(&new->rb_node, &nilfs->ns_cptree);
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index be1267a34cea..de8cc53b4a5c 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -241,8 +241,8 @@ struct nilfs_root {
241 struct the_nilfs *nilfs; 241 struct the_nilfs *nilfs;
242 struct inode *ifile; 242 struct inode *ifile;
243 243
244 atomic_t inodes_count; 244 atomic64_t inodes_count;
245 atomic_t blocks_count; 245 atomic64_t blocks_count;
246}; 246};
247 247
248/* Special checkpoint number */ 248/* Special checkpoint number */