Re: [PATCH] Replaces two GOTO statements with one IF_ELSE statement in /fs/open.c

From: Bill Davidsen (davidsen_at_tmr.com)
Date: 06/21/05

  • Next message: Roman Zippel: "Re: [PATCH 1/6] new timeofday core subsystem for -mm (v.B3)"
    Date:	Mon, 20 Jun 2005 18:06:59 -0400
    To: Telemaque Ndizihiwe <telendiz@eircom.net>
    
    

    Telemaque Ndizihiwe wrote:
    >
    > This Patch replaces two GOTO statements and their corresponding LABELs
    > with one IF_ELSE statement in /fs/open.c, 2.6.12 kernel.
    > The patch keeps the same implementation of sys_open system call, it only
    > makes the code smaller and easy to read.

    Full credit with making the code more readable and maintainable. I'd
    like to look at the code generated to see if you have introduced a
    slowdown, however. My personal preference is for readable code and let
    the compiler sort it out, but I know there are people who would trade
    ugly code to save a cycle even in seldom-used code paths.

    You might like to see if "unlikely" halps the code, I won't have a
    recent compiler until tomorrow night, since I'm locked into AS3.0 (gcc
    3.2.3) today and tomorrow. Oops, I do have 3.3.2 on my lappie, but
    that's still old.

    >
    > Signed-off-by: Telemaque Ndizihiwe <telendiz@eircom.net>
    >
    >
    > --- linux-2.6.12/fs/open.c.orig 2005-06-20 15:15:52.000000000 +0100
    > +++ linux-2.6.12/fs/open.c 2005-06-20 15:38:47.580923552 +0100
    > @@ -945,19 +945,16 @@ asmlinkage long sys_open(const char __us
    > if (fd >= 0) {
    > struct file *f = filp_open(tmp, flags, mode);
    > error = PTR_ERR(f);
    > - if (IS_ERR(f))
    > - goto out_error;
    > - fd_install(fd, f);
    > + if (IS_ERR(f)) {
    > + put_unused_fd(fd);
    > + fd = error;
    > + } else {
    > + fd_install(fd, f);
    > + }
    > }
    > -out:
    > putname(tmp);
    > }
    > return fd;
    > -
    > -out_error:
    > - put_unused_fd(fd);
    > - fd = error;
    > - goto out;
    > }
    > EXPORT_SYMBOL_GPL(sys_open);
    >

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Roman Zippel: "Re: [PATCH 1/6] new timeofday core subsystem for -mm (v.B3)"

    Relevant Pages

    • Re: [parisc-linux] Re: [PATCH 3/9] mm: parisc pte atomicity
      ... using your own tmpalias area sounds much better than getting ... I've simply not wrapped my head around the races, ... it looks like we agree that my patch is necessary and valid as is; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: keyboard - was: Re: Linux 2.6.0-test4
      ... >> I was able to get the key unstuck by switching back and forth between ... I rebuild my kernel including your patch; ... I'll get back to you once I verify that the problem doesn't occur ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [CFT][PATCH] 2.6.4-rc1 remove x86 boot page tables
      ... > For VISWS I think you actually need to turn paging off explicitly. ... The patch will need a few tweaks but it should be fairly straight forward. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] clarify message and give support contact for non-GPL modules
      ... The author of the second module ... So here is another attempt at the patch. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • Re: [PATCH 4/5] random periodicity detection fix
      ... >> WAY overestimating input entropy. ... > My patch did the opposite of your patch: ... 5/5 is a step in that direction, but the filtering is ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)