diff options
Diffstat (limited to 'fs/nilfs2/super.c')
| -rw-r--r-- | fs/nilfs2/super.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index c7d1f9f18b09..af3ba0478cdf 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 | ||
| @@ -609,6 +611,7 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 609 | unsigned long overhead; | 611 | unsigned long overhead; |
| 610 | unsigned long nrsvblocks; | 612 | unsigned long nrsvblocks; |
| 611 | sector_t nfreeblocks; | 613 | sector_t nfreeblocks; |
| 614 | u64 nmaxinodes, nfreeinodes; | ||
| 612 | int err; | 615 | int err; |
| 613 | 616 | ||
| 614 | /* | 617 | /* |
| @@ -633,14 +636,34 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 633 | if (unlikely(err)) | 636 | if (unlikely(err)) |
| 634 | return err; | 637 | return err; |
| 635 | 638 | ||
| 639 | err = nilfs_ifile_count_free_inodes(root->ifile, | ||
| 640 | &nmaxinodes, &nfreeinodes); | ||
| 641 | if (unlikely(err)) { | ||
| 642 | printk(KERN_WARNING | ||
| 643 | "NILFS warning: fail to count free inodes: err %d.\n", | ||
| 644 | err); | ||
| 645 | if (err == -ERANGE) { | ||
| 646 | /* | ||
| 647 | * If nilfs_palloc_count_max_entries() returns | ||
| 648 | * -ERANGE error code then we simply treat | ||
| 649 | * curent inodes count as maximum possible and | ||
| 650 | * zero as free inodes value. | ||
| 651 | */ | ||
| 652 | nmaxinodes = atomic64_read(&root->inodes_count); | ||
| 653 | nfreeinodes = 0; | ||
| 654 | err = 0; | ||
| 655 | } else | ||
| 656 | return err; | ||
| 657 | } | ||
| 658 | |||
| 636 | buf->f_type = NILFS_SUPER_MAGIC; | 659 | buf->f_type = NILFS_SUPER_MAGIC; |
| 637 | buf->f_bsize = sb->s_blocksize; | 660 | buf->f_bsize = sb->s_blocksize; |
| 638 | buf->f_blocks = blocks - overhead; | 661 | buf->f_blocks = blocks - overhead; |
| 639 | buf->f_bfree = nfreeblocks; | 662 | buf->f_bfree = nfreeblocks; |
| 640 | buf->f_bavail = (buf->f_bfree >= nrsvblocks) ? | 663 | buf->f_bavail = (buf->f_bfree >= nrsvblocks) ? |
| 641 | (buf->f_bfree - nrsvblocks) : 0; | 664 | (buf->f_bfree - nrsvblocks) : 0; |
| 642 | buf->f_files = atomic_read(&root->inodes_count); | 665 | buf->f_files = nmaxinodes; |
| 643 | buf->f_ffree = 0; /* nilfs_count_free_inodes(sb); */ | 666 | buf->f_ffree = nfreeinodes; |
| 644 | buf->f_namelen = NILFS_NAME_LEN; | 667 | buf->f_namelen = NILFS_NAME_LEN; |
| 645 | buf->f_fsid.val[0] = (u32)id; | 668 | buf->f_fsid.val[0] = (u32)id; |
| 646 | buf->f_fsid.val[1] = (u32)(id >> 32); | 669 | buf->f_fsid.val[1] = (u32)(id >> 32); |
| @@ -973,7 +996,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, | |||
| 973 | 996 | ||
| 974 | static int nilfs_tree_was_touched(struct dentry *root_dentry) | 997 | static int nilfs_tree_was_touched(struct dentry *root_dentry) |
| 975 | { | 998 | { |
| 976 | return root_dentry->d_count > 1; | 999 | return d_count(root_dentry) > 1; |
| 977 | } | 1000 | } |
| 978 | 1001 | ||
| 979 | /** | 1002 | /** |
