From patchwork Wed Jul 7 11:55:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 12362447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB5D1C07E9C for ; Wed, 7 Jul 2021 11:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91A3B61CBA for ; Wed, 7 Jul 2021 11:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbhGGL6R (ORCPT ); Wed, 7 Jul 2021 07:58:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42703 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbhGGL6Q (ORCPT ); Wed, 7 Jul 2021 07:58:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625658936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qPJsqAcnSU2ZAj50+YTPOM8+B3MPWLT+Iz3R/yvUMtE=; b=eCJ9nk6Aj8YbluHqEzV3zoiuv4wnxvFomvZ7V1ljnu3Xoq86t+xjF8HSI63HiaddmVkHU0 c0qSl9fPJwNf9vMcuuc+HspAujD+GbuX23iVl3PhhT6Ns6EL6ziPxDAMrBR3BQ7Vrq0oYq sayMiA7ML6ItHnzzyELVdbOZYueqEMQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-170-rJLzJnjmPh6ptWBpwNVZgw-1; Wed, 07 Jul 2021 07:55:35 -0400 X-MC-Unique: rJLzJnjmPh6ptWBpwNVZgw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24C4B804140; Wed, 7 Jul 2021 11:55:34 +0000 (UTC) Received: from max.com (unknown [10.40.192.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D5FA5D6AB; Wed, 7 Jul 2021 11:55:32 +0000 (UTC) From: Andreas Gruenbacher To: Christoph Hellwig Cc: "Darrick J . Wong" , Matthew Wilcox , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, Andreas Gruenbacher , Christoph Hellwig Subject: [PATCH v3 1/3] iomap: Permit pages without an iop to enter writeback Date: Wed, 7 Jul 2021 13:55:22 +0200 Message-Id: <20210707115524.2242151-2-agruenba@redhat.com> In-Reply-To: <20210707115524.2242151-1-agruenba@redhat.com> References: <20210707115524.2242151-1-agruenba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Create an iop in the writeback path if one doesn't exist. This allows us to avoid creating the iop in some cases. We'll initially do that for pages with inline data, but it can be extended to pages which are entirely within an extent. It also allows for an iop to be removed from pages in the future (eg page split). Co-developed-by: Matthew Wilcox (Oracle) Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 9023717c5188..598fcfabc337 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1334,14 +1334,13 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, struct writeback_control *wbc, struct inode *inode, struct page *page, u64 end_offset) { - struct iomap_page *iop = to_iomap_page(page); + struct iomap_page *iop = iomap_page_create(inode, page); struct iomap_ioend *ioend, *next; unsigned len = i_blocksize(inode); u64 file_offset; /* file offset of page */ int error = 0, count = 0, i; LIST_HEAD(submit_list); - WARN_ON_ONCE(i_blocks_per_page(inode, page) > 1 && !iop); WARN_ON_ONCE(iop && atomic_read(&iop->write_bytes_pending) != 0); /* From patchwork Wed Jul 7 11:55:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 12362449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B45AFC07E9B for ; Wed, 7 Jul 2021 11:55:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A10B361C78 for ; Wed, 7 Jul 2021 11:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231406AbhGGL6T (ORCPT ); Wed, 7 Jul 2021 07:58:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25875 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbhGGL6T (ORCPT ); Wed, 7 Jul 2021 07:58:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625658938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pmZDH/DEXLKzetTFHJTrnle9t5h1vn/VXibFPU+EECg=; b=XcaNQ0emKYhDM5hieO+AbVW80hG5WqVjeko2AvqSDvpzColHrLtuiuZ9rYWS4aJpEWpj93 vlbruzFchiPiqlUDMpVkNxzCbem1tZbXDkZ0Ay6LedYpAcMqS8NrmE2gIZVU3l0S0GCt5x buUH2Hh4IiDJno94uITbnrJmt7vlegI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-MKwmJq3kOySQVW3Oj-LRrw-1; Wed, 07 Jul 2021 07:55:37 -0400 X-MC-Unique: MKwmJq3kOySQVW3Oj-LRrw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3825B100C676; Wed, 7 Jul 2021 11:55:36 +0000 (UTC) Received: from max.com (unknown [10.40.192.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 786B45D6AB; Wed, 7 Jul 2021 11:55:34 +0000 (UTC) From: Andreas Gruenbacher To: Christoph Hellwig Cc: "Darrick J . Wong" , Matthew Wilcox , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, Andreas Gruenbacher Subject: [PATCH v3 2/3] iomap: Don't create iomap_page objects for inline files Date: Wed, 7 Jul 2021 13:55:23 +0200 Message-Id: <20210707115524.2242151-3-agruenba@redhat.com> In-Reply-To: <20210707115524.2242151-1-agruenba@redhat.com> References: <20210707115524.2242151-1-agruenba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In iomap_readpage_actor, don't create iop objects for inline inodes. Otherwise, iomap_read_inline_data will set PageUptodate without setting iop->uptodate, and iomap_page_release will eventually complain. To prevent this kind of bug from occurring in the future, make sure the page doesn't have private data attached in iomap_read_inline_data. Signed-off-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 598fcfabc337..6330dabc451e 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -215,6 +215,7 @@ iomap_read_inline_data(struct inode *inode, struct page *page, if (PageUptodate(page)) return; + BUG_ON(page_has_private(page)); BUG_ON(page->index); BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data)); @@ -239,7 +240,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, { struct iomap_readpage_ctx *ctx = data; struct page *page = ctx->cur_page; - struct iomap_page *iop = iomap_page_create(inode, page); + struct iomap_page *iop; bool same_page = false, is_contig = false; loff_t orig_pos = pos; unsigned poff, plen; @@ -252,6 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, } /* zero post-eof blocks as the page may be mapped */ + iop = iomap_page_create(inode, page); iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen); if (plen == 0) goto done; From patchwork Wed Jul 7 11:55:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 12362451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 201FFC07E95 for ; Wed, 7 Jul 2021 11:55:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED3B961C98 for ; Wed, 7 Jul 2021 11:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhGGL6X (ORCPT ); Wed, 7 Jul 2021 07:58:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54959 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbhGGL6W (ORCPT ); Wed, 7 Jul 2021 07:58:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625658942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=01t/M19/kHw7B+xIPC9qD3IENRynioNr014CNoPUsY8=; b=eeZlwzCoxQzTY6CFoiaFvGofKxQDGrDn/5B2/FrCFMj+dYXXlWNIW72EvOy2c/JCvzbjTQ jnUjdWobn4CtX7n2JZ+ie7QlCgxEgRRkLKNz/23oIewUHUoE3YmUbqUe3jE9qeaHpFtczz wolBZKBG4Z+Uq/LFch7XRAD9IYDX+uY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-532-CfjWZsIJMKy7wkjgOc4r5A-1; Wed, 07 Jul 2021 07:55:39 -0400 X-MC-Unique: CfjWZsIJMKy7wkjgOc4r5A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24B16344A1; Wed, 7 Jul 2021 11:55:38 +0000 (UTC) Received: from max.com (unknown [10.40.192.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 799885D6AB; Wed, 7 Jul 2021 11:55:36 +0000 (UTC) From: Andreas Gruenbacher To: Christoph Hellwig Cc: "Darrick J . Wong" , Matthew Wilcox , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, Andreas Gruenbacher Subject: [PATCH v3 3/3] iomap: Don't create iomap_page objects in iomap_page_mkwrite_actor Date: Wed, 7 Jul 2021 13:55:24 +0200 Message-Id: <20210707115524.2242151-4-agruenba@redhat.com> In-Reply-To: <20210707115524.2242151-1-agruenba@redhat.com> References: <20210707115524.2242151-1-agruenba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Now that we create those objects in iomap_writepage_map when needed, there's no need to pre-create them in iomap_page_mkwrite_actor anymore. Signed-off-by: Andreas Gruenbacher Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 6330dabc451e..9f45050b61dd 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -999,7 +999,6 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, block_commit_write(page, 0, length); } else { WARN_ON_ONCE(!PageUptodate(page)); - iomap_page_create(inode, page); set_page_dirty(page); }