From patchwork Tue Jun 15 16:23:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12322367 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,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 9FC56C48BDF for ; Tue, 15 Jun 2021 16:25:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 469A3616E9 for ; Tue, 15 Jun 2021 16:25:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 469A3616E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E29206B0072; Tue, 15 Jun 2021 12:25:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E00716B0073; Tue, 15 Jun 2021 12:25:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC86B6B0074; Tue, 15 Jun 2021 12:25:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id 9B49E6B0072 for ; Tue, 15 Jun 2021 12:25:30 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3DA85180AD807 for ; Tue, 15 Jun 2021 16:25:30 +0000 (UTC) X-FDA: 78256483620.11.E30804F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 2362C42D for ; Tue, 15 Jun 2021 16:25:17 +0000 (UTC) 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=z7u3S8CmzDwUu+KyqGJsHre51dm3R8D4XFikCNhQZro=; b=TrwGrPYYk0csy2V772vjm/TBMs MPFn4TL2k+daZO7QYkEneGiuGooTGskcXwH1KskqBbq+ybWlJ+60+c4om7tTC7juy61j+r/p1F7K/ LJbYGC2O7nO3XRFM7re5hqvFqSq0VBQKNkF7VvbDWZ+NWRaDIEFlu7f2294dILHKo2Ya52XsD2GFK gQOELbQBimN3ZFMv+26wwOuY4WdXDyvzpEgD9prfm8eyI2OskkXr1++RjxVfBt/ruZfXd6Rn9y7lZ ekt1sHzxy/XrcErWU0wr12BJFoj5PprVYo5mbDIn8IMG3P2uaD2S5Zx/Su4dR6kvvrls0ivMcrSYu wWVvCGJA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltBrf-0070MF-UG; Tue, 15 Jun 2021 16:24:44 +0000 From: "Matthew Wilcox (Oracle)" To: Christoph Hellwig , Andrew Morton , Jan Kara , Al Viro , Greg Kroah-Hartman , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 2/6] mm/writeback: Use __set_page_dirty in __set_page_dirty_nobuffers Date: Tue, 15 Jun 2021 17:23:38 +0100 Message-Id: <20210615162342.1669332-3-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615162342.1669332-1-willy@infradead.org> References: <20210615162342.1669332-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 2362C42D Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TrwGrPYY; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: ofo4kkkcq1nmxohexe1eawjuz9dws91w X-HE-Tag: 1623774317-881683 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: This is fundamentally the same code, so just call it instead of duplicating it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman --- mm/page-writeback.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0c2c8355f97f..980a6cb9cbd9 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2503,20 +2503,12 @@ int __set_page_dirty_nobuffers(struct page *page) lock_page_memcg(page); if (!TestSetPageDirty(page)) { struct address_space *mapping = page_mapping(page); - unsigned long flags; if (!mapping) { unlock_page_memcg(page); return 1; } - - xa_lock_irqsave(&mapping->i_pages, flags); - BUG_ON(page_mapping(page) != mapping); - WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); - account_page_dirtied(page, mapping); - __xa_set_mark(&mapping->i_pages, page_index(page), - PAGECACHE_TAG_DIRTY); - xa_unlock_irqrestore(&mapping->i_pages, flags); + __set_page_dirty(page, mapping, !PagePrivate(page)); unlock_page_memcg(page); if (mapping->host) {