Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp127666rdb; Sat, 17 Feb 2024 01:31:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4KHS+4KwPGxf/MEBTPn/WWnHB0DPfwikyTHdKTYGtcICpUdllYx2/OYyODkvXZzzWnoQHqUWBO5rytqOV6toW+6bBn3qKq2Rdm/6u9w== X-Google-Smtp-Source: AGHT+IFVO/3BSXBWU6IIGNs5AsNskMTwMEDlPp5c5LGv+fDgds1FG+poFq0swt/ITOOAoZphlq9E X-Received: by 2002:a81:ad47:0:b0:607:f679:e370 with SMTP id l7-20020a81ad47000000b00607f679e370mr4655019ywk.33.1708162309167; Sat, 17 Feb 2024 01:31:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708162309; cv=pass; d=google.com; s=arc-20160816; b=HYuJB+DL0fkSUwlE6AoFr46hn3ACNBfEy15Fn3VMlyAc1Ou68GXxs2Lf3QGa04uU0Z NkAVGh8or7zrSGhete+/yhklq7rEaoN0VERXL0UXX2bEcxntXSSh70RL8ALV9QPTq6uz Ue/6eg6s5NGDeJlqKLYKjM1/9OzK3UWDfyva1QrPaEgxL1ezRzo6tRy9NJzczDpJVeMb xkDURzcfQizRENado5nni1fwaIRHwNIQCAlc088p0UWG8U3COjD4MiDAouN49eATlf4H wbliwnfIgtM0gXdRwCkvIROnWQAct45L2fvmUjUrKGRLwGCH2t1rTKtiE5pjOw5rTQEC so3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=KpLE2rGbJ6sbiJOIldiJ9Eopu+RVpOiHYwltSHIT8lM=; fh=9cOLRZ9nCOlNJBLMrQ87knHYtpxuGaMmoe8il5Y37dE=; b=U2u6pFDvNxDUTEl96Lkt5f4Gn2lhtOoOxJPdqJ0Y8GhDVEhj1GCC/bb9L+oTzYlz51 MdMI6UA1qJKYdXltiiBV31ZMjuZG0y6zzITnZy7mVgBc310xJzcn+Dvpd+xHDjCDbDoB dIEOx5FncvQ5DY8Z51hs7grGnkZ9DJfhGJzBMP5Lyr8yHbcmQh8W+QqoraKSyn+3wATj GH04olQL1m3FPE2IsGnWVkKHAyYP4b1yNIZyLDHU98TWLuG/Kh38rmPFFPlTi7dCsW1Q mR2SWCLgsrUQ5YNuxQRxOthJY6B+CIMc+9tQu46M+VmYtMS8wH0ziKW3Y4xyVeT+m4fA CNGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-1261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1261-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n3-20020a05622a11c300b0042c2f47ede5si1825667qtk.467.2024.02.17.01.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 01:31:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-1261-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1261-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AC4601C21000 for ; Sat, 17 Feb 2024 09:31:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21B421D54D; Sat, 17 Feb 2024 09:31:37 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 12CCD1D525; Sat, 17 Feb 2024 09:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708162296; cv=none; b=l5OvcSVxZRzWB3AvpKJmGROeI6LUufVIyYLBdibAEjUPwASx3Gb8uXW8Ii/b7eA+cd6tAO+IJfG9Mo/vfCobkpPgyjcr3FpaStL3qjVvVsbzScgGVHezCZdUtsiC46eqgUyOYmGcWBN3k3gedgLgAyVViAQJduj0D35dNEYCH4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708162296; c=relaxed/simple; bh=OLvOvd+ZV+lea0d9gFrxv+fwwSEy+ijPUHHEfKWAEdA=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=dMVT9xodJMmAJO+50D2MEHib6H1dsh8Ye7lxrKu2HEUoV8lQrXQGJrIww1cYabXrWCQpJTT00YMcfye8JkKR5m9RSIigf9Yor50HJQp2qb1Udl6QYVm+7qW16jxHSLyXam5UHhCmU2xr8L8zbp1DrP9ayyb/852iBwUNjjL8FJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TcNpd6cgyz4f3knq; Sat, 17 Feb 2024 17:31:21 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B96C41A0390; Sat, 17 Feb 2024 17:31:26 +0800 (CST) Received: from [10.174.176.34] (unknown [10.174.176.34]) by APP1 (Coremail) with SMTP id cCh0CgAn9g7nfNBlPbkfEQ--.27281S3; Sat, 17 Feb 2024 17:31:20 +0800 (CST) Subject: Re: [RFC PATCH v3 00/26] ext4: use iomap for regular file's buffered IO path and enable large foilo To: "Darrick J. Wong" Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com References: <20240127015825.1608160-1-yi.zhang@huaweicloud.com> <20240212061842.GB6180@frogsfrogsfrogs> From: Zhang Yi Message-ID: Date: Sat, 17 Feb 2024 17:31:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240212061842.GB6180@frogsfrogsfrogs> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgAn9g7nfNBlPbkfEQ--.27281S3 X-Coremail-Antispam: 1UD129KBj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3voofrz/ On 2024/2/12 14:18, Darrick J. Wong wrote: > On Sat, Jan 27, 2024 at 09:57:59AM +0800, Zhang Yi wrote: >> From: Zhang Yi >> >> Hello, >> >> This is the third version of RFC patch series that convert ext4 regular >> file's buffered IO path to iomap and enable large folio. It's rebased on >> 6.7 and Christoph's "map multiple blocks per ->map_blocks in iomap >> writeback" series [1]. I've fixed all issues found in the last about 3 >> weeks of stress tests and fault injection tests in v2. I hope I've >> covered most of the corner cases, and any comments are welcome. :) >> >> Changes since v2: >> - Update patch 1-6 to v3 [2]. >> - iomap_zero and iomap_unshare don't need to update i_size and call >> iomap_write_failed(), introduce a new helper iomap_write_end_simple() >> to avoid doing that. >> - Factor out ext4_[ext|ind]_map_blocks() parts from ext4_map_blocks(), >> introduce a new helper ext4_iomap_map_one_extent() to allocate >> delalloc blocks in writeback, which is always under i_data_sem in >> write mode. This is done to prevent the writing back delalloc >> extents become stale if it raced by truncate. >> - Add a lock detection in mapping_clear_large_folios(). >> Changes since v1: >> - Introduce seq count for iomap buffered write and writeback to protect >> races from extents changes, e.g. truncate, mwrite. >> - Always allocate unwritten extents for new blocks, drop dioread_lock >> mode, and make no distinctions between dioread_lock and >> dioread_nolock. >> - Don't add ditry data range to jinode, drop data=ordered mode, and >> make no distinctions between data=ordered and data=writeback mode. >> - Postpone updating i_disksize to endio. >> - Allow splitting extents and use reserved space in endio. >> - Instead of reimplement a new delayed mapping helper >> ext4_iomap_da_map_blocks() for buffer write, try to reuse >> ext4_da_map_blocks(). >> - Add support for disabling large folio on active inodes. >> - Support online defragmentation, make file fall back to buffer_head >> and disable large folio in ext4_move_extents(). >> - Move ext4_nonda_switch() in advance to prevent deadlock in mwrite. >> - Add dirty_len and pos trace info to trace_iomap_writepage_map(). >> - Update patch 1-6 to v2. >> >> This series only support ext4 with the default features and mount >> options, doesn't support inline_data, bigalloc, dax, fs_verity, fs_crypt >> and data=journal mode, ext4 would fall back to buffer_head path > > Do you plan to add bigalloc or !extents support as a part 2 patchset? Hello, Sorry for the late reply since I was on the vacation of Chinese New Year. I've been working on bigalloc support recently and it's going relatively well, but have no plans to support !extents yet, I would start looking into it after I finish rebasing my another patch set "ext4: more accurate metadata reservaion for delalloc mount option" mentioned in my TODO list. > > An ext2 port to iomap has been (vaguely) in the works for a while, > though iirc willy never got the performance to match because iomap > didn't have a mechanism for the caller to tell it "run the IO now even > though you don't have a complete page, because the indirect block is the > next block after the 11th block". > Thanks for pointing this out and the explanation given by Matthew. IIUC, this problem also affects ext4 in !extents mode, but not affects bigalloc, right? Thanks, Yi.