Message ID | 20240410142948.2817554-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 7FE65CD11C2 for <linux-mm@archiver.kernel.org>; Wed, 10 Apr 2024 14:39:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A5A96B00AF; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92CC56B00B0; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A79E6B00B1; Wed, 10 Apr 2024 10:38:49 -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 586AC6B00B0 for <linux-mm@kvack.org>; Wed, 10 Apr 2024 10:38:49 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 270ABC05EF for <linux-mm@kvack.org>; Wed, 10 Apr 2024 14:38:49 +0000 (UTC) X-FDA: 81993878778.09.C31F3C2 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf14.hostedemail.com (Postfix) with ESMTP id C063C10000D for <linux-mm@kvack.org>; Wed, 10 Apr 2024 14:38:46 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712759927; 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=jt7Hnvh4G7rIVTbju5vo7FfHo5wnsRXO0E/pPWEgZYPwEjtKwSa4XhbFlx/rgCwQx1Zfam XBu6HlKl+3cq2UU+kKbOaoV3399GLM/O4JXwW4kwEOEnpxyuTs/2wVV6iVCdzYpQMgJDXh 0feFxFnhhJCTKDrqGbdvcgjFYTKfzxU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712759927; a=rsa-sha256; cv=none; b=OvPn49QsNtdEcrqxL8B3b0Xd2uGwlipUQtTYo96ErnYfrgUrlFa4ev4RkkCfeNiszkpNhP 4x+ChKHaUe6DlqrZNl/10w88aVaTq8m2SQn0CEh+1EyE049ZK5Zd04OWZczjRCBCLcByyu 5+HZvTgLYRG7a7OXOJ4iY13KqntUml8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF56k17L0z4f3kJr for <linux-mm@kvack.org>; Wed, 10 Apr 2024 22:38:38 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 8E1101A0568 for <linux-mm@kvack.org>; Wed, 10 Apr 2024 22:38:42 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFSpBZmcwR8Jg--.63000S30; Wed, 10 Apr 2024 22:38:42 +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, 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 26/34] ext4: implement mmap iomap path Date: Wed, 10 Apr 2024 22:29:40 +0800 Message-Id: <20240410142948.2817554-27-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 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgAX6RFSpBZmcwR8Jg--.63000S30 X-Coremail-Antispam: 1UD129KBjvJXoW7urW3tr48Kr4rGryUWrWxWFg_yoW8Ar48pF 9akrWrGr4xXwnI9FsagFn8ZFyYy3WrWr4UXrW3CFn5Zrnruw45Ka18WFn5ZF45J3yxZw4U Jr45Cry8u34a9rDanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUH214x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4 xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCa FVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI4 02YVCY1x02628vn2kIc2xKxwCY1x0262kKe7AKxVW8ZVWrXwCF04k20xvY0x0EwIxGrwCF x2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km07C267AKxVWUXVWUAwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWDJVCq3wCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr 1j6rxdMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8Jr0_Cr1U MIIF0xvEx4A2jsIEc7CjxVAFwI0_GcCE3sUvcSsGvfC2KfnxnUUI43ZEXa7sRibyCPUUUU U== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspamd-Queue-Id: C063C10000D X-Rspam-User: X-Stat-Signature: wqpwdfjxyhe5p73ii5ykxcedybadewg7 X-Rspamd-Server: rspam03 X-HE-Tag: 1712759926-197425 X-HE-Meta: U2FsdGVkX19XATwsOGTKsQPc0ble7qhsObCXEaJMj3km7xasFl5JGIQjoDY808y5lnwD3SBJhVIkyuOqyQVgkh6hXmIv0ScC/QcsOLh6CntNSSOQzM5rREB1te+W75Z7ChHOyQq6wTQ8/ppHZJLdha4Fwuk1MNIX1p2gITz02zjZvYQOjZqzXITEj0fqhl7FkjcDoaot6C0RJd3lcv5L6j31wRlwcQ6LADb3IMQicQA+qhW52krCAuL4Jb08i1ZfGQRq7NR2jM7hp7RaPV4TfI3Azz/UMPahzZwut0Z/BhyNkep9t9v52fE6PzC3UgEKiJmUN7N9NSMJcJxB2aS5eK7kSPossyexPs/NMUmke+OGLip6MjhqluBlUF+n7SbZ58fzUd/eqi31L6SsDr2edkKFWQPDjTV2aSIlHdgiRLkd3TnzcqhPk1QjIUHsEkdEZ9yDYNymAKeZ74JLjiqvzb/oakkzio6CTEHRcY3anoK23xhoh7WifEVmnZnAIxX69sdziazs0DaIC2AMdc7xkGS2EkQTifaZfQq66U6z84tw9vk3tKbB2+lvm9zG+QJwQcH+fdI7lOQFt6F/jaAopmxPjKKrcje6SyFQfxCyRocKctt8GchI084KAjp84XbijGWOzAvPt5yh0mQgn3159q3fFZQyYD64CWvT870e8JdA9cI/kYUFK1B3hHnfqUM+n1nBhqg5e1LQLucDpShqtKvWwBJP4HsFhkni4VFIfcKpcgiX4Nxs0ymsVAQ0BgKAVGvYovp87ll2sKXZG3HuZ9cSmP6o9upEJq39Ts/n/HG83TvmCDFOEP9WiLqZXPPHEFos/iKAI67JlWQBQOgByXP7bhajETIERs/djgOTmmZQ2aX+cL39LYoflptck5vKzpad4QL1t5Fyr4MkKWfhZQgn1xXemAFEmXpQsCLj66gH/lV9k+0Vvyaf3HRUin3eOa+qlmMf1h4uDS8zngk ttPOR61c lvoypD46c++eyX4K7S9sb69UtRAGROEpmEK3zWGADp6/rzlCd3+K1Xuk0HYgWAFsLkhvU2VdsKBbZ2e2NpflWYJXJteoVOQBZE0Whfo6HPTqyFTq6lusYHi2o1+tmV9lJVjtUpbNTGFglqGlUWQrBSeBJ9dByAFKZInc8/POPGVp4OC8rDsNxizBJK/42NTNVhGzFJsgAdWhQhnI= 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;