lkml.org 
[lkml]   [2007]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 09/23] lib: percpu_counter_init error handling
    From
    Date
    On Fri, 2007-08-17 at 11:56 -0400, Josef Sipek wrote:
    > On Thu, Aug 16, 2007 at 09:45:34AM +0200, Peter Zijlstra wrote:
    > )
    > > @@ -996,12 +997,16 @@ static int ext2_fill_super(struct super_
    > > sbi->s_rsv_window_head.rsv_goal_size = 0;
    > > ext2_rsv_window_add(sb, &sbi->s_rsv_window_head);
    > >
    > > - percpu_counter_init(&sbi->s_freeblocks_counter,
    > > + err = percpu_counter_init(&sbi->s_freeblocks_counter,
    > > ext2_count_free_blocks(sb));
    > > - percpu_counter_init(&sbi->s_freeinodes_counter,
    > > + err |= percpu_counter_init(&sbi->s_freeinodes_counter,
    > > ext2_count_free_inodes(sb));
    > > - percpu_counter_init(&sbi->s_dirs_counter,
    > > + err |= percpu_counter_init(&sbi->s_dirs_counter,
    > > ext2_count_dirs(sb));
    > > + if (err) {
    > > + printk(KERN_ERR "EXT2-fs: insufficient memory\n");
    > > + goto failed_mount3;
    > > + }
    >
    > Can percpu_counter_init fail with only one error code? If not, the error
    > code potentially used in future at failed_mount3 could be nonsensical
    > because of the bitwise or-ing.

    I guess I could have written saner code :-/ will try to come up with
    something that is both clear and short.
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2007-08-17 18:05    [W:0.021 / U:0.296 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site