From patchwork Tue Aug 13 12:34:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 1971929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=6s8t=pm=vger.kernel.org=linux-ext4+bounces-3709-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WjrYd2VLBz1yXl for ; Tue, 13 Aug 2024 22:39:33 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4WjrYd08wnz4x7F for ; Tue, 13 Aug 2024 22:39:33 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4WjrYd01Vgz4x7B; Tue, 13 Aug 2024 22:39:33 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-ext4+bounces-3709-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4WjrYb1MtSz4x7F for ; Tue, 13 Aug 2024 22:39:31 +1000 (AEST) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DB88C1F23052 for ; Tue, 13 Aug 2024 12:39:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3092D199E93; Tue, 13 Aug 2024 12:39:22 +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 AF45A21345; Tue, 13 Aug 2024 12:39:19 +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=1723552762; cv=none; b=edYsdoTMNuAsgwNJHrRWVruT9XKFFfMAwBcUDnME3wjy6EFZDdfiQI5UCLGVdGRZMJeZbL+NuuFZLET2JvAgG2tvsdA1uwW/rp5+TGcv3m+sQiF868OM3WGrljinf8KjYB3N1wbeLjEj1LnlPU8exW5CYw0UZ/4p3rfLnJjGP8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723552762; c=relaxed/simple; bh=pX4eEmQ9nihbCYgNo9Yn9kct/omhHF8zzhNPMDcVk/s=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Ne+fteXeIY1RSEQjg2rJbwAKWQ8i4kRTyIOX/iPi3xNdxDt87veMvFDJPDm8x1seEEL3/0bZ59DuLQEnsGLNMT5iIRylj8thmB3+NqrZJ8NBRUmXpS2x4kW37Zzo+5BP/+G7ztjopMsa1ZnAtXxyfvNCJGQG3NNAr8icr2VZ3xc= 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 4WjrY26lQ8z4f3jHT; Tue, 13 Aug 2024 20:39:02 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 9FEAC1A1735; Tue, 13 Aug 2024 20:39:16 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBnj4XkU7tmejNSBg--.17625S4; Tue, 13 Aug 2024 20:39:14 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH v3 00/12] ext4: simplify the counting and management of delalloc reserved blocks Date: Tue, 13 Aug 2024 20:34:40 +0800 Message-Id: <20240813123452.2824659-1-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBnj4XkU7tmejNSBg--.17625S4 X-Coremail-Antispam: 1UD129KBjvJXoWxCFy5Jw15Kw4ktF4DJr18Krg_yoW5GFWrpr WfC3W3J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patch 3, update the chang log as Jan suggested. - In patch 5 and 6, when moving reserved blocks count updating to ext4_es_insert_extent(), chang the condition for determining quota claim by passing allocation information instead of counting used reserved blocks as Jan suggested. - Add patch 9, drop an unused helper ext4_es_store_status(). - Add patch 10, make extent status type exclusive, add assertion and commtents as Jan suggested. Changes since v1: - Just rebase to v6.11-rc1. This patch series is the part 3 prepartory changes of the buffered IO iomap conversion, it simplify the counting and updating logic of delalloc reserved blocks. I picked them out from my buffered IO iomap conversion RFC series v4[1], and did some minor improvements of commit messages. This series is based on 6.11-rc3, after it we could save a lot of code. Patch 1-3 simplify the delalloc extent management logic by changes to always set EXT4_GET_BLOCKS_DELALLOC_RESERVE flag when allocating preallocated blocks, and don't add EXTENT_STATUS_DELAYED flag to an unwritten extent, which means ext4_es_is_delayed() is equal to ext4_es_is_delonly(). Patch 4-6 simplify the reserved blocks updating logic by moves the reserved blocks updating from ext4_{ind|ext}_map_blocks() to ext4_es_insert_extent(). Patch 7-12 make extent status type exclusive and drop the unused code (e.g. ext4_es_is_delonly()), update comments and do some cleanup. [1] https://lore.kernel.org/linux-ext4/20240410142948.2817554-1-yi.zhang@huaweicloud.com/ Thanks, Yi. Zhang Yi (12): ext4: factor out ext4_map_create_blocks() to allocate new blocks ext4: optimize the EXT4_GET_BLOCKS_DELALLOC_RESERVE flag set ext4: don't set EXTENT_STATUS_DELAYED on allocated blocks ext4: let __revise_pending() return newly inserted pendings ext4: passing block allocation information to ext4_es_insert_extent() ext4: update delalloc data reserve spcae in ext4_es_insert_extent() ext4: drop ext4_es_delayed_clu() ext4: use ext4_map_query_blocks() in ext4_map_blocks() ext4: drop unused ext4_es_store_status() ext4: make extent status types exclusive ext4: drop ext4_es_is_delonly() ext4: drop all delonly descriptions fs/ext4/extents.c | 42 +------ fs/ext4/extents_status.c | 240 ++++++++++++++------------------------- fs/ext4/extents_status.h | 28 ++--- fs/ext4/indirect.c | 7 -- fs/ext4/inode.c | 201 ++++++++++++++------------------ 5 files changed, 189 insertions(+), 329 deletions(-)