From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BDB6B2DF3DC; Tue, 17 Jun 2025 10:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750157739; cv=none; b=nVvz2vucFnARRSh7FfJ23Our7BnWiu0ts2RN4a4p9EhS49BBJ49P+O2hunUckQ5I7xVFQmzzzT4VfY+jk6LsiS3mQDq8KBvNAGaK/9E5DjgSFTGwVtu22QUPLK6CjynssMIjvgvc4Dlo0frjYPymwXGK+xgcZVNGAI4JSl7DQaE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750157739; c=relaxed/simple; bh=piGUlZs6zoqvMmQRMCoMo1mo2QIcIa0CWfSvAlwBOJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rAM3Z1iTYpLui3iHkaysl2+Dj2iFkPPq0DlJqKTis3oCgzhvV1jbbcaWuUju/v9Cowtw08fEgXIOhiCSxzZM4uAAqL70EepcSA2fTVUmiwVFnG/ImHRrZ9IIszkOOFIKYZIy8pD7zQagxqoBvJM2arGTRDWfr4KjOND5Xc7pVXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GNyj8P/u; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GNyj8P/u" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=6v0sZv7nf6Xu5O/IPY688bDor4jZ62GKSKadjpo/7JA=; b=GNyj8P/uBnOCjALmPZqAS/O2FT AO5UPczbuYYoEQMjSHkqCnfyRIcJD8qmTA5Plp5QQr2dPaznQoMll1CujPuXRU+FJJBfKlgzZCowZ xVjmja0yftmJejj6f4KOhtqdVy+LBxIYYi7OCK9dg+Jr07uWhc7fAiqs8/TeRuN+yqbwNk+Iv+dTJ M6SHqZ7+5BiOyn0CVLqEWHF7dNoVqgtDhXdkl/V7AiU1UYJ6tGXH9fA2SZtM0VbdAFbB5GcGjaB0S XJ0AgWlsQgxpQ3i6+zKWStHHBVJyQ+obRbhb6g3FTojD2lauvKnh+6V0i63CaBstbKQxHGuOef6xQ XTv1RK2g==; Received: from 2a02-8389-2341-5b80-d601-7564-c2e0-491c.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:d601:7564:c2e0:491c] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1uRTyb-00000006yqx-0ZnI; Tue, 17 Jun 2025 10:55:37 +0000 From: Christoph Hellwig To: Christian Brauner Cc: "Darrick J. Wong" , Joanne Koong , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-block@vger.kernel.org, gfs2@lists.linux.dev Subject: [PATCH 08/11] iomap: move folio_unlock out of iomap_writeback_folio Date: Tue, 17 Jun 2025 12:55:07 +0200 Message-ID: <20250617105514.3393938-9-hch@lst.de> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250617105514.3393938-1-hch@lst.de> References: <20250617105514.3393938-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html From: Joanne Koong Move unlocking the folio out of iomap_writeback_folio into the caller. This means the end writeback machinery is now run with the folio locked when no writeback happend, or writeback completed extremely fast. This prepares for exporting iomap_writeback_folio for use in folio laundering. Signed-off-by: Joanne Koong [hch: split from a larger patch] Signed-off-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index c6bbee68812e..2973fced2a52 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1656,10 +1656,8 @@ static int iomap_writeback_folio(struct iomap_writepage_ctx *wpc, trace_iomap_writepage(inode, pos, folio_size(folio)); - if (!iomap_writeback_handle_eof(folio, inode, &end_pos)) { - folio_unlock(folio); + if (!iomap_writeback_handle_eof(folio, inode, &end_pos)) return 0; - } WARN_ON_ONCE(end_pos <= pos); if (i_blocks_per_folio(inode, folio) > 1) { @@ -1713,7 +1711,6 @@ static int iomap_writeback_folio(struct iomap_writepage_ctx *wpc, * already at this point. In that case we need to clear the writeback * bit ourselves right after unlocking the page. */ - folio_unlock(folio); if (ifs) { if (atomic_dec_and_test(&ifs->write_bytes_pending)) folio_end_writeback(folio); @@ -1740,8 +1737,10 @@ iomap_writepages(struct iomap_writepage_ctx *wpc) PF_MEMALLOC)) return -EIO; - while ((folio = writeback_iter(mapping, wpc->wbc, folio, &error))) + while ((folio = writeback_iter(mapping, wpc->wbc, folio, &error))) { error = iomap_writeback_folio(wpc, folio); + folio_unlock(folio); + } /* * If @error is non-zero, it means that we have a situation where some -- 2.47.2