aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2006-06-23 05:05:41 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:43:06 -0400
commit0216bfcffe424a5473daa4da47440881b36c1f41 (patch)
tree80eaa49bfc644b070e57c251285048992ac6fafc /fs/ext3
parent3cbc564024d8f174202f023e8a2991782f6a9431 (diff)
[PATCH] percpu counter data type changes to suppport more than 2**31 ext3 free blocks counter
The percpu counter data type are changed in this set of patches to support more users like ext3 who need more than 32 bit to store the free blocks total in the filesystem. - Generic perpcu counters data type changes. The size of the global counter and local counter were explictly specified using s64 and s32. The global counter is changed from long to s64, while the local counter is changed from long to s32, so we could avoid doing 64 bit update in most cases. - Users of the percpu counters are updated to make use of the new percpu_counter_init() routine now taking an additional parameter to allow users to pass the initial value of the global counter. Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/super.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 1a198b3985c9..a60cc6ec130f 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1580,9 +1580,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1580 goto failed_mount; 1580 goto failed_mount;
1581 } 1581 }
1582 1582
1583 percpu_counter_init(&sbi->s_freeblocks_counter);
1584 percpu_counter_init(&sbi->s_freeinodes_counter);
1585 percpu_counter_init(&sbi->s_dirs_counter);
1586 bgl_lock_init(&sbi->s_blockgroup_lock); 1583 bgl_lock_init(&sbi->s_blockgroup_lock);
1587 1584
1588 for (i = 0; i < db_count; i++) { 1585 for (i = 0; i < db_count; i++) {
@@ -1602,6 +1599,14 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1602 sbi->s_gdb_count = db_count; 1599 sbi->s_gdb_count = db_count;
1603 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 1600 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
1604 spin_lock_init(&sbi->s_next_gen_lock); 1601 spin_lock_init(&sbi->s_next_gen_lock);
1602
1603 percpu_counter_init(&sbi->s_freeblocks_counter,
1604 ext3_count_free_blocks(sb));
1605 percpu_counter_init(&sbi->s_freeinodes_counter,
1606 ext3_count_free_inodes(sb));
1607 percpu_counter_init(&sbi->s_dirs_counter,
1608 ext3_count_dirs(sb));
1609
1605 /* per fileystem reservation list head & lock */ 1610 /* per fileystem reservation list head & lock */
1606 spin_lock_init(&sbi->s_rsv_window_lock); 1611 spin_lock_init(&sbi->s_rsv_window_lock);
1607 sbi->s_rsv_window_root = RB_ROOT; 1612 sbi->s_rsv_window_root = RB_ROOT;
@@ -1640,16 +1645,16 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1640 if (!test_opt(sb, NOLOAD) && 1645 if (!test_opt(sb, NOLOAD) &&
1641 EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { 1646 EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
1642 if (ext3_load_journal(sb, es, journal_devnum)) 1647 if (ext3_load_journal(sb, es, journal_devnum))
1643 goto failed_mount2; 1648 goto failed_mount3;
1644 } else if (journal_inum) { 1649 } else if (journal_inum) {
1645 if (ext3_create_journal(sb, es, journal_inum)) 1650 if (ext3_create_journal(sb, es, journal_inum))
1646 goto failed_mount2; 1651 goto failed_mount3;
1647 } else { 1652 } else {
1648 if (!silent) 1653 if (!silent)
1649 printk (KERN_ERR 1654 printk (KERN_ERR
1650 "ext3: No journal on filesystem on %s\n", 1655 "ext3: No journal on filesystem on %s\n",
1651 sb->s_id); 1656 sb->s_id);
1652 goto failed_mount2; 1657 goto failed_mount3;
1653 } 1658 }
1654 1659
1655 /* We have now updated the journal if required, so we can 1660 /* We have now updated the journal if required, so we can
@@ -1672,7 +1677,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1672 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { 1677 (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) {
1673 printk(KERN_ERR "EXT3-fs: Journal does not support " 1678 printk(KERN_ERR "EXT3-fs: Journal does not support "
1674 "requested data journaling mode\n"); 1679 "requested data journaling mode\n");
1675 goto failed_mount3; 1680 goto failed_mount4;
1676 } 1681 }
1677 default: 1682 default:
1678 break; 1683 break;
@@ -1695,13 +1700,13 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1695 if (!sb->s_root) { 1700 if (!sb->s_root) {
1696 printk(KERN_ERR "EXT3-fs: get root inode failed\n"); 1701 printk(KERN_ERR "EXT3-fs: get root inode failed\n");
1697 iput(root); 1702 iput(root);
1698 goto failed_mount3; 1703 goto failed_mount4;
1699 } 1704 }
1700 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 1705 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
1701 dput(sb->s_root); 1706 dput(sb->s_root);
1702 sb->s_root = NULL; 1707 sb->s_root = NULL;
1703 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); 1708 printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n");
1704 goto failed_mount3; 1709 goto failed_mount4;
1705 } 1710 }
1706 1711
1707 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); 1712 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
@@ -1724,13 +1729,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1724 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": 1729 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
1725 "writeback"); 1730 "writeback");
1726 1731
1727 percpu_counter_mod(&sbi->s_freeblocks_counter,
1728 ext3_count_free_blocks(sb));
1729 percpu_counter_mod(&sbi->s_freeinodes_counter,
1730 ext3_count_free_inodes(sb));
1731 percpu_counter_mod(&sbi->s_dirs_counter,
1732 ext3_count_dirs(sb));
1733
1734 lock_kernel(); 1732 lock_kernel();
1735 return 0; 1733 return 0;
1736 1734
@@ -1740,8 +1738,12 @@ cantfind_ext3:
1740 sb->s_id); 1738 sb->s_id);
1741 goto failed_mount; 1739 goto failed_mount;
1742 1740
1743failed_mount3: 1741failed_mount4:
1744 journal_destroy(sbi->s_journal); 1742 journal_destroy(sbi->s_journal);
1743failed_mount3:
1744 percpu_counter_destroy(&sbi->s_freeblocks_counter);
1745 percpu_counter_destroy(&sbi->s_freeinodes_counter);
1746 percpu_counter_destroy(&sbi->s_dirs_counter);
1745failed_mount2: 1747failed_mount2:
1746 for (i = 0; i < db_count; i++) 1748 for (i = 0; i < db_count; i++)
1747 brelse(sbi->s_group_desc[i]); 1749 brelse(sbi->s_group_desc[i]);