From nobody Sun Feb 8 12:52:34 2026 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 924E0EAFA for ; Wed, 23 Apr 2025 08:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745398300; cv=none; b=djNFggs0ate/wbfvgxSyM+kiE9Wnwp/RMZv4KW8dfrD1O6J1feprgUMRbmi+PMGmKpQbpfTb1cRm685VL+RU0a95fnYZRoY30x/dDw+UW6S8QXLGg3R/dLsk1dUQTUTbv8r+z4N31KaJ1lRlD6Yuo7DPqsCdsmhuG8En/mDqGU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745398300; c=relaxed/simple; bh=D9/V6BAueUg9tsVWiAKhJtuIZPIfkAkNRDK1THCBbok=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D1ZmKCDCJa3xsZfFgwE9VsllpKJqCtO6pIFkhOAp9+7jh6ofd0xOAvBdnTvHntIZUHe9aM2RrOzrMoGL51VtrrzLBHhAqT9e/WOi/ShvD49dHorfzTXypHgZllYVQCmbFlJ63J4xr1Lm1lL4xeKVWhh2lIH1QG/DMmSxLnwGp1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=lyhT9U2A; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=lyhT9U2A; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="lyhT9U2A"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="lyhT9U2A" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BA8CF1F38E; Wed, 23 Apr 2025 08:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1745398294; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X5lbL4HDSH9vg67l6nnz0LvwIaQuYIbLmkbq1JnPLTA=; b=lyhT9U2AGkr1mpZaSRj9kNj/fvdSvjeEG6GhR+fgtnVXeSP8vAH2SOqf+xVdPo/0DMjW1d OfJgB6dls0uUyfjqM1XMJwgVW+mzFn2MHddHQ/9n2g5R4U91CEKldQoaV2jEY51JVgoglC 3fvUfRuB/mxE1rNpOzHyGzGRyf1c5f0= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1745398294; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=X5lbL4HDSH9vg67l6nnz0LvwIaQuYIbLmkbq1JnPLTA=; b=lyhT9U2AGkr1mpZaSRj9kNj/fvdSvjeEG6GhR+fgtnVXeSP8vAH2SOqf+xVdPo/0DMjW1d OfJgB6dls0uUyfjqM1XMJwgVW+mzFn2MHddHQ/9n2g5R4U91CEKldQoaV2jEY51JVgoglC 3fvUfRuB/mxE1rNpOzHyGzGRyf1c5f0= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A4EB613A3D; Wed, 23 Apr 2025 08:51:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id U1LKJxaqCGjvfwAAD6G6ig (envelope-from ); Wed, 23 Apr 2025 08:51:34 +0000 From: Daniel Vacek To: Chris Mason , Josef Bacik , David Sterba Cc: Daniel Vacek , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] btrfs: a small cleanup in attach_eb_folio_to_filemap() Date: Wed, 23 Apr 2025 10:51:22 +0200 Message-ID: <20250423085123.4029320-1-neelx@suse.com> X-Mailer: git-send-email 2.47.2 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 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: Content-Type: text/plain; charset="utf-8" This is just a trivial change. The code looks a bit more readable this way,= IMO. Signed-off-by: Daniel Vacek Reviewed-by: David Sterba --- fs/btrfs/extent_io.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 7023dd527d3e7..cab4cc5583400 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3139,7 +3139,7 @@ static int attach_eb_folio_to_filemap(struct extent_b= uffer *eb, int i, struct btrfs_fs_info *fs_info =3D eb->fs_info; struct address_space *mapping =3D fs_info->btree_inode->i_mapping; const unsigned long index =3D eb->start >> PAGE_SHIFT; - struct folio *existing_folio =3D NULL; + struct folio *existing_folio; int ret; =20 ASSERT(found_eb_ret); @@ -3148,6 +3148,7 @@ static int attach_eb_folio_to_filemap(struct extent_b= uffer *eb, int i, ASSERT(eb->folios[i]); =20 retry: + existing_folio =3D NULL; ret =3D filemap_add_folio(mapping, eb->folios[i], index + i, GFP_NOFS | __GFP_NOFAIL); if (!ret) @@ -3155,10 +3156,8 @@ static int attach_eb_folio_to_filemap(struct extent_= buffer *eb, int i, =20 existing_folio =3D filemap_lock_folio(mapping, index + i); /* The page cache only exists for a very short time, just retry. */ - if (IS_ERR(existing_folio)) { - existing_folio =3D NULL; + if (IS_ERR(existing_folio)) goto retry; - } =20 /* For now, we should only have single-page folios for btree inode. */ ASSERT(folio_nr_pages(existing_folio) =3D=3D 1); --=20 2.47.2