From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (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 9F08614A91 for ; Mon, 13 Jan 2025 01:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736732895; cv=none; b=dtjlJ/jMUCqo6miAxT+/Z+6JALvUoKlHwmAP6z0WUXweiFlPa6JGQUo4v8YYRdAIbb+C7Z0Z3N0VvmoDz3f/ojQRMsgkjvBmq5CPzSmkZoPsuPXXoeWXUl0j9nvzPq+Mv9gDY3aSkYrvXrDJytd356/FHQobY2ZJkg939gXzcac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736732895; c=relaxed/simple; bh=gdp3WcPT8G5+xNZGdq5ifaMptulIy2GYHJ0pWQ1EZ94=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BQTmZVtYrUzZwTBuI9uGfJWcUJsMT5u7JuWYLQw3xYQclZDQBWMgNayG7s0rhOnA8rv/LdPgA8D6pLeqgR8YMQ8cBYPiok0AZeUZqFArCwi74L5CPnFGorcqmKOOdOqPuUQyrpxH48YvUmEVb6hoS+TAUbqSy3+rK0ZOv7E/nGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from SHSQR01.spreadtrum.com (localhost [127.0.0.2] (may be forged)) by SHSQR01.spreadtrum.com with ESMTP id 50D1m9O3036829 for ; Mon, 13 Jan 2025 09:48:09 +0800 (+08) (envelope-from Yi.Sun@unisoc.com) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 50D1l98o026645; Mon, 13 Jan 2025 09:47:09 +0800 (+08) (envelope-from Yi.Sun@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4YWZmd6N0hz2NqSDq; Mon, 13 Jan 2025 09:44:01 +0800 (CST) Received: from tj10379pcu1.spreadtrum.com (10.5.32.15) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 13 Jan 2025 09:47:04 +0800 From: Yi Sun To: , , CC: , , , , , Subject: [PATCH] f2fs: Clean up the loop outside of f2fs_invalidate_blocks() Date: Mon, 13 Jan 2025 09:47:02 +0800 Message-ID: <20250113014702.2312729-1-yi.sun@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL:SHSQR01.spreadtrum.com 50D1l98o026645 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 --- 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); -- 2.25.1