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 EB3E23B52EB; Thu, 9 Apr 2026 16:03:13 +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=1775750595; cv=none; b=i9R5wUrWV0WG/IIlLFb2hRcVKfPCh91Dte+e8SKOUzqwsyaguhJQrHdVVqKjFYROND2VB1UMgOxkFTbqFCNLPA0AtYLyuO6jblL9CuyN1/jAoFfuDVT68W6t1Pm6GXq6jwnLZN5qHeXZrpEtV0xQp4SDyDegq+lsCcrb5oUudng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775750595; c=relaxed/simple; bh=XBV8A5x4O/lGnRTQl5M7AwFOAPOqCch9GmW9n2h2EQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ss7TAzos1FjX+r44V6QqnvQsBkj12N7qO1AgUJHgyzA9iaFGkQDdka8hdwgRn2Qms9jfcKR35n72F5E63H4cq4oECpOUHg9UMMqn7MCGoS2lGIjnoco4schslbtlZI46akD6ZsirWoYJThYZvOGJRfYTGXfPOfgf7DhyKorq0/Q= 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=3F3zcy+V; 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="3F3zcy+V" 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=UxZjZnt4HjRp1aOZHRD4KUmIrZeKTs6gBzw7HkJfrWs=; b=3F3zcy+Vfnn+iIk21Q50Vn0NAO Kxz/C96sZAacyVUlsx/NwKWbVCP6XH38MRwhySAW1NADMxHtNSXg33CaFaKkMAvaLv5RXUakaDTfV jEDqCCRNoH3LF4/qTXm0kdMgccpsqIofPS+KGFVKpaqqzC3IOrpClTxvgVSlHSHHsQYzvmjebFhDx qlNGxYoKHMnwpS0ELkP1LXDCDD7V0nQbfE3uSDqaG8wHH/6H2O6n6Pt8xXn9jBfh0ICR/75SIOLyA 7qtN/ho/XjtBlYwj20NQ22uugbOsualVMrURjmEVr77rW3lkG567PhF3Ah1+0H/RAem4oueJ5cH+u a52yIa5A==; 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 1wArqY-0000000At3S-0RLo; Thu, 09 Apr 2026 16:03:10 +0000 From: Christoph Hellwig To: Tal Zussman , Jens Axboe , "Matthew Wilcox (Oracle)" , Christian Brauner , "Darrick J. Wong" , Carlos Maiolino , Al Viro , Jan Kara Cc: Dave Chinner , Bart Van Assche , Gao Xiang , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/8] iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback Date: Thu, 9 Apr 2026 18:02:15 +0200 Message-ID: <20260409160243.1008358-3-hch@lst.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409160243.1008358-1-hch@lst.de> References: <20260409160243.1008358-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@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: Tal Zussman Set BIO_COMPLETE_IN_TASK on iomap writeback bios when a dropbehind folio is added. This ensures that bi_end_io runs in task context, where folio_end_dropbehind() can safely invalidate folios. With the bio layer now handling task-context deferral generically, IOMAP_IOEND_DONTCACHE is no longer needed, as XFS no longer needs to route DONTCACHE ioends through its completion workqueue. Remove the flag and its NOMERGE entry. Without the NOMERGE, regular I/Os that get merged with a dropbehind folio will also have their completion deferred to task context. Signed-off-by: Tal Zussman --- fs/iomap/ioend.c | 5 +++-- fs/xfs/xfs_aops.c | 4 ---- include/linux/iomap.h | 6 +----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/fs/iomap/ioend.c b/fs/iomap/ioend.c index acf3cf98b23a..892dbfc77ae9 100644 --- a/fs/iomap/ioend.c +++ b/fs/iomap/ioend.c @@ -237,8 +237,6 @@ ssize_t iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, struct folio *folio, if (wpc->iomap.flags & IOMAP_F_SHARED) ioend_flags |= IOMAP_IOEND_SHARED; - if (folio_test_dropbehind(folio)) - ioend_flags |= IOMAP_IOEND_DONTCACHE; if (pos == wpc->iomap.offset && (wpc->iomap.flags & IOMAP_F_BOUNDARY)) ioend_flags |= IOMAP_IOEND_BOUNDARY; @@ -255,6 +253,9 @@ ssize_t iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, struct folio *folio, if (!bio_add_folio(&ioend->io_bio, folio, map_len, poff)) goto new_ioend; + if (folio_test_dropbehind(folio)) + bio_set_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK); + /* * Clamp io_offset and io_size to the incore EOF so that ondisk * file size updates in the ioend completion are byte-accurate. diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index f279055fcea0..0dcf78beae8a 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -511,10 +511,6 @@ xfs_ioend_needs_wq_completion( if (ioend->io_flags & (IOMAP_IOEND_UNWRITTEN | IOMAP_IOEND_SHARED)) return true; - /* Page cache invalidation cannot be done in irq context. */ - if (ioend->io_flags & IOMAP_IOEND_DONTCACHE) - return true; - return false; } diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 2c5685adf3a9..bf49ba71dd42 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -399,16 +399,12 @@ sector_t iomap_bmap(struct address_space *mapping, sector_t bno, #define IOMAP_IOEND_BOUNDARY (1U << 2) /* is direct I/O */ #define IOMAP_IOEND_DIRECT (1U << 3) -/* is DONTCACHE I/O */ -#define IOMAP_IOEND_DONTCACHE (1U << 4) - /* * Flags that if set on either ioend prevent the merge of two ioends. * (IOMAP_IOEND_BOUNDARY also prevents merges, but only one-way) */ #define IOMAP_IOEND_NOMERGE_FLAGS \ - (IOMAP_IOEND_SHARED | IOMAP_IOEND_UNWRITTEN | IOMAP_IOEND_DIRECT | \ - IOMAP_IOEND_DONTCACHE) + (IOMAP_IOEND_SHARED | IOMAP_IOEND_UNWRITTEN | IOMAP_IOEND_DIRECT) /* * Structure for writeback I/O completions. -- 2.47.3