From patchwork Wed Oct 2 04:01:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13819306 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A02BACF3195 for ; Wed, 2 Oct 2024 04:01:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA2D2440178; Wed, 2 Oct 2024 00:01:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A273F440175; Wed, 2 Oct 2024 00:01:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A606440178; Wed, 2 Oct 2024 00:01:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 586EE440175 for ; Wed, 2 Oct 2024 00:01:21 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id EFD4B1C71AB for ; Wed, 2 Oct 2024 04:01:20 +0000 (UTC) X-FDA: 82627312320.01.A659001 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 5061820004 for ; Wed, 2 Oct 2024 04:01:19 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DMtIe9YM; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727841640; a=rsa-sha256; cv=none; b=udQNR3kGn5cJcJhHl37+hSYa/4aYtuj+aQlM6ZEpoAZRUguGw5L8hUjHh2CodHxZINaDHg zGGeGhWwzmzr0c6LFMCOJ8L8kUGdHUZKk6LQ8y5CIOvapfQaVcRMH1qDEBfK3dzADbC57u 1p/QC60g7LlBa+mlqyggn4DLKp52I2E= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DMtIe9YM; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727841640; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jm1g6XtuabKqm9/JIMlSTf6MikBfRVYmTm8EFY+uDyU=; b=6WeT/cWXjwJoSx0HjRXrBrsn9dJjWF4mGKL6gG6QLrtxyjMkivGUQZQVvUhadJTGn43twD mVHhEvFrsPmmt/YoOoVwxmELcVLoxESThrBFe9dnm4NMn7c31JotK5M6zcdCDvPQeocc7d of0rnSC80cmOayvczeyW5YSAJz7VK+4= 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=jm1g6XtuabKqm9/JIMlSTf6MikBfRVYmTm8EFY+uDyU=; b=DMtIe9YMNkx31KhDVNPCTySp1x pXXraeUTSuORncN9UhAdmxtUQ8bt5st5ctV3seN3YE7qCDfDzL4HB/QqvtEKCX39BJsrmELrtr9CW +daJ720l9aLvJ+RMK24+79cTk7PD65qaKAH4Nro1VTW/YpcPpQyGtYM84yUXydyromE3/CWfGIqK+ qzi7b9t6ZKLHb4eEcCBeMInvSa9UrrrhU7bkWlLrtmGFsP0FY5SICdK90ofGWBi1/tqbEKqi6UVtW vGSOo0uqu+hPAYjEEF0SufgLYzBJCCJCZmTDGy0+965MEKyevWlEI6vUfAYGk8H9b4bbrKctu1ltA kxEmSWBg==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1svqY5-00000004I8V-3AQG; Wed, 02 Oct 2024 04:01:13 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Date: Wed, 2 Oct 2024 05:01:04 +0100 Message-ID: <20241002040111.1023018-3-willy@infradead.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241002040111.1023018-1-willy@infradead.org> References: <20241002040111.1023018-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 5061820004 X-Rspamd-Server: rspam01 X-Stat-Signature: cj7kwcngoz9h15oyicntzc857jmbir5o X-HE-Tag: 1727841679-381552 X-HE-Meta: U2FsdGVkX19HUAbNArzIu/v1gd7MFKopjP59oTqcCjyFx5RFRyo/ayeUl1kqBUrZfBwP1gC/16A5natTMTwyZgsX+R0lVhmofEwuzZk1adYpNu1CcdPusvm4UBMEE7Um7n5N1VPnK4AOqyurpMD6MHhXVNDZh/oCEqlbGK6hGgaPZxxpTA+g+h50MmecL8HPNFWND9wgqvN9VgnPET2XbuQiTnbWj80dy3diBXdwhrIXFEbyFV23rUGv2pfB0UCH4TsWwgP0YuvbbSTyOCHgx4bNmW4XfH+lguIRLggL7t8xpifdYQs/N/xUsswFsK5/QImQ2rGqcbfTs953FpoVGIzlS2bOg5kH/pP9IINWLON3+01Z/EQ2qzoYylWJuzjkBYdh2FQ+BNH7vAauWkXIA/ZaAWjzAnfAyiGEkcZtnlwjrhvQZn6ktVBuvWQcP857u+0D0Siu5lTJreYG7o8aE9TprypNGsjNkgiVL95lakH93mz7Gw9h/JPDWQ/UDCvPDhRN23WDO1GnTqnh+u1Ku+gRYp85QpAWl+XTeq3ES1SDbOzpUmUB9F/9/zoO4WcldbD19l96AUlEbTUNeJxmOIGOlKNmribRvgx391r30UfsuB1GlSsapAaP1JeZKGsNSkOtdSxk6hoXB4xxBsyTNibyAlunuLL/P+mDT0cHmtZ2yinDEtH2xuFK7L/Au1nmZ5wWxTWGILNn+G+A87BedMYdB4rY76+CT3nBTKSu8fgUDQWJZTu8bBQIGoLINd9s/2P+4gHZVD1ez70y17QT8auzfXp2zVgvcyWmm0Ern3ysqhAVqD4kVe9R+9VV5aV2gYzdlBrvEPnuyFUSP/rq5akX/FeKPwob88s1nNrx5DvHHPg1DEiD8IfnQpYQlMaTNNlEVB3FIt08Uxk0Dca7qrq2b2c+dRI+T6ft7v48G3O2HkVngiSW31lM2bgkrhxXP59uDd6SyDarWu7qpr4 t8q93+Lc PAAzvIMeIdD5NELwc2SbEvqrJ8S2LV2jRtFHYZ2JpdZxelMqX7IPtyI98VB+AN6Er006lY2gX91TKmEXbG8Mr6zVlJ0UEu9hmyk03d8L7TjPDQQaU4//sezBgNR0E6Gmd8G7Fq4PSHVIuwpPpv2+aGN3BAla2OFVLty/qSIndnlJ3mEr4kWBFMrf5qnT+AM2EIukMRqtGnk8Ed8y1KCLaAiIXXW48ADjAYRjp3M+/On9Adrpg0xI5ALe+SDdQmqiwPPkXCS4M/Yq0/HoeRQ8YAAr8yrBc/uWsA8+O 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: List-Subscribe: List-Unsubscribe: Use folio APIs instead of page APIs. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/page.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 9c0b7cddeaae..16bb82cdbc07 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -98,16 +98,16 @@ void nilfs_forget_buffer(struct buffer_head *bh) */ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh) { - void *kaddr0, *kaddr1; + void *saddr, *daddr; unsigned long bits; - struct page *spage = sbh->b_page, *dpage = dbh->b_page; + struct folio *sfolio = sbh->b_folio, *dfolio = dbh->b_folio; struct buffer_head *bh; - kaddr0 = kmap_local_page(spage); - kaddr1 = kmap_local_page(dpage); - memcpy(kaddr1 + bh_offset(dbh), kaddr0 + bh_offset(sbh), sbh->b_size); - kunmap_local(kaddr1); - kunmap_local(kaddr0); + saddr = kmap_local_folio(sfolio, bh_offset(sbh)); + daddr = kmap_local_folio(dfolio, bh_offset(dbh)); + memcpy(daddr, saddr, sbh->b_size); + kunmap_local(daddr); + kunmap_local(saddr); dbh->b_state = sbh->b_state & NILFS_BUFFER_INHERENT_BITS; dbh->b_blocknr = sbh->b_blocknr; @@ -121,13 +121,13 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh) unlock_buffer(bh); } if (bits & BIT(BH_Uptodate)) - SetPageUptodate(dpage); + folio_mark_uptodate(dfolio); else - ClearPageUptodate(dpage); + folio_clear_uptodate(dfolio); if (bits & BIT(BH_Mapped)) - SetPageMappedToDisk(dpage); + folio_set_mappedtodisk(dfolio); else - ClearPageMappedToDisk(dpage); + folio_clear_mappedtodisk(dfolio); } /**