Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2491211lqp; Sun, 24 Mar 2024 23:22:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWM16ZZmXDdQo7ElpZPtHD3xzkyD2tZTMc+vKUuDAzV13wgUtQfBxTEhFldzo7RhtGvuUFaIfCWNXBGbUtvYDYX/YzomZdqMDIdsgs8vw== X-Google-Smtp-Source: AGHT+IHoEweSRtRBoKiUleA1QYv1EbfxtfmNMp5pFFELCM3m1W+jPNjcrXs8RFpYaXtWnqLWdh/N X-Received: by 2002:a50:a6d1:0:b0:56a:ae8a:acc0 with SMTP id f17-20020a50a6d1000000b0056aae8aacc0mr393401edc.21.1711347726096; Sun, 24 Mar 2024 23:22:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711347726; cv=pass; d=google.com; s=arc-20160816; b=o615v84rNL7QEb+t3aAZfQOjBK6pau6MKi3t6agM0hAEuZOCmIvKsR34aDEuWeEr2g YtQnnjS7f3Kd48d1LuvDRYEeyMvbWTceEFwirfM++MVjd3Wj0+nb8X9FChyNXPfrap+3 8GpCNfm/v0gewdKmRCGgttJPcH4pqU7ceskLl4fAZtpe+grPV2uXV4I0+eVUARUXtMkf gFeBTn8SMuGhrTiUrtU8ByT474oKl1u5+fr4CzLWUxkshp6F0U1MoRKXnP4CNdc0lhaN bYz+WgHQFC9S49YJi9O1IBK+W7rOdOZ6DEtZYGSowa7y8vhTylIH1BgoKpyW02F8LpQg d9ZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XHNH+XgZ+k9MxDRdIk/ku33zZgo72NViu6n5cOWdaQo=; fh=VrFMvxek0+GuQS0wC75gZU93O1f1h+mWV67JX/ATMjc=; b=w3wD23R1gQp5noOJzlL96GnOGgn7APcTe+PrZEAA7goSVXPK7bKQuJctXi9qTL/cv4 2m6qkpKS4Qw5Kc2FvEi4heNwJbUJ6Ilme7Mgmm3aVG/7aT2blofFUU4AKVmQGaNa+IYG D1YBhYOSU2uBhyQn5AO7Oq9xuCLkpAApHV8ooplm02mE6eXYncbHMrTXSDkwdr86iv6Y tCv71i0+lmOOokL0PYVGIV+5WyJM/KSrY008y6HKijYc2/VZYcvvO7fLnBf1cMWbMZxs /FnAgl5CTeqMZKwvMat+241bMW+ewpYG66d5pQ90EFxGg6rWoJwwHp5qdi93eX6716Om FHRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nrmHdHSl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z11-20020a056402274b00b0056bfa690942si1906596edd.548.2024.03.24.23.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nrmHdHSl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114614-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1DF211F2BE0D for ; Mon, 25 Mar 2024 06:20:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A63A2A2B3F; Sun, 24 Mar 2024 23:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nrmHdHSl" 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 CAF9A14D458; Sun, 24 Mar 2024 23:17:53 +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=1711322273; cv=none; b=T7phn0/u5Om7nC/tr2yPYtHah8+aqXQJPLtYnS8zq/g+0aLW5lKgVh7DSKmO4UBLq0Da5a1xfdsd/XNzAzzYuDEslHgOBsrcdMKdkxcaokL4sd46UCBzgmivN7J0Eh9s8IA8JMFDHiEb2ZG/079034cCrlyqi1/+PQ6zqhyI4G8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322273; c=relaxed/simple; bh=F8H3HJDHsxovhZt1b8ulvrfsnrUvjn3+y6E72couSek=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GRbI+JNF4WO+9tLfsr4P6H/Zsm40E+7ELZVS+tqoCenKntRyhUaIQUSl6GxPXwiYfcvIQert/7IS8YS7pgm8SnkXFBLwH5OyGg/nvrMethAn3/PKYjKRhsEclZRkODf/+lFNGe8w/tKoL54fzMZdFHHAQyYVcnnGu1XnSBtXP+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nrmHdHSl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F038EC43390; Sun, 24 Mar 2024 23:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322273; bh=F8H3HJDHsxovhZt1b8ulvrfsnrUvjn3+y6E72couSek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nrmHdHSlKD3Csp1LaxfXcToD8Tm0XtMbKb1Ji/Az18XCQPEYrmgAY61/B2BXrXeHs /RJOsUXFOlVwVZ3X+5C8+JI28dMS1JbZrumukGYMk5ShMBZZfGDPiwFJ8XYOyi4cBH iPjqx0bf36cCsERnQfJbspIt8gaIyGfqk4WxnWA0LpZ+yPAW4NBGcP1LuPbqLTbc4O QM9a7g8x2Kmuy6pEreLmOBH6NHbmOfAOEwtw83nPMomZqRj+RImO/+et5M4btQqDzO Ufqn0PNRemqypeA/022TgNhmpi4x4BXLGhrtr8rFc1NPu6F2pViz26+kCqoGX8dXEG CDpHj9E6F109g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.1 356/451] f2fs: simplify __allocate_data_block Date: Sun, 24 Mar 2024 19:10:32 -0400 Message-ID: <20240324231207.1351418-357-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Christoph Hellwig [ Upstream commit 3cf684f2f8e0229714fb6d051508b42d3320e78f ] Just use a simple if block for the conditional call to inc_valid_block_count. Signed-off-by: Christoph Hellwig Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode") Signed-off-by: Sasha Levin --- fs/f2fs/data.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 3f0ba71451c27..77b825fdeec85 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1420,13 +1420,12 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type) return err; dn->data_blkaddr = f2fs_data_blkaddr(dn); - if (dn->data_blkaddr != NULL_ADDR) - goto alloc; - - if (unlikely((err = inc_valid_block_count(sbi, dn->inode, &count)))) - return err; + if (dn->data_blkaddr == NULL_ADDR) { + err = inc_valid_block_count(sbi, dn->inode, &count); + if (unlikely(err)) + return err; + } -alloc: set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); old_blkaddr = dn->data_blkaddr; f2fs_allocate_data_block(sbi, NULL, old_blkaddr, &dn->data_blkaddr, -- 2.43.0