From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751833AbbG0Efw (ORCPT ); Mon, 27 Jul 2015 00:35:52 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:35881 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbbG0Efv (ORCPT ); Mon, 27 Jul 2015 00:35:51 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Nicolas Iooss Cc: Andy Lutomirski , Andrew Morton , linux-kernel@vger.kernel.org References: <1437875432-15502-1-git-send-email-nicolas.iooss_linux@m4x.org> Date: Sun, 26 Jul 2015 23:29:16 -0500 In-Reply-To: <1437875432-15502-1-git-send-email-nicolas.iooss_linux@m4x.org> (Nicolas Iooss's message of "Sun, 26 Jul 2015 09:50:32 +0800") Message-ID: <878ua26x5v.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX19+f7nCLT7OronOdtybMATqXyZLsj5s/5Y= X-SA-Exim-Connect-IP: 97.119.22.40 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Nicolas Iooss X-Spam-Relay-Country: X-Spam-Timing: total 325 ms - load_scoreonly_sql: 0.09 (0.0%), signal_user_changed: 8 (2.6%), b_tie_ro: 4.6 (1.4%), parse: 2.7 (0.8%), extract_message_metadata: 17 (5.3%), get_uri_detail_list: 1.25 (0.4%), tests_pri_-1000: 8 (2.4%), tests_pri_-950: 2.3 (0.7%), tests_pri_-900: 1.27 (0.4%), tests_pri_-400: 18 (5.7%), check_bayes: 17 (5.1%), b_tokenize: 5 (1.5%), b_tok_get_all: 5.0 (1.5%), b_comp_prob: 1.92 (0.6%), b_tok_touch_all: 2.3 (0.7%), b_finish: 0.90 (0.3%), tests_pri_0: 252 (77.5%), tests_pri_500: 8 (2.5%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] userns: simplify map_id_range_* functions X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nicolas Iooss writes: > Functions map_id_range_down, map_id_down and map_id_up all used the > construction: > > if (...) > id = ... > else > id = ... > return id; > > which can be simplified by directly returning the result of the > computations in each branch. > > Moreover as the condition tested whether the "break;" in the previous > for loop was hit, it is simpler to directly compute the result and > return it. It is not a simplification, it is just code motion. Further at least to my eyes adding multiple exit points and setting the same value in two different places actually obscures what the functions are doing. If we could talk about speeding up the performance of the stat system call I think there would be a point in mucking with these functions. As it is I think it is I think merging your patch will just make it more difficult to understand what the code is doing in the future, with no benefit except a reduction in line count. Eric