diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-17 02:25:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:44 -0400 |
commit | 833f4077bf7c2dcff6e31526e03ec2ad91c88581 (patch) | |
tree | 80916540be846267342c3e5e4a6255c2c18b44d5 /fs/ext4 | |
parent | bf1d89c81352f6eca72d0c10cfee3dba29ef5efb (diff) |
lib: percpu_counter_init error handling
alloc_percpu can fail, propagate that error.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext4')
-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); |