Commit e5f7f84843154db8b6ef5b2ac5e286f72212f54e
Committed by
Linus Torvalds
1 parent
c7ef972c44
Exists in
master
and in
20 other branches
] 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>
Showing 6 changed files with 16 additions and 14 deletions Side-by-side Diff
fs/nilfs2/ifile.c
... | ... | @@ -174,7 +174,7 @@ |
174 | 174 | *nmaxinodes = 0; |
175 | 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 | 178 | err = nilfs_palloc_count_max_entries(ifile, nused, nmaxinodes); |
179 | 179 | if (likely(!err)) |
180 | 180 | *nfreeinodes = *nmaxinodes - nused; |
fs/nilfs2/inode.c
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | |
55 | 55 | inode_add_bytes(inode, (1 << inode->i_blkbits) * n); |
56 | 56 | if (root) |
57 | - atomic_add(n, &root->blocks_count); | |
57 | + atomic64_add(n, &root->blocks_count); | |
58 | 58 | } |
59 | 59 | |
60 | 60 | void nilfs_inode_sub_blocks(struct inode *inode, int n) |
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | |
64 | 64 | inode_sub_bytes(inode, (1 << inode->i_blkbits) * n); |
65 | 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 @@ |
369 | 369 | goto failed_ifile_create_inode; |
370 | 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 | 373 | inode_init_owner(inode, dir, mode); |
374 | 374 | inode->i_ino = ino; |
375 | 375 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
... | ... | @@ -801,7 +801,7 @@ |
801 | 801 | |
802 | 802 | ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino); |
803 | 803 | if (!ret) |
804 | - atomic_dec(&ii->i_root->inodes_count); | |
804 | + atomic64_dec(&ii->i_root->inodes_count); | |
805 | 805 | |
806 | 806 | nilfs_clear_inode(inode); |
807 | 807 |
fs/nilfs2/segment.c
... | ... | @@ -835,9 +835,9 @@ |
835 | 835 | raw_cp->cp_snapshot_list.ssl_next = 0; |
836 | 836 | raw_cp->cp_snapshot_list.ssl_prev = 0; |
837 | 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 | 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 | 841 | raw_cp->cp_nblk_inc = |
842 | 842 | cpu_to_le64(sci->sc_nblk_inc + sci->sc_nblk_this_inc); |
843 | 843 | raw_cp->cp_create = cpu_to_le64(sci->sc_seg_ctime); |
fs/nilfs2/super.c
... | ... | @@ -554,8 +554,10 @@ |
554 | 554 | if (err) |
555 | 555 | goto failed_bh; |
556 | 556 | |
557 | - atomic_set(&root->inodes_count, le64_to_cpu(raw_cp->cp_inodes_count)); | |
558 | - atomic_set(&root->blocks_count, le64_to_cpu(raw_cp->cp_blocks_count)); | |
557 | + atomic64_set(&root->inodes_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 | 562 | nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp); |
561 | 563 | |
... | ... | @@ -647,7 +649,7 @@ |
647 | 649 | * curent inodes count as maximum possible and |
648 | 650 | * zero as free inodes value. |
649 | 651 | */ |
650 | - nmaxinodes = atomic_read(&root->inodes_count); | |
652 | + nmaxinodes = atomic64_read(&root->inodes_count); | |
651 | 653 | nfreeinodes = 0; |
652 | 654 | err = 0; |
653 | 655 | } else |
fs/nilfs2/the_nilfs.c
... | ... | @@ -764,8 +764,8 @@ |
764 | 764 | new->ifile = NULL; |
765 | 765 | new->nilfs = nilfs; |
766 | 766 | atomic_set(&new->count, 1); |
767 | - atomic_set(&new->inodes_count, 0); | |
768 | - atomic_set(&new->blocks_count, 0); | |
767 | + atomic64_set(&new->inodes_count, 0); | |
768 | + atomic64_set(&new->blocks_count, 0); | |
769 | 769 | |
770 | 770 | rb_link_node(&new->rb_node, parent, p); |
771 | 771 | rb_insert_color(&new->rb_node, &nilfs->ns_cptree); |
fs/nilfs2/the_nilfs.h