From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-113.ptr.blmpb.com (va-1-113.ptr.blmpb.com [209.127.230.113]) (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 46E5C346E40 for ; Mon, 29 Jun 2026 12:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782734554; cv=none; b=lgrCjFkJgrFEFtY2Ia/2N4mwZjXC4NoHejOMdeFb4NzU9PUMjCaNHyXNZshC657AJjOYNEylUZZJ0eXZdf9vpAIHjiMsoKqufC0bX9727FvFQCVHhTpv+/A/eFAqDksPhgvpDAlhKSOOpw+1ujxbSzmNuiYDmiYxWsuVjeDKk/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782734554; c=relaxed/simple; bh=TcboXjfnw3GWC29M5/vXwCJwozzZV9zFbxnOiAMQUKw=; h=Cc:From:Date:In-Reply-To:To:Mime-Version:References:Subject: Message-Id:Content-Type; b=rJQlCbUqq/+SMnGe2cZSwHB0CgLzvQwQPpGrnjCokBcC/eo6ayzh/V7tel8VWS6t9LT0f0kA5ROJYiTevbjhgrpZDfxkSu8/S6pyfxkO8iva2oEo6Y0g+f9vL+D4BOOvd3BHbaI+lY+pciHS+Youpjsv2VSSv3ZjmEhx0M2XGis= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=RcVlQgV2; arc=none smtp.client-ip=209.127.230.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="RcVlQgV2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1782734546; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=bAgoa3/ClU61fhUDaibF1TS0E3XaqN/FGWAhPE8DBr8=; b=RcVlQgV2KxeDNf0lL4s8vp+2Otd9m4quGez3qLiSbxwUb7EMUPeExGfWdcfZ8lvCEI+lp8 WMTCcMZPkbrDWJTfjPgF4J9rywK5ux5n+rAmyuCm/pWpuGst4RtybMtqpoSqPaK+s7xlvn vOMIRGs0tgktaj5ZKHEyOGlK0HyF1Vd7X8lzN4F10rdfys6sovKEiK+3ffvtv0RvLyRDlZ c/g4OFS5KTBIwYAtuE7KlE6Jzas6TxpAmdBVeZuJnkLXBcp9KvPzRzpmkiqyaFFHjCnXhw edFghriNsTaLn5hs0PVo0pbcMm+Y/dwW9oDdMzHv8E6Vws6krxB/ji0cjLNHiA== Cc: "Fengnan Chang" From: "Fengnan Chang" Date: Mon, 29 Jun 2026 20:01:22 +0800 X-Original-From: Fengnan Chang In-Reply-To: <20260629120124.25223-1-changfengnan@bytedance.com> To: , , , , , , , , , , Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260629120124.25223-1-changfengnan@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Content-Transfer-Encoding: 7bit Subject: [PATCH v5 2/4] iomap: factor out iomap_dio_bio_release_pages helper Message-Id: <20260629120124.25223-3-changfengnan@bytedance.com> X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 Extract bio page-release logic from __iomap_dio_bio_end_io() into a helper taking (bio, dio_flags, error) so the upcoming simple direct I/O path can reuse it without a struct iomap_dio. No functional change. Signed-off-by: Fengnan Chang --- fs/iomap/direct-io.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 487c4763f3fde..c40350cdf3b14 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -237,23 +237,29 @@ static void iomap_dio_done(struct iomap_dio *dio) iomap_dio_complete_work(&dio->aio.work); } -static void __iomap_dio_bio_end_io(struct bio *bio, bool inline_completion) +static inline void iomap_dio_bio_release_pages(struct bio *bio, + unsigned int dio_flags, bool error) { - struct iomap_dio *dio = bio->bi_private; - if (bio_integrity(bio)) fs_bio_integrity_free(bio); - if (dio->flags & IOMAP_DIO_BOUNCE) { - bio_iov_iter_unbounce(bio, !!dio->error, - dio->flags & IOMAP_DIO_USER_BACKED); + if (dio_flags & IOMAP_DIO_BOUNCE) { + bio_iov_iter_unbounce(bio, error, + dio_flags & IOMAP_DIO_USER_BACKED); bio_put(bio); - } else if (dio->flags & IOMAP_DIO_USER_BACKED) { + } else if (dio_flags & IOMAP_DIO_USER_BACKED) { bio_check_pages_dirty(bio); } else { bio_release_pages(bio, false); bio_put(bio); } +} + +static void __iomap_dio_bio_end_io(struct bio *bio, bool inline_completion) +{ + struct iomap_dio *dio = bio->bi_private; + + iomap_dio_bio_release_pages(bio, dio->flags, !!dio->error); /* Do not touch bio below, we just gave up our reference. */ -- 2.39.5 (Apple Git-154)