* [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids. @ 2008-07-22 13:17 Aneesh Kumar K.V 2008-07-22 15:11 ` Eric Sandeen 2008-07-22 23:58 ` Andreas Dilger 0 siblings, 2 replies; 5+ messages in thread From: Aneesh Kumar K.V @ 2008-07-22 13:17 UTC (permalink / raw) To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V NR_CPUS can be really large. We should be using nr_cpu_ids instead. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- fs/ext4/mballoc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 9db0f4d..5b854b7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2541,7 +2541,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) sbi->s_mb_history_filter = EXT4_MB_HISTORY_DEFAULT; sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC; - i = sizeof(struct ext4_locality_group) * NR_CPUS; + i = sizeof(struct ext4_locality_group) * nr_cpu_ids; sbi->s_locality_groups = kmalloc(i, GFP_KERNEL); if (sbi->s_locality_groups == NULL) { clear_opt(sbi->s_mount_opt, MBALLOC); @@ -2549,7 +2549,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) kfree(sbi->s_mb_maxs); return -ENOMEM; } - for (i = 0; i < NR_CPUS; i++) { + for (i = 0; i < nr_cpu_ids; i++) { struct ext4_locality_group *lg; lg = &sbi->s_locality_groups[i]; mutex_init(&lg->lg_mutex); -- 1.5.6.3.439.g1e10.dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids. 2008-07-22 13:17 [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids Aneesh Kumar K.V @ 2008-07-22 15:11 ` Eric Sandeen 2008-07-22 23:58 ` Andreas Dilger 1 sibling, 0 replies; 5+ messages in thread From: Eric Sandeen @ 2008-07-22 15:11 UTC (permalink / raw) To: Aneesh Kumar K.V; +Cc: cmm, tytso, linux-ext4 Aneesh Kumar K.V wrote: > NR_CPUS can be really large. We should be using nr_cpu_ids > instead. Yep, thanks, I thought we got rid of these at some point but guess not (or not all)! > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Acked-by: Eric Sandeen <sandeen@redhat.com> > --- > fs/ext4/mballoc.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 9db0f4d..5b854b7 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -2541,7 +2541,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) > sbi->s_mb_history_filter = EXT4_MB_HISTORY_DEFAULT; > sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC; > > - i = sizeof(struct ext4_locality_group) * NR_CPUS; > + i = sizeof(struct ext4_locality_group) * nr_cpu_ids; > sbi->s_locality_groups = kmalloc(i, GFP_KERNEL); > if (sbi->s_locality_groups == NULL) { > clear_opt(sbi->s_mount_opt, MBALLOC); > @@ -2549,7 +2549,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) > kfree(sbi->s_mb_maxs); > return -ENOMEM; > } > - for (i = 0; i < NR_CPUS; i++) { > + for (i = 0; i < nr_cpu_ids; i++) { > struct ext4_locality_group *lg; > lg = &sbi->s_locality_groups[i]; > mutex_init(&lg->lg_mutex); ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids. 2008-07-22 13:17 [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids Aneesh Kumar K.V 2008-07-22 15:11 ` Eric Sandeen @ 2008-07-22 23:58 ` Andreas Dilger 2008-07-23 7:57 ` Aneesh Kumar K.V 1 sibling, 1 reply; 5+ messages in thread From: Andreas Dilger @ 2008-07-22 23:58 UTC (permalink / raw) To: Aneesh Kumar K.V; +Cc: cmm, tytso, sandeen, linux-ext4 On Jul 22, 2008 18:47 +0530, Aneesh Kumar wrote: > NR_CPUS can be really large. We should be using nr_cpu_ids > instead. Should this actually be num_possible_cpus() or num_online_cpus()? I've never seen nr_cpu_ids used before. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids. 2008-07-22 23:58 ` Andreas Dilger @ 2008-07-23 7:57 ` Aneesh Kumar K.V 0 siblings, 0 replies; 5+ messages in thread From: Aneesh Kumar K.V @ 2008-07-23 7:57 UTC (permalink / raw) To: Andreas Dilger; +Cc: cmm, tytso, sandeen, linux-ext4 On Tue, Jul 22, 2008 at 05:58:04PM -0600, Andreas Dilger wrote: > On Jul 22, 2008 18:47 +0530, Aneesh Kumar wrote: > > NR_CPUS can be really large. We should be using nr_cpu_ids > > instead. > > Should this actually be num_possible_cpus() or num_online_cpus()? > I've never seen nr_cpu_ids used before. > introduced in git show 53b8a315b76a3f3c70a5644976c0095460eb13d8 [PATCH] Convert highest_possible_processor_id to nr_cpu_ids lots of eg: that does NR_CPU to nr_cpu_ids conversion git show 0c0b0aca66b3a58e12a216d992a0b534eff210e0 net: remove NR_CPUS arrays in net/core/dev.c -aneesh ^ permalink raw reply [flat|nested] 5+ messages in thread
* Patches for patchqueue @ 2008-07-23 17:10 Aneesh Kumar K.V 2008-07-23 17:10 ` [PATCH] ext4: Improve error handling in mballoc Aneesh Kumar K.V 0 siblings, 1 reply; 5+ messages in thread From: Aneesh Kumar K.V @ 2008-07-23 17:10 UTC (permalink / raw) To: cmm, tytso, sandeen; +Cc: linux-ext4 Sending below patch for the patchqueue. ext4-Improve-error-handling-in-mballoc.patch ext4-Convert-the-usage-of-NR_CPUS-to-nr_cpu_ids.patch ext4-Don-t-allow-lg-prealloc-list-to-be-grow-large.patch I have updated the last patch to simplify locking. -aneesh ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ext4: Improve error handling in mballoc 2008-07-23 17:10 Patches for patchqueue Aneesh Kumar K.V @ 2008-07-23 17:10 ` Aneesh Kumar K.V 2008-07-23 17:10 ` [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids Aneesh Kumar K.V 0 siblings, 1 reply; 5+ messages in thread From: Aneesh Kumar K.V @ 2008-07-23 17:10 UTC (permalink / raw) To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V Don't call BUG_ON on file system failures. Instead use ext4_error and also handle the continue case properly. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- fs/ext4/mballoc.c | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index d062d08..9db0f4d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3737,20 +3737,23 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, bitmap_bh = ext4_read_block_bitmap(sb, group); if (bitmap_bh == NULL) { - /* error handling here */ - ext4_mb_release_desc(&e4b); - BUG_ON(bitmap_bh == NULL); + ext4_error(sb, __func__, "Error in reading block " + "bitmap for %lu\n", group); + return 0; } err = ext4_mb_load_buddy(sb, group, &e4b); - BUG_ON(err != 0); /* error handling here */ + if (err) { + ext4_error(sb, __func__, "Error in loading buddy " + "information for %lu\n", group); + put_bh(bitmap_bh); + return 0; + } if (needed == 0) needed = EXT4_BLOCKS_PER_GROUP(sb) + 1; - grp = ext4_get_group_info(sb, group); INIT_LIST_HEAD(&list); - ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); repeat: ext4_lock_group(sb, group); @@ -3907,13 +3910,18 @@ void ext4_mb_discard_inode_preallocations(struct inode *inode) ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); err = ext4_mb_load_buddy(sb, group, &e4b); - BUG_ON(err != 0); /* error handling here */ + if (err) { + ext4_error(sb, __func__, "Error in loading buddy " + "information for %lu\n", group); + continue; + } bitmap_bh = ext4_read_block_bitmap(sb, group); if (bitmap_bh == NULL) { - /* error handling here */ + ext4_error(sb, __func__, "Error in reading block " + "bitmap for %lu\n", group); ext4_mb_release_desc(&e4b); - BUG_ON(bitmap_bh == NULL); + continue; } ext4_lock_group(sb, group); @@ -4425,11 +4433,15 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode, count -= overflow; } bitmap_bh = ext4_read_block_bitmap(sb, block_group); - if (!bitmap_bh) + if (!bitmap_bh) { + err = -EIO; goto error_return; + } gdp = ext4_get_group_desc(sb, block_group, &gd_bh); - if (!gdp) + if (!gdp) { + err = -EIO; goto error_return; + } if (in_range(ext4_block_bitmap(sb, gdp), block, count) || in_range(ext4_inode_bitmap(sb, gdp), block, count) || -- 1.5.6.3.439.g1e10.dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids. 2008-07-23 17:10 ` [PATCH] ext4: Improve error handling in mballoc Aneesh Kumar K.V @ 2008-07-23 17:10 ` Aneesh Kumar K.V 0 siblings, 0 replies; 5+ messages in thread From: Aneesh Kumar K.V @ 2008-07-23 17:10 UTC (permalink / raw) To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V NR_CPUS can be really large. We should be using nr_cpu_ids instead. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- fs/ext4/mballoc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 9db0f4d..5b854b7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2541,7 +2541,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) sbi->s_mb_history_filter = EXT4_MB_HISTORY_DEFAULT; sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC; - i = sizeof(struct ext4_locality_group) * NR_CPUS; + i = sizeof(struct ext4_locality_group) * nr_cpu_ids; sbi->s_locality_groups = kmalloc(i, GFP_KERNEL); if (sbi->s_locality_groups == NULL) { clear_opt(sbi->s_mount_opt, MBALLOC); @@ -2549,7 +2549,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery) kfree(sbi->s_mb_maxs); return -ENOMEM; } - for (i = 0; i < NR_CPUS; i++) { + for (i = 0; i < nr_cpu_ids; i++) { struct ext4_locality_group *lg; lg = &sbi->s_locality_groups[i]; mutex_init(&lg->lg_mutex); -- 1.5.6.3.439.g1e10.dirty ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-23 17:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-07-22 13:17 [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids Aneesh Kumar K.V 2008-07-22 15:11 ` Eric Sandeen 2008-07-22 23:58 ` Andreas Dilger 2008-07-23 7:57 ` Aneesh Kumar K.V -- strict thread matches above, loose matches on Subject: below -- 2008-07-23 17:10 Patches for patchqueue Aneesh Kumar K.V 2008-07-23 17:10 ` [PATCH] ext4: Improve error handling in mballoc Aneesh Kumar K.V 2008-07-23 17:10 ` [PATCH] ext4: Convert the usage of NR_CPUS to nr_cpu_ids Aneesh Kumar K.V
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox