Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93A86C433EF for ; Mon, 2 May 2022 05:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383415AbiEBGAo (ORCPT ); Mon, 2 May 2022 02:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383408AbiEBGA1 (ORCPT ); Mon, 2 May 2022 02:00:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B436B205E4 for ; Sun, 1 May 2022 22:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=e7caWPCCYvvl/M31IWhJn+FN6kXXIF79gpn2aS5zJ9o=; b=bn9Cy7hwG+Wv65tD12cCd0kDsP EBh/cw2NaUT6s/dz9r6yvEOwzTwWUBZne8RZN6t/BIezg/b0POh4/4PIwpfthiB2AlJTzPbhJS3ge hkpYZoc4QMbYNLpTndv93isxkqWf+LHKnqr4B/Q8NdfahuzxrJ6pNv2Athl5N/sDnaN3rRhQhA2b1 F22DugUHRbI+ttvAOiP7Sez+JoXSqviIusHOyI35saC1xBG+m1qh208imZq4ufYl6AuMBXpXa5SDg itx1VduqWGrqXyv7sm9qMxvx/F8JjIUOsbrr4ADBwyfxJ1HZjjOZcAH2nGBj3255EZr5YHDlU37I5 In5Z6dQg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlP2h-00EZXE-Tl; Mon, 02 May 2022 05:56:19 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 23/26] jbd2: Convert jbd2_journal_try_to_free_buffers to take a folio Date: Mon, 2 May 2022 06:56:11 +0100 Message-Id: <20220502055614.3473032-24-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220502055614.3473032-1-willy@infradead.org> References: <20220502055614.3473032-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Also convert it to return a bool since it's called from release_folio(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/ext4/inode.c | 2 +- fs/jbd2/transaction.c | 12 ++++++------ include/linux/jbd2.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 52c46ac5bc8a..943937cb5302 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3253,7 +3253,7 @@ static bool ext4_release_folio(struct folio *folio, gfp_t wait) if (folio_test_checked(folio)) return false; if (journal) - return jbd2_journal_try_to_free_buffers(journal, &folio->page); + return jbd2_journal_try_to_free_buffers(journal, folio); else return try_to_free_buffers(&folio->page); } diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index fcb9175016a5..ee33d277d51e 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -2143,17 +2143,17 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) * cannot happen because we never reallocate freed data as metadata * while the data is part of a transaction. Yes? * - * Return 0 on failure, 1 on success + * Return false on failure, true on success */ -int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page) +bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio) { struct buffer_head *head; struct buffer_head *bh; - int ret = 0; + bool ret = false; - J_ASSERT(PageLocked(page)); + J_ASSERT(folio_test_locked(folio)); - head = page_buffers(page); + head = folio_buffers(folio); bh = head; do { struct journal_head *jh; @@ -2175,7 +2175,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page) goto busy; } while ((bh = bh->b_this_page) != head); - ret = try_to_free_buffers(page); + ret = try_to_free_buffers(&folio->page); busy: return ret; } diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index de9536680b2b..e79d6e0b14e8 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1529,7 +1529,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); extern int jbd2_journal_forget (handle_t *, struct buffer_head *); int jbd2_journal_invalidate_folio(journal_t *, struct folio *, size_t offset, size_t length); -extern int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page); +bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio); extern int jbd2_journal_stop(handle_t *); extern int jbd2_journal_flush(journal_t *journal, unsigned int flags); extern void jbd2_journal_lock_updates (journal_t *); -- 2.34.1