From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-00364e01.pphosted.com (mx0a-00364e01.pphosted.com [148.163.135.74]) (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 6BC2F36607D for ; Thu, 30 Jul 2026 20:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785443949; cv=none; b=MmWeIu4gR3epNoc6PBM01HRVHMNZ99PYg6hX1nhfKDHKdQUx+UlV/FeX2cI3M5uoJHXngCgWoMrz1DP53WzJ0zWJ/gtPpyCwAy/NZ05AD1YjO5RQXlZGEKkQljAmialmbS05q9+b7GiWeTLu1cJ90GW8u71O595aq/jmb7Vr7f4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785443949; c=relaxed/simple; bh=G/vRUOm8L2XZ3XeP9CnNcbxvMqQWrQcmwiBXs9OOzgw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OSRZpsb7j088sZJxS3Z2G7r8yGTD5kQ1d1b9YkORLlkQTQ36TEFUfa27k4YnkNiBZBOoJkeve7GEyT0f29jS/5TlI+whfMdptgytDm1KejeAjUthUdDTbykrR3jhZSv6zkQ2Gu47si5C5dtvn4o3NCzoNjo3FCyuxXIkLTld1/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=columbia.edu; spf=pass smtp.mailfrom=columbia.edu; dkim=pass (2048-bit key) header.d=columbia.edu header.i=@columbia.edu header.b=WQ7HnPHx; arc=none smtp.client-ip=148.163.135.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=columbia.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=columbia.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=columbia.edu header.i=@columbia.edu header.b="WQ7HnPHx" Received: from pps.filterd (m0167069.ppops.net [127.0.0.1]) by mx0a-00364e01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66UKY38E3319804 for ; Thu, 30 Jul 2026 16:39:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=columbia.edu; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps01; bh=T8e8 k+5EzrTp13lWK2mQytn9hp17i2RRCkab9M9He5A=; b=WQ7HnPHxqZL+jR81XllF JTKnzPju6U39UyyWhhTcphUfZ+xAg2wqUa791ebQ1v5NhvW0IuF//dLqtiOJvHMi fmyKW7M+TGXkdSy8yhCZpU5HL/IpFm8hExjB6Zd8ZTnCZBp0FfiM/4VmQMN3Nyjj wy9qKWJdLe5TFEiS34dauGmL0aNhbdETHjmjDl6ehafIPC0BA5I6nCfjcLjVALJk 9EAViui9QVuK3SVhaPP15FKa4Vxbk1NUe/8NEuykcAZ7ZyTVvPKKcmrPB5R0nGP7 1xqHFPEmX+ojBlGjFW+JqGfOPxg4M0VGW9uE0F4ziDhKljsql7UvZhC9GapkEQy5 vw== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-00364e01.pphosted.com (PPS) with ESMTPS id 4frbkhh43w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 16:39:06 -0400 (EDT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-51c0f0a0760so3927981cf.2 for ; Thu, 30 Jul 2026 13:39:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785443945; x=1786048745; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=T8e8k+5EzrTp13lWK2mQytn9hp17i2RRCkab9M9He5A=; b=el8wGwmzWZU+3HD/Csw/9tN1YkltM4afR8Hq4R/cxZsm/xf2rDPXtgop9ngUqULwHu 1cOSyBEFT682pi+VIsl4DWyqgTBu5AgiKpTVK6xC+fjgcknn04HQXNqqWrbD/N2Ll+Go L6Us56fKnn121quNhhni2jvlXPnBPwIDDAMtOGDQv+rcN0popLKDc00tmbPg8migpcIn jIAh0OA5NUbJyeb9iVFv3V7Lxi4PiAS/8oeotV7xwVlZpoxlW00EIJrnlRP4Of7Cw99X a7uQr/nchwDO4aZIsFBy+nkpUOn6Y6TTktODKVK8XB7y6wgnUfp/1pAkxNCgzbq5oASr iJtQ== X-Forwarded-Encrypted: i=1; AHgh+RoxjhANPHxHlC+3AQns/16ynblWIWpWzTisyLLo9Rfzrd/EI3/Z+CewatJhW/8PNW8wPpW2RN4Cu25wExA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw55fyO+Sf+pJ81V8YLXmw3AisibkX7RkQqWTPYFnx3Jn5q5oSE DCqPSja/ib+DjVAW8vYpLTENrgBxuLOBrE944VUwYbh9+k+8ou0+9pw/dX2wDGGQ4XcpdM7cVZI Hn0U7lea9SVHarne5lHA0c/Lm7ALaACRqmOL5Wwnl50+zKrr7tw+x1jEgC2spcA== X-Gm-Gg: AR+sD13kWJjm9aH5huG0fjO7fRYpnFTh7n4S5/HMxQ0+sJFSYd32IYw8dHs9cFT3C/j ejz/2afQ8s+2yLJJbx/oqiQMrl0SyGw5AXUuIqfNj1JKv1cDoeziyshinFciapRlidmkGRpxrJ8 UZu26mNA/bNOckI723ID2qPpKb6y09rZAwAl8mASB5DASsBMnhLEjtsD6CmsF8bPW90GC+Wl2S6 wH/2FX5enbGZCEmMKvd93ys1JBLVblXtq9rBp9pK7JT4hcNiYHrbkfOFrg9UTVtzR6J6JSFE+J3 bAqOWQHoHBNNOjPa8JvjMQbrhb2/kgXYib9Rg5LiH2QLycqn5j04S13nQvHKPTn00C0UZfz/HGB PRhNUWImhWdzB8Ps= X-Received: by 2002:a05:622a:3d0:b0:51c:7b11:41a9 with SMTP id d75a77b69052e-52b38757e60mr44335471cf.86.1785443945527; Thu, 30 Jul 2026 13:39:05 -0700 (PDT) X-Received: by 2002:a05:622a:3d0:b0:51c:7b11:41a9 with SMTP id d75a77b69052e-52b38757e60mr44335011cf.86.1785443945082; Thu, 30 Jul 2026 13:39:05 -0700 (PDT) Received: from [10.206.71.35] ([129.236.231.134]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-529e2d8251asm48127221cf.19.2026.07.30.13.39.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jul 2026 13:39:04 -0700 (PDT) Message-ID: <15506dc8-e5b8-4fa8-a85f-912a92edb83f@columbia.edu> Date: Thu, 30 Jul 2026 16:39:03 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 3/5] iomap: use BIO_COMPLETE_IN_TASK for dropbehind writeback To: Christoph Hellwig Cc: Jens Axboe , "Matthew Wilcox (Oracle)" , Christian Brauner , "Darrick J. Wong" , Carlos Maiolino , Alexander Viro , Jan Kara , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Dave Chinner , Bart Van Assche , Hillf Danton , Sebastian Andrzej Siewior , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-erofs@lists.ozlabs.org, Christoph Hellwig References: <20260730-blk-dontcache-v7-0-3e8e6850068d@columbia.edu> <20260730-blk-dontcache-v7-3-3e8e6850068d@columbia.edu> Content-Language: en-US From: Tal Zussman In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=Jp/Bas4C c=1 sm=1 tr=0 ts=6a6bb66a cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=Mx06nvryMUGB95QVe9e23A==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=x7bEGLp0ZPQA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Da8U98TiO7q1upZEImrf:22 a=JR4YdQiviy7OQf72WyZ1:22 a=qsXxR-sLYAu0WPx4Yu8A:9 a=QEXdDO2ut3YA:10 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDE0OSBTYWx0ZWRfXzLa8QKGHgmVv SpjVeLoZieE/HSTEYYVPdwqGmkq2R+2TUn35067RuNTl1q0Tr8O+qN5q92vx3WcqDEcBWVwRqIY tm7t5SfaOXmwEgwSzwC0Xam3TDcJISdrZHjagdDSFcbYpM3u9/Dr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDE0OSBTYWx0ZWRfX1HZOi/l8cd5J e6lW0CK+H7U23ciRudShaKnQm/LXoOMTHHIIyz5cc8gtGF9gNbOVy7+yOpTncYZCjP5nBo/DPEy mMctkNS3mxiRIyGBoK9B+MFmmaZ4Fl/D6o6J8eRDUwhpJrCylA3GvJXDAwodVALghZvpBdXTpsR gIYzpHX69yYuL8kiOJaHiI4mYMz4i5Lt4mqXnRAMYHhJRyW5TxefZAM1ScoRQYSHkVT13X7vNZB 5wlrmEDBz+Nnwx3C24CS+gkuw23JFRawqlgSQz37E3uBD1XkO/6kk+mUE977yJCPtNueqTZzASU SxSBR1CCoJL2z8l2H6oMbgTc2uBOnDP1SVVZEWb5Z4Y2Bh5Ha1AX6ck968Gxlm3Y4UnekQ4ugPO eOcJCRvq7vs6nWLDJX9VZgKNGOvIUUgo1gNXabRH83abS+wnhU3Q24wObZ0uFQDXX4u6Oal/wD0 ve7Nd/GJVx6wFVT6xaw== X-Proofpoint-ORIG-GUID: G-7c7iI2X9JgIELCoXIW3qGPkD3cMFOY X-Proofpoint-GUID: G-7c7iI2X9JgIELCoXIW3qGPkD3cMFOY X-Proofpoint-Virus-Version: vendor=nai engine=6900 definitions=11860 signatures=596817 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=10 suspectscore=0 bulkscore=10 clxscore=1015 phishscore=0 malwarescore=0 priorityscore=1501 adultscore=0 lowpriorityscore=10 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300149 On 7/30/26 4:13 AM, Christoph Hellwig wrote: > On Thu, Jul 30, 2026 at 02:57:53AM -0400, Tal Zussman wrote: >> 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. >> >> Reviewed-by: Christoph Hellwig >> Signed-off-by: Tal Zussman > > This seems to be missing the bug fix you identified for the double > deferral? Sorry, I misunderstood and assumed you'd take care of it in a follow-up. I'll adjust it as below and send v8. > I although thought a bit how that could be done cleaner, see below: > >> ioend_flags |= IOMAP_IOEND_SHARED; >> - if (folio_test_dropbehind(folio)) >> - ioend_flags |= IOMAP_IOEND_DONTCACHE; > > I'd keep this flag. > >> if (pos == wpc->iomap.offset && (wpc->iomap.flags & IOMAP_F_BOUNDARY)) >> ioend_flags |= IOMAP_IOEND_BOUNDARY; >> >> @@ -256,6 +254,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); > > And move setting the flag to iomap_ioend_writeback_submit, and only > for the case where no io_bio.bi_end_io is already assigned. > To confirm, this would only work because XFS provides its own task context and is the only consumer of iomap that sets its own io_bio.bi_end_io. If another filesystem set it and didn't provide task context, this would break, right? I can add a comment about this requirement, but I want to confirm the intent, as it feels a little fragile as-is.