From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0669F1C3054 for ; Wed, 22 Jan 2025 07:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737532800; cv=none; b=G5rYkumfVRFl/3mVxwVq4HR3WehWverJYHiwQXKnVYzLPXh5DOVNJNqAOiw9EXNtp8dmb2GjUsxMbt9/2lOxw7F3IOmj/gTiMzpCOK78WfBNxXBeLbcmcZJDAToM8kjLMRuLz5ss7O8johl37En88Ow5anct0lEJOXM/t9PnQaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737532800; c=relaxed/simple; bh=XZR+Lbwn+51cbpVcvb76qT7XPGh3f1kyTvqwCNl0mJs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=ZbjwkUEAqkuIrZeov8rNdFgwv+dPQyMypeGjyLzaM87+kPLtZa9oUpFWwoOCTbnBkDmZKo8JgDg4zZOL6enNtTYW6/mhcMF3G9t89gGwDiYIBKOA9iPpaUefJEgRjobBMVQq7pDOdkDQ8twudseJkW4gHHcrRW0pgtBaH4ZsVL0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oMDvrbOe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oMDvrbOe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2BA1C4CEE2; Wed, 22 Jan 2025 07:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737532799; bh=XZR+Lbwn+51cbpVcvb76qT7XPGh3f1kyTvqwCNl0mJs=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=oMDvrbOeq10HjGz3L5X5Qqe8oZ8csuaOljpkO8pzyfVtNKt7BnaN62rBx+RXNxMSm 4fELTetbhpp2k1m3vGdLp5JF4ZlrTW+sVFk3rG0hTCkNxs8drjEIPon01xjDz1herF EfhvDyF72WUouRCg4pdp7wQs9bBVUwY5UkUR3FoT8jLKj2XJqgURT4XmIq4G/ogbQB BE7mJw8+8LmFJ8N0BRyUvkBhdfUmnBRcLsQ73hGEVBvkgcPEzcsn9rvLkxTOEtjtlK p4QRPLOJjG4+StFLZlOJKR1ie5GeQ18RZs98AvR9TlwlTKiUo5cZ1SWBRY4RAMi1Ju GJ/yfUIUfaslg== Message-ID: <63bb967d-5464-4d6b-9daa-7059608bfba2@kernel.org> Date: Wed, 22 Jan 2025 15:59:55 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, Ke.Wang@unisoc.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Hao_hao.Wang@unisoc.com, niuzhiguo84@gmail.com, zhiguo.niu@unisoc.com Subject: Re: [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks() To: Yi Sun , jaegeuk@kernel.org References: <20250113014702.2312729-1-yi.sun@unisoc.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20250113014702.2312729-1-yi.sun@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/13/25 09:47, Yi Sun wrote: > Now f2fs_invalidate_blocks() supports a continuous range of addresses, > so the for loop can be omitted. > > Signed-off-by: Yi Sun > Signed-off-by: Zhiguo Niu Actually, this can be merged into "f2fs: add parameter @len to f2fs_invalidate_blocks()", but, anyway, I guess it's fine to merge it separately. Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/file.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 9980d17ef9f5..4baafad7a00c 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -811,10 +811,8 @@ int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock) > if (IS_DEVICE_ALIASING(inode)) { > struct extent_tree *et = F2FS_I(inode)->extent_tree[EX_READ]; > struct extent_info ei = et->largest; > - unsigned int i; > > - for (i = 0; i < ei.len; i++) > - f2fs_invalidate_blocks(sbi, ei.blk + i, 1); > + f2fs_invalidate_blocks(sbi, ei.blk, ei.len); > > dec_valid_block_count(sbi, inode, ei.len); > f2fs_update_time(sbi, REQ_TIME);