From patchwork Wed Apr 4 19:18:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 895122 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40GbZr07gtz9s0v for ; Thu, 5 Apr 2018 05:27:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752389AbeDDT1e (ORCPT ); Wed, 4 Apr 2018 15:27:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49394 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751874AbeDDTTR (ORCPT ); Wed, 4 Apr 2018 15:19:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3C6740201A6; Wed, 4 Apr 2018 19:19:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E2BF94584; Wed, 4 Apr 2018 19:19:16 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, Alexander Viro Subject: [RFC PATCH 33/79] fs/journal: add struct super_block to jbd2_journal_forget() arguments. Date: Wed, 4 Apr 2018 15:18:07 -0400 Message-Id: <20180404191831.5378-18-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Apr 2018 19:19:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Apr 2018 19:19:17 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Jérôme Glisse For the holy crusade to stop relying on struct page mapping field, add struct super_block to jbd2_journal_forget() arguments. spatch --sp-file zemantic-010a.spatch --in-place --dir fs/ ---------------------------------------------------------------------- @exists@ expression E1, E2; identifier I; @@ struct super_block *I; ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I, E2) @exists@ expression E1, E2; identifier F, I; @@ F(..., struct super_block *I, ...) { ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I, E2) ... } @exists@ expression E1, E2; identifier I; @@ struct block_device *I; ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I->bd_super, E2) @exists@ expression E1, E2; identifier F, I; @@ F(..., struct block_device *I, ...) { ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I->bd_super, E2) ... } @exists@ expression E1, E2; identifier I; @@ struct inode *I; ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I->i_sb, E2) @exists@ expression E1, E2; identifier F, I; @@ F(..., struct inode *I, ...) { ... -jbd2_journal_forget(E1, E2) +jbd2_journal_forget(E1, I->i_sb, E2) ... } ---------------------------------------------------------------------- Signed-off-by: Jérôme Glisse Cc: "Theodore Ts'o" Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org --- fs/ext4/ext4_jbd2.c | 2 +- fs/jbd2/revoke.c | 2 +- fs/jbd2/transaction.c | 3 ++- include/linux/jbd2.h | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index 2d593201cf7a..0804d564b529 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c @@ -224,7 +224,7 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle, (!is_metadata && !ext4_should_journal_data(inode))) { if (bh) { BUFFER_TRACE(bh, "call jbd2_journal_forget"); - err = jbd2_journal_forget(handle, bh); + err = jbd2_journal_forget(handle, inode->i_sb, bh); if (err) ext4_journal_abort_handle(where, line, __func__, bh, handle, err); diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index 696ef15ec942..b6e2fd52acd6 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c @@ -381,7 +381,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr, set_buffer_revokevalid(bh); if (bh_in) { BUFFER_TRACE(bh_in, "call jbd2_journal_forget"); - jbd2_journal_forget(handle, bh_in); + jbd2_journal_forget(handle, bdev->bd_super, bh_in); } else { BUFFER_TRACE(bh, "call brelse"); __brelse(bh); diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index ac311037d7a5..e8c50bb5822c 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1482,7 +1482,8 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) * Allow this call even if the handle has aborted --- it may be part of * the caller's cleanup after an abort. */ -int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) +int jbd2_journal_forget (handle_t *handle, struct super_block *sb, + struct buffer_head *bh) { transaction_t *transaction = handle->h_transaction; journal_t *journal; diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index b708e5169d1d..d89749a179eb 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1358,7 +1358,8 @@ extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); void jbd2_journal_set_triggers(struct buffer_head *, struct jbd2_buffer_trigger_type *type); extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); -extern int jbd2_journal_forget (handle_t *, struct buffer_head *); +extern int jbd2_journal_forget (handle_t *, struct super_block *sb, + struct buffer_head *); extern void journal_sync_buffer (struct buffer_head *); extern int jbd2_journal_invalidatepage(journal_t *, struct page *, unsigned int, unsigned int); From patchwork Wed Apr 4 19:18:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 895121 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40GbZT0Nd6z9s0t for ; Thu, 5 Apr 2018 05:27:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752171AbeDDT1N (ORCPT ); Wed, 4 Apr 2018 15:27:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49410 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751950AbeDDTTS (ORCPT ); Wed, 4 Apr 2018 15:19:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA50E40201A7; Wed, 4 Apr 2018 19:19:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15CDB94580; Wed, 4 Apr 2018 19:19:17 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, Alexander Viro Subject: [RFC PATCH 34/79] fs/journal: add struct inode to jbd2_journal_revoke() arguments. Date: Wed, 4 Apr 2018 15:18:08 -0400 Message-Id: <20180404191831.5378-19-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Apr 2018 19:19:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Apr 2018 19:19:17 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Jérôme Glisse For the holy crusade to stop relying on struct page mapping field, add struct super_block to jbd2_journal_revoke() arguments. spatch --sp-file zemantic-011a.spatch --in-place --dir fs/ ---------------------------------------------------------------------- @exists@ expression E1, E2, E3; identifier I; @@ struct super_block *I; ... -jbd2_journal_revoke(E1, E2, E3) +jbd2_journal_revoke(E1, E2, I, E3) @exists@ expression E1, E2, E3; identifier F, I; @@ F(..., struct super_block *I, ...) { ... -jbd2_journal_revoke(E1, E2, E3) +jbd2_journal_revoke(E1, E2, I, E3) ... } @exists@ expression E1, E2, E3; identifier I; @@ struct inode *I; ... -jbd2_journal_revoke(E1, E2, E3) +jbd2_journal_revoke(E1, E2, I->i_sb, E3) @exists@ expression E1, E2, E3; identifier F, I; @@ F(..., struct inode *I, ...) { ... -jbd2_journal_revoke(E1, E2, E3) +jbd2_journal_revoke(E1, E2, I->i_sb, E3) ... } ---------------------------------------------------------------------- Signed-off-by: Jérôme Glisse Cc: "Theodore Ts'o" Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Jérôme Glisse --- fs/ext4/ext4_jbd2.c | 2 +- fs/jbd2/revoke.c | 2 +- include/linux/jbd2.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index 0804d564b529..5529badca994 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c @@ -237,7 +237,7 @@ int __ext4_forget(const char *where, unsigned int line, handle_t *handle, * data!=journal && (is_metadata || should_journal_data(inode)) */ BUFFER_TRACE(bh, "call jbd2_journal_revoke"); - err = jbd2_journal_revoke(handle, blocknr, bh); + err = jbd2_journal_revoke(handle, blocknr, inode->i_sb, bh); if (err) { ext4_journal_abort_handle(where, line, __func__, bh, handle, err); diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index b6e2fd52acd6..71e690ad9d44 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c @@ -320,7 +320,7 @@ void jbd2_journal_destroy_revoke(journal_t *journal) */ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr, - struct buffer_head *bh_in) + struct super_block *sb, struct buffer_head *bh_in) { struct buffer_head *bh = NULL; journal_t *journal; diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index d89749a179eb..c5133df80fd4 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1450,7 +1450,8 @@ extern void jbd2_journal_destroy_revoke_caches(void); extern int jbd2_journal_init_revoke_caches(void); extern void jbd2_journal_destroy_revoke(journal_t *); -extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); +extern int jbd2_journal_revoke (handle_t *, unsigned long long, + struct super_block *, struct buffer_head *); extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); extern void jbd2_journal_write_revoke_records(transaction_t *transaction, struct list_head *log_bufs); From patchwork Wed Apr 4 19:18:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 895120 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40GbTr4yJYz9s0t for ; Thu, 5 Apr 2018 05:23:28 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752458AbeDDTXN (ORCPT ); Wed, 4 Apr 2018 15:23:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54072 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751981AbeDDTT2 (ORCPT ); Wed, 4 Apr 2018 15:19:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F1DC406E96B; Wed, 4 Apr 2018 19:19:28 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EA1D8443C; Wed, 4 Apr 2018 19:19:27 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, Alexander Viro Subject: [RFC PATCH 69/79] fs/journal: add struct address_space to jbd2_journal_try_to_free_buffers() arguments Date: Wed, 4 Apr 2018 15:18:21 -0400 Message-Id: <20180404191831.5378-32-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Apr 2018 19:19:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Apr 2018 19:19:28 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Jérôme Glisse For the holy crusade to stop relying on struct page mapping field, add struct address_space to jbd2_journal_try_to_free_buffers() arguments. <--------------------------------------------------------------------- @@ type T1, T2, T3; @@ int -jbd2_journal_try_to_free_buffers(T1 journal, T2 page, T3 gfp_mask) +jbd2_journal_try_to_free_buffers(T1 journal, struct address_space *mapping, T2 page, T3 gfp_mask) {...} @@ type T1, T2, T3; @@ int -jbd2_journal_try_to_free_buffers(T1, T2, T3) +jbd2_journal_try_to_free_buffers(T1, struct address_space *, T2, T3) ; @@ expression E1, E2, E3; @@ -jbd2_journal_try_to_free_buffers(E1, E2, E3) +jbd2_journal_try_to_free_buffers(E1, NULL, E2, E3) ---------------------------------------------------------------------> Signed-off-by: Jérôme Glisse Cc: "Theodore Ts'o" Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org --- fs/ext4/inode.c | 3 ++- fs/ext4/super.c | 4 ++-- fs/jbd2/transaction.c | 3 ++- include/linux/jbd2.h | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1a44d9acde53..ef53a57d9768 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3413,7 +3413,8 @@ static int ext4_releasepage(struct address_space *mapping, if (PageChecked(page)) return 0; if (journal) - return jbd2_journal_try_to_free_buffers(journal, page, wait); + return jbd2_journal_try_to_free_buffers(journal, NULL, page, + wait); else return try_to_free_buffers(mapping, page); } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8f98bc886569..cf2b74137fb2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1138,8 +1138,8 @@ static int bdev_try_to_free_page(struct super_block *sb, struct page *page, if (!_page_has_buffers(page, mapping)) return 0; if (journal) - return jbd2_journal_try_to_free_buffers(journal, page, - wait & ~__GFP_DIRECT_RECLAIM); + return jbd2_journal_try_to_free_buffers(journal, NULL, page, + wait & ~__GFP_DIRECT_RECLAIM); return try_to_free_buffers(mapping, page); } diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index bf673b33d436..6899e7b4036d 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1984,7 +1984,8 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) * Return 0 on failure, 1 on success */ int jbd2_journal_try_to_free_buffers(journal_t *journal, - struct page *page, gfp_t gfp_mask) + struct address_space *mapping, + struct page *page, gfp_t gfp_mask) { struct buffer_head *head; struct buffer_head *bh; diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index c5133df80fd4..658a0d2f758f 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1363,7 +1363,9 @@ extern int jbd2_journal_forget (handle_t *, struct super_block *sb, extern void journal_sync_buffer (struct buffer_head *); extern int jbd2_journal_invalidatepage(journal_t *, struct page *, unsigned int, unsigned int); -extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); +extern int jbd2_journal_try_to_free_buffers(journal_t *, + struct address_space *, + struct page *, gfp_t); extern int jbd2_journal_stop(handle_t *); extern int jbd2_journal_flush (journal_t *); extern void jbd2_journal_lock_updates (journal_t *);