From patchwork Wed Apr 10 14:29:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624705 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 8F7F2CD1299 for ; Wed, 10 Apr 2024 14:39:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E37406B009C; Wed, 10 Apr 2024 10:38:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE8406B009D; Wed, 10 Apr 2024 10:38:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38676B009E; Wed, 10 Apr 2024 10:38:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A05F36B009D for ; Wed, 10 Apr 2024 10:38:40 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 41F4E1C0BB2 for ; Wed, 10 Apr 2024 14:38:40 +0000 (UTC) X-FDA: 81993878400.28.62CD446 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf22.hostedemail.com (Postfix) with ESMTP id BB9FEC000F for ; Wed, 10 Apr 2024 14:38:37 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf22.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 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=1712759918; 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=U+dUqs1pp+n2F0HMN1pye5Y5K/On9SMEIOfPtIAuocndxrN0ZFXZb9arhRQr12kJWFlGxu azN3y5mhQ+Uj9C/w6tInZKR8juqQOqJqwenBvWsZCXt4gcbj3IXprKb16hoov3zkd13zxT L4H23TkU0uDbkJec4ey2yRaEIoP3AcU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf22.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712759918; a=rsa-sha256; cv=none; b=eveLCMspBAttFV5Po60+xq9bzDXnXW3Ewsdzg9MKvISbosVOQ1mt6XHq2xwSAjiRhfJSBD rirZG+YciQxhQ0rhXHYdAoKsCH3As298kAdLANK8gam7K/74m82SetOwlMwxGsJOlrWf4a d7lIK57xqUU9CVYRo7XkzgJ+CUECtek= Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF56S64j2z4f3lft for ; Wed, 10 Apr 2024 22:38:24 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 806841A0568 for ; Wed, 10 Apr 2024 22:38:33 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFSpBZmcwR8Jg--.63000S16; Wed, 10 Apr 2024 22:38:33 +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, david@fromorbit.com, 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 22:29:26 +0800 Message-Id: <20240410142948.2817554-13-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> References: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX6RFSpBZmcwR8Jg--.63000S16 X-Coremail-Antispam: 1UD129KBjvJXoW7ury7tw17uryDWrW3uFWUCFg_yoW8KF48p3 sxAr1rWF4UWw1UuayI9r48ur15GayjkrWDur4rur1rWayfCrySkF1qyFW0gF9FqrW8Z3WY qFWru34DCayfGa7anT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUHS14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAaw2AFwI0_Jrv_JF1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I 8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCF s4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFI xGxcIEc7CjxVA2Y2ka0xkIwI1lc7CjxVAaw2AFwI0_GFv_Wryl42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxV WUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI 7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_tr0E3s1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4UJVWx Jr1lIxAIcVC2z280aVCY1x0267AKxVWxJr0_GcJvcSsGvfC2KfnxnUUI43ZEXa7sRibyCP UUUUU== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspamd-Queue-Id: BB9FEC000F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: epdzafmcmpknws97uojyh86ufuqjqcer X-HE-Tag: 1712759917-112495 X-HE-Meta: U2FsdGVkX1/ItFgnAaq3gpi7LI8iGegpM/ujjejfgrq7CHOuYFcany2ks/mUxtF5LjZcf3Oy99VdbUlHRcd+HrrUbtrWz8prd1b/MPz5ke2/clAwmZWORMlD2RpUdsAQWbcZRnADc8kybMnLMiZuJ6waKFXUxiMNC8FJIBMmCxZfexCzLiw0cCgAcrY7tshHfKYLlStgbhJquHXPTp0Yhez8LuafHiHpaEiWEoNGDk9aJR53MnBEDkxb3ea6/xG2JS2Pae1Q39xArWFioBpiDOB4ZmVSwOaze9g3YMc4PI/1spckVbTVn1D0e6Ez52angAaQ0ZYFkDfJTc/r2XuYcczGjA5LxTf2u2mgFqYBUS0erdpVPxZ1gWV4soR15xVm8zDPuC+As+G8mWDnK2eTt6/c+yqJ5fgqPj7Nxe7tgi8ioCz92g3UMwteN0zpR/p6WaxycMKj70AjdUgheaq5SkjxxXnGE7BnAbOFcJzZbCnq9w/9A8RdRqXUihh+3NoqMb1RIWifCBXmlsXeiGb5+u1jj95+hi/RCYEE40LSs437VUaoFkCsHklX2S9zuaYxrReji9ZfnMM4MkUR/e5WHfXVqs90TOXBJaJfXv7wN0l5o/Ark7FVfG5uI16Yh9WLIzbzwpePkVTkETj/+HSq1CERDg32UWtjMEBTJa91xYy6i1XzvsnCWBq55q8gKOtJW4eXbSC2CwRuv9qhxOfrWCU3tUhd6NanvB4bs0XQ0TDBW69wxsqQIoP8n75mwocl4AxvdDVamrfew4fM0JTbYyyQKoNHp1KbABFU08o9tA8zT0Eaa26/0z2n/1e45Q+PNuwSX6Vio+ETDHKxCsaTRvq8rgywPAydfRfNTbXuQZ9JDKvlupOWEiod7xjAW+JVENMpkny/Nsf3zu82FSi3zXEDAkVP1/Jewezjnf7BrUrDbLoi/gicOyiE9RVnPjoiyoeJRjOcu0zLI0zZjfi mheOekrh jXFUXEceqquS47SNA8gns2G8gwnCA7zikCEyC6Nbm0wFwGP01ej0YyMpjz9SEI6Sq6ByuYNSw6Tj5OizFBgA+D/H3eKIlQXBgXUB8wzwhxogehqefhpzVPK6s7QibqINr7i0B24EEJuKjaZ4E+44XB2ryTlVnhJFTjpxMjc+ERtlPwI1Qf1uSuUDdztgPi7EQl4HT6i5q6URzowzZLikv3WJTJVOfZ6PockMvQ7vD4Jo/+SPuvNYa3/clqYTfd8c3LJzZg4VVtPl9t+/cyilS9h/xRVjrKhRLqtTz 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); }