From nobody Wed Oct 8 15:13:48 2025 Received: from mx10.didiglobal.com (mx10.didiglobal.com [111.202.70.125]) by smtp.subspace.kernel.org (Postfix) with SMTP id E365F2D3EC4; Fri, 27 Jun 2025 11:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.70.125 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751022221; cv=none; b=U+gwBUTmQ4bbNwBorgN5h0R+3mcKE6HeTA60hYeW4najhOtCskvFjaG72eCMY6EiGhBBC7i0JG8Dv+gCobv1V1HfuAgAWYFfym1WXuas9VZDGpyYJu3c0IQQgPHLY1FP+gOKvHJADSZGGSb/K4PDUSQqPw8oS4Ew8VVdxoe4288= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751022221; c=relaxed/simple; bh=4rXllrq3i00vA/X/MCfjVxkg+yARKY9+OylzC6mFE+c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:Content-Type: MIME-Version; b=qu4l6Dc/IPcjdyWYFv6N/tBWv90qkl1tuU94aStQFju/oizRphFc+fw+zchdkxILbTgNRNO2+0RLHC6QgQ50jiRXnbD3PLUTtl6hVrfYrdXDqd++GN75ci9em48b2vz5HT3AZwwxUoESwd2YInusu/f4tuMallwtlYOVT3VCWAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com; spf=pass smtp.mailfrom=didiglobal.com; dkim=pass (1024-bit key) header.d=didiglobal.com header.i=@didiglobal.com header.b=ehTRUkDp; arc=none smtp.client-ip=111.202.70.125 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=didiglobal.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=didiglobal.com header.i=@didiglobal.com header.b="ehTRUkDp" Received: from mail.didiglobal.com (unknown [10.79.71.38]) by mx10.didiglobal.com (MailData Gateway V2.8.8) with ESMTPS id 69C23180FFD57A; Fri, 27 Jun 2025 19:02:31 +0800 (CST) Received: from BJ03-ACTMBX-08.didichuxing.com (10.79.71.35) by BJ03-ACTMBX-02.didichuxing.com (10.79.71.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 27 Jun 2025 19:03:14 +0800 Received: from BJ03-ACTMBX-07.didichuxing.com (10.79.71.34) by BJ03-ACTMBX-08.didichuxing.com (10.79.71.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 27 Jun 2025 19:03:13 +0800 Received: from BJ03-ACTMBX-07.didichuxing.com ([fe80::2e1a:dd47:6d25:287e]) by BJ03-ACTMBX-07.didichuxing.com ([fe80::2e1a:dd47:6d25:287e%7]) with mapi id 15.02.1748.010; Fri, 27 Jun 2025 19:03:13 +0800 X-MD-Sfrom: chentaotao@didiglobal.com X-MD-SrcIP: 10.79.71.38 From: =?gb2312?B?s8LMzszOIFRhb3RhbyBDaGVu?= To: "tytso@mit.edu" , "hch@infradead.org" , "adilger.kernel@dilger.ca" , "willy@infradead.org" , "brauner@kernel.org" , "jani.nikula@linux.intel.com" , "rodrigo.vivi@intel.com" , "tursulin@ursulin.net" , "airlied@gmail.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "linux-block@vger.kernel.org" , "intel-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-mm@kvack.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "chentao325@qq.com" , "frank.li@vivo.com" , =?gb2312?B?s8LMzszOIFRhb3RhbyBDaGVu?= Subject: [PATCH v3 4/4] ext4: support uncached buffered I/O Thread-Topic: [PATCH v3 4/4] ext4: support uncached buffered I/O Thread-Index: AQHb51MTaMwhJCsRP0eEgBCVUoPCoQ== Date: Fri, 27 Jun 2025 11:03:13 +0000 Message-ID: <20250627110257.1870826-5-chentaotao@didiglobal.com> In-Reply-To: <20250627110257.1870826-1-chentaotao@didiglobal.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=didiglobal.com; s=2025; t=1751022173; bh=4rXllrq3i00vA/X/MCfjVxkg+yARKY9+OylzC6mFE+c=; h=From:To:CC:Subject:Date:Message-ID:Content-Type; b=ehTRUkDpCbEGkhMZpTTEM7DPSDb/UWxpKKgQP/Vy9sHFH/sbmH4ptirGdI2TC8yxO mZHpZNlUxGBa0YCbHJ9au4BOMGEAd3oFTVzILrWnaR5BANeKmYT+Ta2GlMcEnb/u4G uyBuOmOz7hUFR4dKovFjwFMs6SSIi6KRO/Nb5knw= Content-Type: text/plain; charset="utf-8" From: Taotao Chen Set FOP_DONTCACHE in ext4_file_operations to declare support for uncached buffered I/O. To handle this flag, add processing for IOCB_DONTCACHE in ext4_write_begin() and ext4_da_write_begin() by passing FGP_DONTCACHE to page cache lookups. Part of a series refactoring address_space_operations write_begin and write_end callbacks to use struct kiocb for passing write context and flags. Signed-off-by: Taotao Chen --- fs/ext4/file.c | 3 ++- fs/ext4/inode.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 21df81347147..274b41a476c8 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -977,7 +977,8 @@ const struct file_operations ext4_file_operations =3D { .splice_write =3D iter_file_splice_write, .fallocate =3D ext4_fallocate, .fop_flags =3D FOP_MMAP_SYNC | FOP_BUFFER_RASYNC | - FOP_DIO_PARALLEL_WRITE, + FOP_DIO_PARALLEL_WRITE | + FOP_DONTCACHE, }; =20 const struct inode_operations ext4_file_inode_operations =3D { diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 08c10200d6fe..639e2e231c4b 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1270,6 +1270,9 @@ static int ext4_write_begin(const struct kiocb *iocb, if (unlikely(ret)) return ret; =20 + if (iocb->ki_flags & IOCB_DONTCACHE) + fgp |=3D FGP_DONTCACHE; + trace_ext4_write_begin(inode, pos, len); /* * Reserve one block more for addition to orphan list in case @@ -3068,6 +3071,9 @@ static int ext4_da_write_begin(const struct kiocb *io= cb, return 0; } =20 + if (iocb->ki_flags & IOCB_DONTCACHE) + fgp |=3D FGP_DONTCACHE; + retry: fgp |=3D fgf_set_order(len); folio =3D __filemap_get_folio(mapping, index, fgp, --=20 2.34.1