Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6872991rdb; Tue, 2 Jan 2024 17:27:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVH40iZR6pRklYOc/Pci7uYM52qZt8I0jbA8csRD44yK8hzf6b7Ezeya1kACIWbqYoRltT X-Received: by 2002:a05:620a:40c2:b0:781:65d0:5d5c with SMTP id g2-20020a05620a40c200b0078165d05d5cmr13834483qko.38.1704245263453; Tue, 02 Jan 2024 17:27:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704245263; cv=none; d=google.com; s=arc-20160816; b=w8tbpinZMvy09p6+6ssF5HSn2urT01psXe644k95gURs1Blv1f2mUtynnVXcjVmmsD D2FUI5LNd/Bft+ydEyXjkamSCmoLsgfQWIKMFeCE6vAL4LQCwF6IOz3QIaOSAimoh70s DbGrvug0Ih5p8dpDPoNeJH6fXbTAt1nMZMAmyoie11aN2s6j8Ar36ip+tB9ZkHMzikHk +mp/Zy3jzUvsmsCaAf47pAA0nPOYk0Y8tLpFE7Cj/8TA6w9xYE26NjzmbRk/i2PRIB7h SPj7/rtVpLSljovJmJy/W3lYgs3T4FO/6HRILpA2LuV4bAq0yKt98R3M9LD5Hxp9cicb 4eew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=vEV4XLN16uTe2CYu7NB45IcxcD3LhUpCoePw1PmLqDM=; fh=yDAxNfGVxo91E0b+Kid+EVbIxT4woOfLp7aBbtj7wTE=; b=gQHfDBUtkmnr58gYyARpqDoosDL+XFUQI7Gu06wT3ZPv4SE3c9TX2yZ1scZJ1Wbon/ XViL4pBClwBC+r2vAeGvOdMUZ3IYS/7mXp6IYuZjMq5DTR8QAJ2NbSK5hOih/dy6sO5N HGy0jllW3drpGKjQjobroiubV4HferC5Je2VQIVm9dMg38a3aVCc2EiY+5/Dz16mdC53 mLgPwNnJBkgPDyoKlo/nJiKMxDPsnb+bNh3HhhVGX7Qx16KyfU7KjAdRC5PZ7912DkqO GIQrQTEvrW1dJkom7sR+qbH+gSCNDSXo5P2H6jCDYyxnDs+Z3eosBLphKemdGP6JaBkr 0Duw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-630-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e4-20020a05620a014400b00781565bc683si16772125qkn.203.2024.01.02.17.27.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 17:27:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-630-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 392A11C21A17 for ; Wed, 3 Jan 2024 01:27:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1DCF10F1; Wed, 3 Jan 2024 01:27:37 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01345136B; Wed, 3 Jan 2024 01:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4T4XC13vzDz4f3p0h; Wed, 3 Jan 2024 09:27:25 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id 34D5A1A0980; Wed, 3 Jan 2024 09:27:31 +0800 (CST) Received: from [10.174.178.129] (unknown [10.174.178.129]) by APP2 (Coremail) with SMTP id Syh0CgDHaEcCuJRlaO8AFg--.64435S2; Wed, 03 Jan 2024 09:27:31 +0800 (CST) Subject: Re: [PATCH 8/8] ext4: remove unnecessary parameter "needed" in ext4_discard_preallocations To: Jan Kara Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231125161143.3945726-1-shikemeng@huaweicloud.com> <20231125161143.3945726-9-shikemeng@huaweicloud.com> <20240102131058.3ue6phafczjezlic@quack3> From: Kemeng Shi Message-ID: <48611a18-004f-7721-cc1f-104a5980b6cf@huaweicloud.com> Date: Wed, 3 Jan 2024 09:27:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240102131058.3ue6phafczjezlic@quack3> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit X-CM-TRANSID:Syh0CgDHaEcCuJRlaO8AFg--.64435S2 X-Coremail-Antispam: 1UD129KBjvJXoW7ur4fWFWUJF4kC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sun 26-11-23 00:11:43, Kemeng Shi wrote: >> The "needed" controls the number of ext4_prealloc_space to discard in >> ext4_discard_preallocations. Function ext4_discard_preallocations is >> supposed to discard all non-used preallocated blocks when "needed" >> is 0 and now ext4_discard_preallocations is always called with "needed" >> = 0. Remove unnecessary parameter "needed" and remove all non-used >> preallocated spaces in ext4_discard_preallocations to simplify the >> code. >> >> Note: If count of non-used preallocated spaces could be more than >> UINT_MAX, there was a memory leak as some non-used preallocated >> spaces are left unused and this commit will fix it. Otherwise, >> there is no behavior change. >> >> Signed-off-by: Kemeng Shi > > Looks good, just one nit: > >> @@ -5491,15 +5491,12 @@ void ext4_discard_preallocations(struct inode *inode, unsigned int needed) >> mb_debug(sb, "discard preallocation for inode %lu\n", >> inode->i_ino); >> trace_ext4_discard_preallocations(inode, >> - atomic_read(&ei->i_prealloc_active), needed); >> - >> - if (needed == 0) >> - needed = UINT_MAX; >> + atomic_read(&ei->i_prealloc_active), 0); > > There's no point in always returning 0 in the tracepoint so I'd just update > it to not print the 'needed' value as well. Thanks for review! Sure, 'needed' looks meaningless to the tracepoint. I will remove it in next version. > > Honza >