From nobody Mon Nov 25 07:40:46 2024 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 1FC9814A85 for ; Tue, 29 Oct 2024 00:57:10 +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=1730163431; cv=none; b=Rj+0mWoxpKsNK5NImKsdZXGO5vvKBPiAFC9MoAI31qGxf/uGLK2ldel0MHMSah7qww/S1evKclqE7Htt/C1EPIboQdTUdw0LjRCn8pS/rYRzauDJV0d5Rvondv1YbS8h7/+jey5Rd9wtG/U8TjPUqwByISU4RYLl4mg0lxVWe+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730163431; c=relaxed/simple; bh=6amym9LlHgYwByTv/LTLrRmuOSWhxeY3BdEsJPngSbc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hu0HCwI1H4keMmRxLmxx1U4bq+hsmB9itAKFHsrfAIsl7JrGfx5kV5YnjJjErwZAWnAh6Ur+aTkWCeW/PI3ISnMUPyghwe4qZIGVXBh7Y1aCjbW8L1q0pIJWNx51PK/TgG6tAVXHa1iHfnu7h40u/6TVhKDZXWQAenALQfczaj8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PEJh+6j1; 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="PEJh+6j1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8950BC4CEC3; Tue, 29 Oct 2024 00:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730163430; bh=6amym9LlHgYwByTv/LTLrRmuOSWhxeY3BdEsJPngSbc=; h=From:To:Cc:Subject:Date:From; b=PEJh+6j1uzmIWwsg1KEBFZbhqFCmGz+qAxX0fbbKWXZgJsIoGJgQmJqdM1c2C2YGD 2LuMhgn/UcLyLrmPAFBkDYHrpm0/mmPh8uegUGuiCad/Dk+INKP6yDvkBRrknWomg6 KZAnDCKS78/5rJK3Fr8atpSIpHUIalTHQtzTihdBMCvv7vaNTPmKWo5/HODVD5TH+G ZO6vCDHk6vMRXowImBZmsojxZsS1C48VWYqGvUnP17JU1/MEUaTGo8L2IGtYIMu9/a 1qftTiEO6YaU5rySc44IT/hP/KzNRYe4mVxKdeKFo3AOYdE+UFrfmDZIPx4za5sV8P tQDPQ5tAJApMg== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH] f2fs: clean up opened code w/ {get,set}_nid() Date: Tue, 29 Oct 2024 08:57:03 +0800 Message-Id: <20241029005703.2740230-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Just cleanup, no logic change. Signed-off-by: Chao Yu --- fs/f2fs/node.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index af36c6d6542b..7d904f2bd5b6 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1066,7 +1066,7 @@ static int truncate_partial_nodes(struct dnode_of_dat= a *dn, int i; int idx =3D depth - 2; =20 - nid[0] =3D le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); + nid[0] =3D get_nid(dn->inode_page, offset[0], true); if (!nid[0]) return 0; =20 @@ -1177,7 +1177,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, p= goff_t from) =20 skip_partial: while (cont) { - dn.nid =3D le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); + dn.nid =3D get_nid(page, offset[0], true); switch (offset[0]) { case NODE_DIR1_BLOCK: case NODE_DIR2_BLOCK: @@ -1209,13 +1209,10 @@ int f2fs_truncate_inode_blocks(struct inode *inode,= pgoff_t from) } if (err < 0) goto fail; - if (offset[1] =3D=3D 0 && - ri->i_nid[offset[0] - NODE_DIR1_BLOCK]) { + if (offset[1] =3D=3D 0 && get_nid(page, offset[0], true)) { lock_page(page); BUG_ON(page->mapping !=3D NODE_MAPPING(sbi)); - f2fs_wait_on_page_writeback(page, NODE, true, true); - ri->i_nid[offset[0] - NODE_DIR1_BLOCK] =3D 0; - set_page_dirty(page); + set_nid(page, offset[0], 0, true); unlock_page(page); } offset[1] =3D 0; --=20 2.40.1