Message ID | 20240410132818.2812377-27-yi.zhang@huaweicloud.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 215DFCD11C2 for <linux-mm@archiver.kernel.org>; Wed, 10 Apr 2024 13:37:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 734866B00A8; Wed, 10 Apr 2024 09:37:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BEE26B00A9; Wed, 10 Apr 2024 09:37:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EA486B00AA; Wed, 10 Apr 2024 09:37:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2DA4B6B00A8 for <linux-mm@kvack.org>; Wed, 10 Apr 2024 09:37:10 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0021912073D for <linux-mm@kvack.org>; Wed, 10 Apr 2024 13:37:09 +0000 (UTC) X-FDA: 81993723420.18.DBD6F43 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf15.hostedemail.com (Postfix) with ESMTP id 7EE3EA0012 for <linux-mm@kvack.org>; Wed, 10 Apr 2024 13:37:07 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf15.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=1712756228; 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=DmeNzuRS0UtAzCMbn3rP62UIT6+e3MYM855nqaJqZuc=; b=JlmlY9jwEoT/icV34RgjYNUsq47xRR2UbWUY7mYCvc4FqPN84rj9JtZhfmTnK4zkHJPi/l 83Velw0p8eUFZSQ0Gjlw0vKswRiEJ9Gwb5eP+MHujEPmItnUvtf4vKfIL2ZK18gA2bayJk 0vBByPKOufvevOzn6IpFl+koDhAJnw8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf15.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=1712756228; a=rsa-sha256; cv=none; b=4BwzDNzWo3QIk4naemR6oIvA1ec5uEUqH7hxtJr8adOAI135Ukn3sO2QgjnFh52k6yv3zb AtnDu1a1YtspDFaCBJ2y2U+2clTYt/1Zz/EfyjHT+DB9/baZ2qvpL4s69hnqwWh34+z9rQ Ex5foQjy7i1fjNI62pP067lYOAelKkw= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF3lW2m6Cz4f3mHW for <linux-mm@kvack.org>; Wed, 10 Apr 2024 21:36:55 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 0D9171A0175 for <linux-mm@kvack.org>; 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--.8806S30; Wed, 10 Apr 2024 21:37:03 +0800 (CST) From: Zhang Yi <yi.zhang@huaweicloud.com> 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 26/34] ext4: implement mmap iomap path Date: Wed, 10 Apr 2024 21:28:10 +0800 Message-Id: <20240410132818.2812377-27-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 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgAn+RHolRZmeCl4Jg--.8806S30 X-Coremail-Antispam: 1UD129KBjvJXoW7urW3tr48Kr4rGryUWrWxWFg_yoW8Ar48pF 9akrWrGr4xXwnI9FsagFn8ZFyYy3WrWr4UXrW3CFn5Zrnruw45Ka18WFn5ZF45J3yxZw4U Jr45Cry8u34a9rDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 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/ X-Rspam-User: X-Stat-Signature: o168dyhdym5gfpwqzcnyunguwp3zpc3x X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7EE3EA0012 X-HE-Tag: 1712756227-81238 X-HE-Meta: U2FsdGVkX1+TzQyndehr2DTYwN27ztw5yome/64k1qU0UTLFtCgrpkNo2yXI4x5xH1ukOK96GdPi5JYUrQCPFKM6362HmTziKbkOSFWCS2cicOilCWXSUideG1SzkqR85Ph5mRvZUpHC0kFNSII5fcXAVaDhhFGFSTL0WIZGZfUJLSVo5uiK/5sozYB4BWPU9VBjIf5y+OuNU2MIAs9FrsYY0f9bS/Bj9ppeTfAyUHXTld48O4UQN9kxbJpmZ01eGqwNlPIC+9fEHmeaH5s5FPprCvAjGQXwg6QjD5306OKmZFGG96ljOduQh8US2rvZ7gvPCgXcAWlPOPPyDinuJlhwrPNX8d6k6EaspQgWG4ToDssTTHLKtfMTM7nwwldDw46kVGOZDRnHIPqGUHRHKjjRci1mpWFI8t7MQ3FLmQanrvod67QBCGHFunqhjrmaxZUTB79OLuoMLMR0Gv24rEpc6CUJe9dx2p7rLtR9Y7lUzAJEfkHIQl0EqyPDe0XRSMqfGqNPdy+9zlKgP2WTBoazX++vbB6jgrSyxwfFSeWu26yJvDPAq76ymruNeHq+D1ooviljN6VwgD1jYyx6oGoDXa6Gm+0azlCbRm9DRShb5qR0EnujrNOK/ETlZRvjJq1QLfWuvLp9SaiWFfqQdJUCP/21FSNWu+fD6LVr8AGJUB/BwT+Y4t9d0Mh9BhKXv0snBB1q6EQjwnEYNwkrmDyAN8Z27vPF+bPuXO6mxOIlsDwPY914FHRzL3MiUO6dM1DLG5ElNxiVH3+Qbkczq/AoIyGSeqQ4h6e+nmVa24gQAsbpqgDyZVz7Rl35aOxaiT3LfSRT0WEJty67rtufNhmAFtEXJwdDfTaHh4A03oMLnHIb3S4quFodRy2eVFfUHgPm4ML0qP4yXGGSqYwG+57UPB9L95Hta9oB8R2TNlMXvF1L/nk9D3iQnsArxQdnoxItjW/ReQUlhuqPdbK mNDGO3aY edOGQfGkp95ZT4ZohJqnmEEsCg9AEqUPYPzboSVzMO9RFjFIHOTAz3PJ20Mqyk5IkNp2F8Tn2jcyD7NO78ygXieybVyULhdF7rxmNdsen0rHo6cck1p0oG3ki2+wtASJPGQRt/5J1NT2PwO1WJE+6zGvvNCVhibQAlK5+obWsX/bqY4VJiHhffVEoDEL3a6huj2MDz8KJBJkKBL8= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
ext4: use iomap for regular file's buffered IO path and enable large folio
|
expand
|
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 55a4d293177d..9d694c780007 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -6484,6 +6484,26 @@ static int ext4_bh_unmapped(handle_t *handle, struct inode *inode, return !buffer_mapped(bh); } +static vm_fault_t ext4_iomap_page_mkwrite(struct vm_fault *vmf) +{ + struct inode *inode = file_inode(vmf->vma->vm_file); + const struct iomap_ops *iomap_ops; + + /* + * ext4_nonda_switch() could writeback this folio, so have to + * call it before lock folio. + * + * TODO: drop ext4_nonda_switch() after reserving enough sapce + * for metadata and merge delalloc and nodelalloc operations. + */ + if (test_opt(inode->i_sb, DELALLOC) && !ext4_nonda_switch(inode->i_sb)) + iomap_ops = &ext4_iomap_buffered_da_write_ops; + else + iomap_ops = &ext4_iomap_buffered_write_ops; + + return iomap_page_mkwrite(vmf, iomap_ops); +} + vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; @@ -6507,6 +6527,11 @@ vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf) filemap_invalidate_lock_shared(mapping); + if (ext4_test_inode_state(inode, EXT4_STATE_BUFFERED_IOMAP)) { + ret = ext4_iomap_page_mkwrite(vmf); + goto out; + } + err = ext4_convert_inline_data(inode); if (err) goto out_ret;