Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1610960rda; Mon, 23 Oct 2023 19:36:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZj6UqFpSS1ZahsmyL2zmC0j4KUj+e3PgijxBnMUuJdewMBoEd7hJBE8DvWzJUH2T+WKVw X-Received: by 2002:a05:6358:72a0:b0:168:ce1d:5a51 with SMTP id w32-20020a05635872a000b00168ce1d5a51mr7827724rwf.4.1698114978079; Mon, 23 Oct 2023 19:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698114978; cv=none; d=google.com; s=arc-20160816; b=mC7D980IX59bVO2tj2kU5FODWzQZe38BFiYugX41pprQIScQnV25h4nYZukhvWqhKb 6X2y2w4TPQyaFnBcTFA6CFtk+qx3MPL2nzSbDc1wvcPSRRkF4bQdPycIK0vtb0uHhtXw UClx4kP/vJC4Abtrsl+DD7PvQGt5BuDgB8l76a6BMZ2W0h9L/f4YXtk0zjR2+7kIAwM5 v8UHwUkEAls3mfIqdKfeUcoqbwXV65OWSwfaKAvrNnQmqNJkwYDxYQ2k/UZFFeaN4ZaW gM93Q8UtyYirfAKBPvxAmXy7IiKpE06e4KHKsdDz0b5HMZ+94xRS+RDKxvzDavXHDXb7 Oc5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :in-reply-to:from:reply-to:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id; bh=fS0vku3+4Mmox7ujFprZdF32r6WNaY3W5aBVMGxaz7Q=; fh=7uEEV0mvuQuz94LvifuALXc56FDrsu3bADQx4R1FAcw=; b=jGlZsR3Wj7NzAbx6QD4wjFC9/owpQKFnd8F7dddjsp8A3gN1VJ3agiCwxQZ0Cskthg SokEkzQG7LUDshKCFe+kPD6jDEV5qw+eeRPhwnNr0D1yC+Wo/LbaxGbr/2N+FryAqaHJ cgg5CHvI2nkWUCfMESPAbZC2Q/sTFCLzXtAua+64XZfGnx2BWUVvqFs4WrJnzQWF4BLP n2bfRBYz9EAdxa8kyTI3Zur0ZIxb1otviydnkQT91Zk7epmSp03pcR3tjYyVaO2rjdDy ZZJV1JLL/4gdr/gXHTJV4CdmXl3iNyqemKzTyQMRho6UpBNBo6XtfmKOt2hxOL2IFQD1 Jugw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l18-20020a056a0016d200b006b7884dcd6csi7781061pfc.14.2023.10.23.19.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 65F3480774B9; Mon, 23 Oct 2023 19:36:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232140AbjJXCgE (ORCPT + 99 others); Mon, 23 Oct 2023 22:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbjJXCf6 (ORCPT ); Mon, 23 Oct 2023 22:35:58 -0400 Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A0210D5; Mon, 23 Oct 2023 19:35:48 -0700 (PDT) X-QQ-mid: bizesmtp73t1698114915tkuo0ka1 Received: from [10.7.13.54] ( [125.76.217.162]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 24 Oct 2023 10:35:14 +0800 (CST) X-QQ-SSF: 01400000000000D0H000000A0000000 X-QQ-FEAT: qOAV9bwDT/nXIhLNlbreDjkXisHowUo93uM1zLloz1/5xKJL9qlE3NGpd0W78 A/s9YfCC86SmwPdYzQN2MslwSfeV182xY0AeA7cT17jBY/g12N44CUoytNVmRXQTPl9OBhQ M6yIPEtkgpvVpJusF345wvhtz8BPHv0kj1nB4hnx6yDB28HyHFR2Bz8lPUIRZtIa/GIphrg cCLfhsuTC8XL7tb9tKitQDxuiAtywvsQiLfK3TkYMzINpHO5OY0pxTXi/IRy6POvClmBe1v OO9tBWakXA4RQxuZobacA5pqu8hpSDo1KByTCabd+1rFJCI3baHnGGuvRPP8BuvXgkL+75H Fp4ADB+DLD8icPq2kkPlpsH8vCMWdgphzfkP/XCFHAMfhb7GgiDopy7aYreeAsdw+PtckOc X-QQ-GoodBg: 1 X-BIZMAIL-ID: 6538827013053437973 Message-ID: <4CEE0B491E07CA77+c77a8b3d-095b-b33c-0091-dcb55fd40d28@uniontech.com> Date: Tue, 24 Oct 2023 10:35:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] ext4: delete redundant calculations in ext4_mb_get_buddy_page_lock() To: Jan Kara Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, gouhaojake@163.com References: <20231023013416.17246-1-gouhao@uniontech.com> <20231023114447.crn3bt4qdmkxkrxi@quack3> Content-Language: en-US Reply-To: 20231023114447.crn3bt4qdmkxkrxi@quack3 From: Gou Hao In-Reply-To: <20231023114447.crn3bt4qdmkxkrxi@quack3> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvrgz:qybglogicsvrgz7a-0 X-Spam-Status: No, score=-2.5 required=5.0 tests=FORGED_MUA_MOZILLA, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 23 Oct 2023 19:36:11 -0700 (PDT) On 10/23/23 19:44, Jan Kara wrote: > On Mon 23-10-23 09:34:16, Gou Hao wrote: >> 'blocks_per_page' is always 1 after 'if (blocks_per_page >= 2)', >> 'pnum' and 'block' is equal in this case. >> >> Signed-off-by: Gou Hao >> Signed-off-by: Gou Hao > No need for two signed-off-by here. Any one from you is enough :) ok >> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c >> index 454d5612641e..8442f5474b25 100644 >> --- a/fs/ext4/mballoc.c >> +++ b/fs/ext4/mballoc.c >> @@ -1456,9 +1456,7 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb, >> return 0; >> } >> >> - block++; >> - pnum = block / blocks_per_page; >> - page = find_or_create_page(inode->i_mapping, pnum, gfp); >> + page = find_or_create_page(inode->i_mapping, ++block, gfp); > ^^^ perhaps just > "block + 1" here? Maybe also add a comment before this call like: Yes, 'block +1' is better here, i will add a comment. Thanks for your review. > /* blocks_per_page == 1, hence we need another page for the buddy */ > > Otherwise the patch looks good! > > Honza > -- thanks, Gou Hao