Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp148014lqj; Wed, 10 Apr 2024 06:47:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBA8eFjyEUm8JrcBEEvE8GcK90oH3HRql71ZcRscHjNSlTn83Tue//RD5mHhFqy2Ecq/BacQA7swjFn/R5kXztQCmgPybC7xytksdM2w== X-Google-Smtp-Source: AGHT+IFcBBi5yjz20ql+rdY6OX3QmAU8yJ8bjLXZRmXUzis8bEjeM3bJ830ulOnEZQTMsnL9Y+WW X-Received: by 2002:a17:902:d512:b0:1e3:e541:a5f8 with SMTP id b18-20020a170902d51200b001e3e541a5f8mr3951239plg.19.1712756829532; Wed, 10 Apr 2024 06:47:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712756829; cv=pass; d=google.com; s=arc-20160816; b=cDiUO0UlYGIQnDfP+MPI9t2C0J07JjT0uRMqXluevaZfqPgLBZm88qMFasHbT1q4J4 OY/kE0Eaq6AyDs7F5xNyMbNbSa92QbqlolcCoObeyAlyZp6Mz50yJJ5XrvebWx8JqyNz j2mU60JH8yi/uvKJrJQM6SOYD+fpFtI7o2AoWrgJbtErfvK4dKtBIVOWvVn9drAnbr7P XxwfkT0idbIdAWeJ+9eyMXw4d1Qbv8Pgtz3JDp8KjMRUhpp+wKxKTh8nQI7SVJUMK8On Fiq/NMhVHYo8YkFJH5kV23R9cPKjK+UQxvfKgIUUYbUCSQW94Tqu/iGQFJitnf7DL23x iNxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=6CZLF2scSej3kVTtlU6Wdwgq92cG9Myex7yJb2oFIwQ=; fh=UhGiR19HeAIu8tzXykjZgtAKLLMPZj8YX6gPScUOsdE=; b=ZTnxPKNNhTXLRq412nwNmQeFrmTqPcg6hZIXgiRhuofqB7avgUvytHjOV5NUCeQhLW 7qxVAO0rfcrYABAGOer+yp8daua5vKVPaLiGHQKzNvZfJPWnkNItsEpFmMKAqkTs+ci5 Ec6zu7vB0bHRjmHrwkF8fAI0kxmdyC5R6M8rRPTCu2NsD9LgGD859oT2F1mBgcOJ0tM5 CmHlD2xbOjt3bJScNAxbS008qh3Ot559p/95uG6MKi8j2JaU1PZlBYnL1nLa3HsJ6Il8 WHtt1sqxZBelYz0BKoP170jfwWhNpQ1yixNPZ+R31wzY9nCyPEjFVCep6oY90F8Q36b+ ubKQ==; 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-kernel+bounces-138638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138638-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k8-20020a170902c40800b001dee4bd73f3si11130155plk.599.2024.04.10.06.47.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:47:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-138638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138638-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A5A12289348 for ; Wed, 10 Apr 2024 13:44:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CF6517B509; Wed, 10 Apr 2024 13:37:11 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (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 CBBC115EFA9; Wed, 10 Apr 2024 13:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712756229; cv=none; b=g3sLGq8omVI74/AnYlKc9OgRCJBFrRUlylcNcXSAdi0uK+6I8jwe4XK3yMs5HzDdiong1zrXk5hR+f+SJU8m5CCv1EHrOtINYYt5aeVvfbGbhd3dcugPzEN6WDI8GZ6KOGCtkmgrjog6fFRDCPSCNVVHj40twHVwG5BKiv8tI7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712756229; c=relaxed/simple; bh=a0yXsZEWte2+yhfLSEWGmnTc+medZk5RJjxW91j+Nrw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oJjT+ZQL1jw2r9blfYpebh5ySDLbLaNwdlzyZrlaeXEPo3v2vBpfelltU9tmGn0lCLqKGiOVtGUThYsXx7l9La55LbR8uQksKzd1so3gIkbFq0Y2kvNukXPXBLl7KcohE5A/AXB6Z0mwExT78Dhpj6NXkVl7Z0MFFe8FkCwe7BI= 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.51 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.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF3lc2Fqrz4f3jZ7; Wed, 10 Apr 2024 21:37:00 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B14941A058E; Wed, 10 Apr 2024 21:37:04 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAn+RHolRZmeCl4Jg--.8806S31; Wed, 10 Apr 2024 21:37:04 +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 27/34] ext4: implement zero_range iomap path Date: Wed, 10 Apr 2024 21:28:11 +0800 Message-Id: <20240410132818.2812377-28-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn+RHolRZmeCl4Jg--.8806S31 X-Coremail-Antispam: 1UD129KBjvJXoW7urW7CrW8XF1rKFW7Gr1rJFb_yoW8JFWDpr n5K34UCr47Wr9F9F4IgF9rXr1Iy3W5Gw48WryfGrn8Z3yfW34xKFWrK3WFvF4jg3y7Jayj qF45try8Kw17AaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVW8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JV WxJwCI42IY6I8E87Iv6xkF7I0E14v26F4UJVW0obIYCTnIWIevJa73UjIFyTuYvjfUF18B UUUUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi Add ext4_iomap_zero_range() for the zero_range iomap path, it zero out the mapped blocks, all work have been done in iomap_zero_range(), so call it directly. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9d694c780007..5af3b8acf1b9 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4144,6 +4144,13 @@ static int __ext4_block_zero_page_range(handle_t *handle, return err; } +static int ext4_iomap_zero_range(struct inode *inode, + loff_t from, loff_t length) +{ + return iomap_zero_range(inode, from, length, NULL, + &ext4_iomap_buffered_read_ops); +} + /* * ext4_block_zero_page_range() zeros out a mapping of length 'length' * starting from file offset 'from'. The range to be zero'd must @@ -4169,6 +4176,8 @@ static int ext4_block_zero_page_range(handle_t *handle, if (IS_DAX(inode)) { return dax_zero_range(inode, from, length, NULL, &ext4_iomap_ops); + } else if (ext4_test_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP)) { + return ext4_iomap_zero_range(inode, from, length); } return __ext4_block_zero_page_range(handle, mapping, from, length); } -- 2.39.2