From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 29943C2D0A7 for ; Thu, 10 Sep 2020 19:33:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECFC921D81 for ; Thu, 10 Sep 2020 19:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbgIJTdy (ORCPT ); Thu, 10 Sep 2020 15:33:54 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43006 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgIJTbh (ORCPT ); Thu, 10 Sep 2020 15:31:37 -0400 Received: from mail-qk1-f200.google.com ([209.85.222.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kGSIB-0000ib-37 for linux-ext4@vger.kernel.org; Thu, 10 Sep 2020 19:31:35 +0000 Received: by mail-qk1-f200.google.com with SMTP id s141so4321837qka.13 for ; Thu, 10 Sep 2020 12:31:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3SZen2y6K+eX+Acff0PC37lH0dwsf+MyxigV9F/BcKg=; b=eh7iZNizR3qu8eqoU96Vbp96ZCY9kWRKrPvtUTyl6hmb2+P2WkWmpWEDX3zcjXEgQ+ 1wMb6DAWF0E5wcV2OqxCqcclCvw3dK43WSzsqLQt+NGxBKg7JOM/TCTeyV4378NbDvdh hg7JD31zq8XIPZDbxnPBEu/HvNuMACZxD1JMNcic7O7rQDb2+olfMstiU31t6IzEFHhY EY3U7EUNkVxUmhmwT5lIhRiWICc8jHUkkDAZp4479Gl78uyzey0OpXuWirZvP4zbn5X0 lpHeG9vTltjeLQ/trYLFoMu30cL+VwQBN3tEkH1dW4NPyL79GJFqxGEjLRCiO+JGgihG ZGIw== X-Gm-Message-State: AOAM533oW2YPmhLZp6d7cWYlMZ53EmVObD5GJqOYTcj/+fNKg2COjF8V 4KIqbHGl9f2DSYdITqQQLXJpN/9e3yeH/tlvK1S+Lj7ETMp6AXzYzIWh2cq+FW1NOc0jfgUxbd2 FOh6dUYXto8mZF3XkmDj0tdG/IKWjTRFqbTylm6Y= X-Received: by 2002:ac8:743:: with SMTP id k3mr9878649qth.182.1599766294104; Thu, 10 Sep 2020 12:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/VErnBmL5lJo1R9q0rx7mfoORd6dxd7jVrDbB6VHvn5oCmJXu4teKr8Zo77K/YeDe+/3Saw== X-Received: by 2002:ac8:743:: with SMTP id k3mr9878630qth.182.1599766293837; Thu, 10 Sep 2020 12:31:33 -0700 (PDT) Received: from localhost.localdomain ([201.82.49.101]) by smtp.gmail.com with ESMTPSA id u4sm6410391qkk.68.2020.09.10.12.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 12:31:33 -0700 (PDT) From: Mauricio Faria de Oliveira To: Jan Kara Cc: linux-ext4@vger.kernel.org, dann frazier , Mauricio Faria de Oliveira Subject: [RFC PATCH v3 1/3] jbd2: introduce/export functions jbd2_journal_submit|finish_inode_data_buffers() Date: Thu, 10 Sep 2020 16:31:25 -0300 Message-Id: <20200910193127.276214-2-mfo@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910193127.276214-1-mfo@canonical.com> References: <20200910193127.276214-1-mfo@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Export functions that implement the current behavior done for an inode in journal_submit|finish_inode_data_buffers(). No functional change. Signed-off-by: Mauricio Faria de Oliveira Suggested-by: Jan Kara --- fs/jbd2/commit.c | 32 +++++++++++++++++--------------- fs/jbd2/journal.c | 2 ++ include/linux/jbd2.h | 4 ++++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6d2da8ad0e6f..c17cda96926e 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -187,9 +187,11 @@ static int journal_wait_on_commit_record(journal_t *journal, * use writepages() because with delayed allocation we may be doing * block allocation in writepages(). */ -static int journal_submit_inode_data_buffers(struct address_space *mapping, - loff_t dirty_start, loff_t dirty_end) +int jbd2_journal_submit_inode_data_buffers(struct jbd2_inode *jinode) { + struct address_space *mapping = jinode->i_vfs_inode->i_mapping; + loff_t dirty_start = jinode->i_dirty_start; + loff_t dirty_end = jinode->i_dirty_end; int ret; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, @@ -215,16 +217,11 @@ static int journal_submit_data_buffers(journal_t *journal, { struct jbd2_inode *jinode; int err, ret = 0; - struct address_space *mapping; spin_lock(&journal->j_list_lock); list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { - loff_t dirty_start = jinode->i_dirty_start; - loff_t dirty_end = jinode->i_dirty_end; - if (!(jinode->i_flags & JI_WRITE_DATA)) continue; - mapping = jinode->i_vfs_inode->i_mapping; jinode->i_flags |= JI_COMMIT_RUNNING; spin_unlock(&journal->j_list_lock); /* @@ -234,8 +231,7 @@ static int journal_submit_data_buffers(journal_t *journal, * only allocated blocks here. */ trace_jbd2_submit_inode_data(jinode->i_vfs_inode); - err = journal_submit_inode_data_buffers(mapping, dirty_start, - dirty_end); + err = jbd2_journal_submit_inode_data_buffers(jinode); if (!ret) ret = err; spin_lock(&journal->j_list_lock); @@ -248,6 +244,17 @@ static int journal_submit_data_buffers(journal_t *journal, return ret; } +int jbd2_journal_finish_inode_data_buffers(struct jbd2_inode *jinode) +{ + struct address_space *mapping = jinode->i_vfs_inode->i_mapping; + loff_t dirty_start = jinode->i_dirty_start; + loff_t dirty_end = jinode->i_dirty_end; + int ret; + + ret = filemap_fdatawait_range_keep_errors(mapping, dirty_start, dirty_end); + return ret; +} + /* * Wait for data submitted for writeout, refile inodes to proper * transaction if needed. @@ -262,16 +269,11 @@ static int journal_finish_inode_data_buffers(journal_t *journal, /* For locking, see the comment in journal_submit_data_buffers() */ spin_lock(&journal->j_list_lock); list_for_each_entry(jinode, &commit_transaction->t_inode_list, i_list) { - loff_t dirty_start = jinode->i_dirty_start; - loff_t dirty_end = jinode->i_dirty_end; - if (!(jinode->i_flags & JI_WAIT_DATA)) continue; jinode->i_flags |= JI_COMMIT_RUNNING; spin_unlock(&journal->j_list_lock); - err = filemap_fdatawait_range_keep_errors( - jinode->i_vfs_inode->i_mapping, dirty_start, - dirty_end); + err = jbd2_journal_finish_inode_data_buffers(jinode); if (!ret) ret = err; spin_lock(&journal->j_list_lock); diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 17fdc482f554..c0600405e7a2 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -91,6 +91,8 @@ EXPORT_SYMBOL(jbd2_journal_try_to_free_buffers); EXPORT_SYMBOL(jbd2_journal_force_commit); EXPORT_SYMBOL(jbd2_journal_inode_ranged_write); EXPORT_SYMBOL(jbd2_journal_inode_ranged_wait); +EXPORT_SYMBOL(jbd2_journal_submit_inode_data_buffers); +EXPORT_SYMBOL(jbd2_journal_finish_inode_data_buffers); EXPORT_SYMBOL(jbd2_journal_init_jbd_inode); EXPORT_SYMBOL(jbd2_journal_release_jbd_inode); EXPORT_SYMBOL(jbd2_journal_begin_ordered_truncate); diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 08f904943ab2..2865a5475888 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1421,6 +1421,10 @@ extern int jbd2_journal_inode_ranged_write(handle_t *handle, extern int jbd2_journal_inode_ranged_wait(handle_t *handle, struct jbd2_inode *inode, loff_t start_byte, loff_t length); +extern int jbd2_journal_submit_inode_data_buffers( + struct jbd2_inode *jinode); +extern int jbd2_journal_finish_inode_data_buffers( + struct jbd2_inode *jinode); extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, struct jbd2_inode *inode, loff_t new_size); extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); -- 2.17.1