diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1814d4b8ff1f..157c64c9a4e7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1479,6 +1479,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1479 | int needs_recovery; | 1479 | int needs_recovery; |
1480 | __le32 features; | 1480 | __le32 features; |
1481 | __u64 blocks_count; | 1481 | __u64 blocks_count; |
1482 | int err; | ||
1482 | 1483 | ||
1483 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 1484 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
1484 | if (!sbi) | 1485 | if (!sbi) |
@@ -1759,12 +1760,20 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1759 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 1760 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
1760 | spin_lock_init(&sbi->s_next_gen_lock); | 1761 | spin_lock_init(&sbi->s_next_gen_lock); |
1761 | 1762 | ||
1762 | percpu_counter_init(&sbi->s_freeblocks_counter, | 1763 | err = percpu_counter_init(&sbi->s_freeblocks_counter, |
1763 | ext4_count_free_blocks(sb)); | 1764 | ext4_count_free_blocks(sb)); |
1764 | percpu_counter_init(&sbi->s_freeinodes_counter, | 1765 | if (!err) { |
1765 | ext4_count_free_inodes(sb)); | 1766 | err = percpu_counter_init(&sbi->s_freeinodes_counter, |
1766 | percpu_counter_init(&sbi->s_dirs_counter, | 1767 | ext4_count_free_inodes(sb)); |
1767 | ext4_count_dirs(sb)); | 1768 | } |
1769 | if (!err) { | ||
1770 | err = percpu_counter_init(&sbi->s_dirs_counter, | ||
1771 | ext4_count_dirs(sb)); | ||
1772 | } | ||
1773 | if (err) { | ||
1774 | printk(KERN_ERR "EXT4-fs: insufficient memory\n"); | ||
1775 | goto failed_mount3; | ||
1776 | } | ||
1768 | 1777 | ||
1769 | /* per fileystem reservation list head & lock */ | 1778 | /* per fileystem reservation list head & lock */ |
1770 | spin_lock_init(&sbi->s_rsv_window_lock); | 1779 | spin_lock_init(&sbi->s_rsv_window_lock); |