From patchwork Wed Apr 10 13:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C6E1CD11C2 for ; Wed, 10 Apr 2024 13:37:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C18186B009B; Wed, 10 Apr 2024 09:37:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA22B6B009C; Wed, 10 Apr 2024 09:37:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8D456B009D; Wed, 10 Apr 2024 09:37:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8C0766B009B for ; Wed, 10 Apr 2024 09:37:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 55A8B80321 for ; Wed, 10 Apr 2024 13:37:01 +0000 (UTC) X-FDA: 81993723042.19.F9E4A84 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by imf24.hostedemail.com (Postfix) with ESMTP id E1B7B18001B for ; Wed, 10 Apr 2024 13:36:58 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf24.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712756219; a=rsa-sha256; cv=none; b=O0p+MJ1W3zekwJjFjKLBt+simMx6KJ5oJrUjWJxdR+VMGabUlKV2j7xBaQN1Nh1a7c/7jS AsN3LRBNWOu/56oeT7QxKZSoqCt3dbxvFy+amuAFt6h4ldjfowmzkZh9GHw3Asxip0viCM BESBxrCmqWn1xpTkwnLEAmZ0GthbNLc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf24.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712756219; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SaKnKlF3eQCLh/1aZzbgmKRzj7eierdhG1udWlWN5gs=; b=ec+KTPKhy417WlQ9GMdeQxWoyCMLF3r9csQ0Aia1ignAji9vz6utGTsbN1xHfkzv7L62/1 BtSZRBJMYXmibkbkIFtGYEyd2KW5jzlPHc8H3LijRnVEhSfKpx9d14rVacwm2VvYDXjSDa hJRK/R39e6ZtSnlgc4cgSEPACuTz/Ds= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VF3lN3dZfz4f3kGJ for ; Wed, 10 Apr 2024 21:36:48 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 59A581A0179 for ; Wed, 10 Apr 2024 21:36:55 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAn+RHolRZmeCl4Jg--.8806S16; Wed, 10 Apr 2024 21:36:55 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: 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, djwong@kernel.org, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: [RFC PATCH v4 12/34] ext4: don't set EXTENT_STATUS_DELAYED on allocated blocks Date: Wed, 10 Apr 2024 21:27:56 +0800 Message-Id: <20240410132818.2812377-13-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> References: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAn+RHolRZmeCl4Jg--.8806S16 X-Coremail-Antispam: 1UD129KBjvJXoW7ury7tw17uryDWrW3uFWUCFg_yoW8KF48p3 sxAr1rWF4UWw1UuayI9r48ur15GayjkrWDur4rur1rWayfCrySkF1qyFW0gF9FqrW8Z3WY qFWru34DCayfGa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUA rcfUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E1B7B18001B X-Stat-Signature: jt5r1jiaksax9qcb36h8scuioga43sqt X-Rspam-User: X-HE-Tag: 1712756218-257419 X-HE-Meta: U2FsdGVkX19z6IvwqnuN0tx/ReTea4VXbXVlfrUeaS4DCqDjMJoR8imOPeFogBziIAB+YoeWgHh2gpgcji3xZTdEIQFElIbd6fVk2JvmKRySIJ/T3AoS8PSsAGk9RFIc6tri+pBO9er1q6iwEw8EkqnEZJxR1AaD02JuvH2kBfbYORqT1z2YMcmVjcbwS6MykYwxpvu6v1lpRbfOEo64/qsX+cKJMBoZlrxzmg3rJ9/O0ssYa16sHBzQyvBM/xMvCVhDq7RI/HA9H64RwuVJLcpP+Viyi3dZ7urHgLUhBvQCPWyEFGDmI3nozcbVSMxxVcLCvuqN7rsTUrdQ+9WFtoCTNstKhw5Pe02rFZMH4pb8c1/H7sWdh+Cn0iv10XLWJ6v/+XZ3IceoBJRhpTj+qTQEhpthd4mckI2UIElSoKnkxMZtvCfAlWyHOWIor4Z1Bmz+JlV0M4f67yL/nWJdmMFnrKThUdce30sQchnsEc7P+FQ/CUq9nurg1IlTefXh/5OkKvE+EKl8EUvlBXiYkn/d2CIAKE2NSNi9vymDCscmn4r5ODheZRi4Te9VqsaiEubjUlx44uW2Gg3g2fijeQ+f7g65RBziedR0yI8bq7I+B76EHU8ieknAlBJMq9m563Lk71JLpto+3pymI8O4Uh6beOf+7MwSvhJc+UNnyLPH/D0LSr23Fotb28fnZwFcQ1d1wj9Wn3c7vzZHbh04JVXAiR91TnOzoHgoh8Bsui3aI4H1LZXcIYC9tSgxVgyWydzT0uD+R3i/bnwDef7f0rKYm5WzlaNw2UiiWYAA6fyHOp2ZkpWF5XkHMCt4FHG0P1eXbLr3EIItJz9xS95cPL4uxRJhK0lppkG+wxpft9HD/AcE8qy8wIE9qHDFFZsxECzfO5Z2w2s7wTy4qpwIebFh4WhdPcbyKnVgSH1nbPhyT9b7fehk18xQjKSrDV4y40EjigXojY5GqVTx/8Q igJZx4Tm CmHkhu2VJgqioUVQUl2niDVrmFaM3kyP/0zdIUpLZOHQY0qKdLWPnnU4y8QmLM98hA14cOsOfm/65VOPPi6mS7JUudtc7ux7E/PmPUv4uCFOuNo1plAE7l+D9Yo+lHqnA3FHb0YvkCSFV7UzNOzUWo/lTdkH02DAR0nZ1xyYxcuoul8jem7rQFDklMExG0bCdxVPPfU+ycw0Ju61KDG+SfmHusc5wxQZqWSGySESojsBZV+Zt1LJEf2OnMOXAhyjVWMVmH0Hms1lDU2X2InB/G0PljB7+zjlIhZ8Bo2tPdF7plChBdlvNzo2voYwYPllhqevVPEh5VLdw6NfsXh8RHOeNPQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Zhang Yi Since we always set EXT4_GET_BLOCKS_DELALLOC_RESERVE when allocating delalloc blocks, no matter whether allocating delayed or non-delayed allocated blocks. There is no need to keep delayed flag on unwritten extent status entry, so just drop it after blocks have been allocated. Signed-off-by: Zhang Yi --- fs/ext4/extents_status.c | 9 +-------- fs/ext4/inode.c | 11 ----------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 2320b0d71001..952a38eaea0f 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -867,14 +867,7 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, return; BUG_ON(end < lblk); - - if ((status & EXTENT_STATUS_DELAYED) && - (status & EXTENT_STATUS_WRITTEN)) { - ext4_warning(inode->i_sb, "Inserting extent [%u/%u] as " - " delayed and written which can potentially " - " cause data loss.", lblk, len); - WARN_ON(1); - } + WARN_ON_ONCE(status & EXTENT_STATUS_DELAYED); newes.es_lblk = lblk; newes.es_len = len; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index fd5a27db62c0..752fc0555dc0 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -558,12 +558,6 @@ static int ext4_map_create_blocks(handle_t *handle, struct inode *inode, status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; - if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && - !(status & EXTENT_STATUS_WRITTEN) && - ext4_es_scan_range(inode, &ext4_es_is_delayed, map->m_lblk, - map->m_lblk + map->m_len - 1)) - status |= EXTENT_STATUS_DELAYED; - ext4_es_insert_extent(inode, map->m_lblk, map->m_len, map->m_pblk, status); @@ -682,11 +676,6 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, status = map->m_flags & EXT4_MAP_UNWRITTEN ? EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; - if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && - !(status & EXTENT_STATUS_WRITTEN) && - ext4_es_scan_range(inode, &ext4_es_is_delayed, map->m_lblk, - map->m_lblk + map->m_len - 1)) - status |= EXTENT_STATUS_DELAYED; ext4_es_insert_extent(inode, map->m_lblk, map->m_len, map->m_pblk, status); }