From patchwork Mon Jun 6 20:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870944 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 aib29ajc252.phx1.oracleemaildelivery.com (aib29ajc252.phx1.oracleemaildelivery.com [192.29.103.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CD67EC43334 for ; Mon, 6 Jun 2022 20:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=FqMaegU8esU4J4gWGo2ztjGHdixvEhcvbwtIRtlyCwk=; b=VP5OHT5CThkCdmjXAm3OfQWf9bGzQ9Z8EBKadrInaV7CzAFmPr2S0db+yLX5SRRKZEm1pyPaja5N aH+cQ0Dosl18Sa/nYIZouXAPaG1Ez4vFOW0Xx89lU8F04g+BV3/oZ5iO1vb0pwGgcNguSklP2GyO ZQRjL+fKBXjr+g+V1ZMU0Z4gznMj8N1ywAcYnnk6EySB4Qh1g/l2hp/Y4sWRUwSu+dPAfeUXipYO FjjMpVDeS7JQrALdAzc3FnSv4o+CbnlpFl/OzUQSmoserGPPCD/vmOHLgzsYSopdH8gkYMXZJlVW pJspPE7MQFBt+AWtNLK/o78pUSINpB07qe7odQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=FqMaegU8esU4J4gWGo2ztjGHdixvEhcvbwtIRtlyCwk=; b=MeERSWTV2BhUIUhjKCuTrEkj5v6LHsBayYj3LnEX5/munPn4TN+Xj9EqsvLrypiVfUsRV2sKUTaw cl6JxOePpSLlPqRfnM3O4fZ15p9h1T8vM8cIjSBZmCriGKky9rmGJ5lbKCqZGaXCT5SuAKXQkfbi 5GQI9q1Ab/VvJNwQbZPM9Mm8BvdBN4vE0Ni33jk2iMeBXhMeokqL62vAVPaFtGvEit6y+fPNa9pU LmSUNHU7v3jSsZJOxDSalK+09LCQ40tl788UUKFwc0Cq+fYJdWVALVOJ9CVgh7Y2+aEfHPmgwUKK KoPwPUie46s4XDYfbIR4tNlM8O6Nu5Wn9je6CA== Received: by omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200EZ2PGYZH90@omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:22 +0000 (GMT) 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=kE0e2Kem5Koy9+vslnILU6wEa1eL+hykAc5m9l3vWOk=; b=ZoXiXG9BhM3nKy91XF85EEhCmA x+0+yDgen/JSqUZUOVrwHT2sFkEanrz3b2SRuNhvzkelnmhYQHo3H5w/lxp1m923om6t4J7ZBUl8z pqKeMISVHEu+agUZTchcA5vX6IHgvtaY6xD0zwlwV/HMr83Qrrmrw9nOYpeT9HsqSYa9t3+G8ito5 +M1oHyKTE0ou+70T4p6ln1KzUCbrPs+Utdwzu5MZlydpjTnq7ZPCSNY9IZnONucAQSNa3TpoQh/zU mT3rM0C0mKEd0upHPAairhB+80Ltbs64qeDsd1SFTpgmwfYyIdteGzVQaO27TBq0NroBwtsgwigi6 jlonzS1Q==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:31 +0100 Message-id: <20220606204050.2625949-2-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=163 impostorscore=0 adultscore=0 priorityscore=108 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=567 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 01/20] fs: Add aops->migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: MWh38C5wMeLkyNCuaXxUenZq1Kd9fFB2 X-Proofpoint-GUID: MWh38C5wMeLkyNCuaXxUenZq1Kd9fFB2 Reporting-Meta: AAHQEyQGSzSJQNGu8bPCUMoAs4dNlMrHzztuJWhktkafkkoBvrE1ujnh/k4YV8eR 7ywSA1cPhApfMmn2clYr4TSVj51jM5oSm2LCs8jRxGrHAVWr3qinG/qtKeLtlMiP s4U53ypcE6LC2Yt07P4Y5T6yWDmwxLvckHGVlPIXaYBOvUJ3f6hE9zc+5qRYEKDW n9ONya+AdDDcOwiIrbHA8WokV3OMHblHZuecaEjVO8r8Utjz08NLR+ZNn6W9YhN8 KHNXvfo7lyaxqMlG5iNVTtMBoqN4CLULxgInwHfm4pnygwckSoHHDMw13oU0Z7zP B2TvgJi/0AJdB4scLx1czF99auQhNoIY6Iu2jHfZX39nVcY6v9LeUbeRaF7tOxc3 /pTMOTkh8wm35dyUnhAryrptOIl2+zLczdKOaXFQVuhB85+666PeP1dtC7LpVkJA JTR6XTkzhyRLWgkfyT0Q5+LFF8cxOUBTqESdwp4ofufsL448xZWMfqWFje2PUEva D2RDAHV4wek9ofbjtJ5XLoAn7jP87zWtTwksjOX3Dpax Provide a folio-based replacement for aops->migratepage. Update the documentation to document migrate_folio instead of migratepage. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 5 ++-- Documentation/filesystems/vfs.rst | 13 ++++++----- Documentation/vm/page_migration.rst | 33 ++++++++++++++------------- include/linux/fs.h | 4 +++- mm/compaction.c | 4 +++- mm/migrate.c | 19 ++++++++++----- 6 files changed, 46 insertions(+), 32 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index c0fe711f14d3..3d28b23676bd 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -253,7 +253,8 @@ prototypes:: void (*free_folio)(struct folio *); int (*direct_IO)(struct kiocb *, struct iov_iter *iter); bool (*isolate_page) (struct page *, isolate_mode_t); - int (*migratepage)(struct address_space *, struct page *, struct page *); + int (*migrate_folio)(struct address_space *, struct folio *dst, + struct folio *src, enum migrate_mode); void (*putback_page) (struct page *); int (*launder_folio)(struct folio *); bool (*is_partially_uptodate)(struct folio *, size_t from, size_t count); @@ -281,7 +282,7 @@ release_folio: yes free_folio: yes direct_IO: isolate_page: yes -migratepage: yes (both) +migrate_folio: yes (both) putback_page: yes launder_folio: yes is_partially_uptodate: yes diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index a08c652467d7..3ae1b039b03f 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -740,7 +740,8 @@ cache in your filesystem. The following members are defined: /* isolate a page for migration */ bool (*isolate_page) (struct page *, isolate_mode_t); /* migrate the contents of a page to the specified target */ - int (*migratepage) (struct page *, struct page *); + int (*migrate_folio)(struct mapping *, struct folio *dst, + struct folio *src, enum migrate_mode); /* put migration-failed page back to right list */ void (*putback_page) (struct page *); int (*launder_folio) (struct folio *); @@ -935,12 +936,12 @@ cache in your filesystem. The following members are defined: is successfully isolated, VM marks the page as PG_isolated via __SetPageIsolated. -``migrate_page`` +``migrate_folio`` This is used to compact the physical memory usage. If the VM - wants to relocate a page (maybe off a memory card that is - signalling imminent failure) it will pass a new page and an old - page to this function. migrate_page should transfer any private - data across and update any references that it has to the page. + wants to relocate a folio (maybe from a memory device that is + signalling imminent failure) it will pass a new folio and an old + folio to this function. migrate_folio should transfer any private + data across and update any references that it has to the folio. ``putback_page`` Called by the VM when isolated page's migration fails. diff --git a/Documentation/vm/page_migration.rst b/Documentation/vm/page_migration.rst index 8c5cb8147e55..e0f73ddfabb1 100644 --- a/Documentation/vm/page_migration.rst +++ b/Documentation/vm/page_migration.rst @@ -181,22 +181,23 @@ which are function pointers of struct address_space_operations. Once page is successfully isolated, VM uses page.lru fields so driver shouldn't expect to preserve values in those fields. -2. ``int (*migratepage) (struct address_space *mapping,`` -| ``struct page *newpage, struct page *oldpage, enum migrate_mode);`` - - After isolation, VM calls migratepage() of driver with the isolated page. - The function of migratepage() is to move the contents of the old page to the - new page - and set up fields of struct page newpage. Keep in mind that you should - indicate to the VM the oldpage is no longer movable via __ClearPageMovable() - under page_lock if you migrated the oldpage successfully and returned - MIGRATEPAGE_SUCCESS. If driver cannot migrate the page at the moment, driver - can return -EAGAIN. On -EAGAIN, VM will retry page migration in a short time - because VM interprets -EAGAIN as "temporary migration failure". On returning - any error except -EAGAIN, VM will give up the page migration without - retrying. - - Driver shouldn't touch the page.lru field while in the migratepage() function. +2. ``int (*migrate_folio) (struct address_space *mapping,`` +| ``struct folio *dst, struct folio *src, enum migrate_mode);`` + + After isolation, VM calls the driver's migrate_folio() with the + isolated folio. The purpose of migrate_folio() is to move the contents + of the source folio to the destination folio and set up the fields + of destination folio. Keep in mind that you should indicate to the + VM the source folio is no longer movable via __ClearPageMovable() + under folio if you migrated the source successfully and returned + MIGRATEPAGE_SUCCESS. If driver cannot migrate the folio at the + moment, driver can return -EAGAIN. On -EAGAIN, VM will retry folio + migration in a short time because VM interprets -EAGAIN as "temporary + migration failure". On returning any error except -EAGAIN, VM will + give up the folio migration without retrying. + + Driver shouldn't touch the folio.lru field while in the migrate_folio() + function. 3. ``void (*putback_page)(struct page *);`` diff --git a/include/linux/fs.h b/include/linux/fs.h index 9ad5e3520fae..7b380fa66983 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -362,9 +362,11 @@ struct address_space_operations { void (*free_folio)(struct folio *folio); ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *iter); /* - * migrate the contents of a page to the specified target. If + * migrate the contents of a folio to the specified target. If * migrate_mode is MIGRATE_ASYNC, it must not block. */ + int (*migrate_folio)(struct address_space *, struct folio *dst, + struct folio *src, enum migrate_mode); int (*migratepage) (struct address_space *, struct page *, struct page *, enum migrate_mode); bool (*isolate_page)(struct page *, isolate_mode_t); diff --git a/mm/compaction.c b/mm/compaction.c index 1f89b969c12b..db34b459e5d9 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1045,7 +1045,9 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, goto isolate_fail_put; mapping = page_mapping(page); - migrate_dirty = !mapping || mapping->a_ops->migratepage; + migrate_dirty = !mapping || + mapping->a_ops->migrate_folio || + mapping->a_ops->migratepage; unlock_page(page); if (!migrate_dirty) goto isolate_fail_put; diff --git a/mm/migrate.c b/mm/migrate.c index e51588e95f57..75cb6aa38988 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -858,14 +858,17 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, if (likely(is_lru)) { if (!mapping) rc = migrate_page(mapping, &dst->page, &src->page, mode); - else if (mapping->a_ops->migratepage) + else if (mapping->a_ops->migrate_folio) /* - * Most pages have a mapping and most filesystems - * provide a migratepage callback. Anonymous pages + * Most folios have a mapping and most filesystems + * provide a migrate_folio callback. Anonymous folios * are part of swap space which also has its own - * migratepage callback. This is the most common path + * migrate_folio callback. This is the most common path * for page migration. */ + rc = mapping->a_ops->migrate_folio(mapping, dst, src, + mode); + else if (mapping->a_ops->migratepage) rc = mapping->a_ops->migratepage(mapping, &dst->page, &src->page, mode); else @@ -883,8 +886,12 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, goto out; } - rc = mapping->a_ops->migratepage(mapping, &dst->page, - &src->page, mode); + if (mapping->a_ops->migrate_folio) + rc = mapping->a_ops->migrate_folio(mapping, dst, src, + mode); + else + rc = mapping->a_ops->migratepage(mapping, &dst->page, + &src->page, mode); WARN_ON_ONCE(rc == MIGRATEPAGE_SUCCESS && !folio_test_isolated(src)); } From patchwork Mon Jun 6 20:40:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870945 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 aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEED5CCA486 for ; Mon, 6 Jun 2022 20:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=FLIzUST5KX4p3KOY4fGikfLNYjEWWodx/Z7goA4LYPE=; b=WAnXdHmpMaN/9rt7pCTd6LKNZgDaHeFGrzmDuZljg/MYENV/acN487P/9ajzPYdRDrBsWi8rXMZX QyRYPbFaL8dwZq+Iu5fGX3muhkBEvF62w5aUi1fFICk3qti14FyBgH1IEVLBzyFgwmYwjRACygJr hDC9EMABcJOenejT1MnCXWEi846+vjB9olH2Zrg7r/i/1+6jxr4yFfLf0mQ3hAa++1mPnMQ+kkSM ihlnM6BN+2KviDJJpiF3t7U2oM6TjJD47XkZNtxZG0G+XzIZu+UHDj9p/LF1Rqe0sjuIkBUjaEmf Zpj/G6ejnlQMS4VML+Ky5uU9EcmkcyrHEIITAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=FLIzUST5KX4p3KOY4fGikfLNYjEWWodx/Z7goA4LYPE=; b=Ntx0yClme1umHsKYSRt9EJnOQeupymouQSFrBG5T4YZCKewnag0GG1yAMmzyXBf9w7yL/6dWM/T0 rRADPexWkEtb5ERpKY7/JAXAip+l8Eyy+o3Cp/ZomkZwmFvN80DgGqGCwtrvjlQn3+OT64gsQysf 0HK0fhCSLeRXncqBALEq58XYajQN823w5f783LvprKvFJlSe4uVNit/j+8pZsEEaPYxmQ0I4RAyP /cbgrGeH/uG6XGL6BxluLudL5AUGg7hg17Jx0fP0TJUqK18aAPvlM1SQj+T5MQyFOJsH8fcJju+7 XGFMa7eJe9UDOOhwjSp3uL2r7HZvXn2bl6jiQA== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CW7PH2G830@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:26 +0000 (GMT) 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=mh8Dq/H+EOoK+/6ImN6CHd/++DWMbIlB07P33o4BRwg=; b=kTMy4T7HlsUwOQX8f4QQV+5GP0 d2BPsYV05ijHNUiGSBK/JJIvv3xLKspkoGfdX+PMam1j5Xg9jzguWsSeUNE35UNwheoWchJtICWKd v6bX2YXq8GSXTqi1MGo6L/yfFvOIttBKUu1LImX/eWRZ4ENj5Ta17pHs4l9ec5jgZR1Xjda2ExWS+ yNjb7Y47V7B9Yo7pPITZdYU0NXdb8X5TcQTDL57j2z8HCFFsG3/TQ9RZNnnIOmkvMRexAJki1GE57 L3C0azwbeRNYpI/2G26pxpropqDN9TfoMXJHf/DLJLI/bI6XNuSxoFpAHcfTC/sJz6vMnR2IhRaTR Nsw3A0UA==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:32 +0100 Message-id: <20220606204050.2625949-3-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 mlxlogscore=577 spamscore=0 impostorscore=0 suspectscore=0 clxscore=159 malwarescore=0 lowpriorityscore=0 priorityscore=164 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 02/20] mm/migrate: Convert fallback_migrate_page() to fallback_migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: huV7q-gXLQE6_5dvM9h64anxuIthWr4p X-Proofpoint-ORIG-GUID: huV7q-gXLQE6_5dvM9h64anxuIthWr4p Reporting-Meta: AAGfzOchwV5bbnOwDUAD38+wjW613YqGEUhTlRyOkjGlfuvn+XjZ/gDHETjh2sA8 jp/WtU/yE33znsnDRiy45S6e+hB6Ipx+TnVV+EZJX+ItJVa+vPsN+ERLUgy11yO/ B/xhRckL1vSkgolcHw2W5dBJinoQrvBteBhyCQeRLP1u88+pzZiF48XWm4WughyA bAlW2uXMKEFnpSfCa5AqHiDRW5OBtsAsfDicx80ftNLuCA45kkKFgI4x9SsHiGR1 c8UsRPfJ+ZWxSB4DV7cC/wU3tUpodw/wNs2sZb9bAqn+kg778TJlhynv0kC/g2oX v6jG3pyljguIHtub5UYTZXII4NQW05tkVt4cOUMjv228NVWU8Ng3zQpxdPiZLU6S G5O+RArRrOKd571LzieFamyTO4q/G9HKHobPy0Bks8CD89lx7uXxMrVi+Ctu8iIk 3Fi2mpwst6m1yprY4WZL/f3sEY+qX3qF/iKSJKll/X3W5LMprYlC/OTl7AdEaZLW YYA0+Vap4+1mJSYr6PPixBGPF/C3NgBQWL1bcmhECIxb Use a folio throughout. migrate_page() will be converted to migrate_folio() later. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 75cb6aa38988..d772ce63d7e2 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -806,11 +806,11 @@ static int writeout(struct address_space *mapping, struct page *page) /* * Default handling if a filesystem does not provide a migration function. */ -static int fallback_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode) +static int fallback_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { - if (PageDirty(page)) { - /* Only writeback pages in full synchronous migration */ + if (folio_test_dirty(src)) { + /* Only writeback folios in full synchronous migration */ switch (mode) { case MIGRATE_SYNC: case MIGRATE_SYNC_NO_COPY: @@ -818,18 +818,18 @@ static int fallback_migrate_page(struct address_space *mapping, default: return -EBUSY; } - return writeout(mapping, page); + return writeout(mapping, &src->page); } /* * Buffers may be managed in a filesystem specific way. * We must have no buffers or drop them. */ - if (page_has_private(page) && - !try_to_release_page(page, GFP_KERNEL)) + if (folio_test_private(src) && + !filemap_release_folio(src, GFP_KERNEL)) return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY; - return migrate_page(mapping, newpage, page, mode); + return migrate_page(mapping, &dst->page, &src->page, mode); } /* @@ -872,8 +872,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, rc = mapping->a_ops->migratepage(mapping, &dst->page, &src->page, mode); else - rc = fallback_migrate_page(mapping, &dst->page, - &src->page, mode); + rc = fallback_migrate_folio(mapping, dst, src, mode); } else { /* * In case of non-lru page, it could be released after From patchwork Mon Jun 6 20:40:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870943 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 aib29ajc247.phx1.oracleemaildelivery.com (aib29ajc247.phx1.oracleemaildelivery.com [192.29.103.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33EA1CCA48D for ; Mon, 6 Jun 2022 20:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=j6wu3VmTfbFUImI5xNRw0g6BVbMSTqA3YsH3hMToWsI=; b=T4fJakMmzhdirVijnflE7IJbpNNgyEovKF3BRls1AX2cC3MURC2CeDyxIJO4rVbAO2WdZpldNXcX 2aR9DuPTotR1cDnG504i6Q+O4tf3T7xU/+iRTOaCm0pcJzyp2tdIubUFqH0MFIl12r6g6tHrKraE JMuvTyt6SQRiZ7rYoqR7qQK7wFevqr/BR0dpfQ1m4rLnOhS94PXD4GG/txtEwsOCFEiTCQ6kvh8f xVP/F/xmlIvDCWUHdwTYmEatcEDRxqBjoGs+/PpVMzdJ3XRe0uPZ/t68YRBLp/Zc+0djbNNFuuB/ oP0xnqLkZjqXKLPEp//78rhGrLcQgg0oYalK+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=j6wu3VmTfbFUImI5xNRw0g6BVbMSTqA3YsH3hMToWsI=; b=k6rUk0A99+7a4MdP5jj5stXDBUSysvpGcKUq5Arz/5RwRCq6mMrzNrp5rOrGFyPlleEVFAp/oDsM BgvoCZxAkHINyjd4BBHwnDM4xlkw0ASkj9f2V6gJjPiQExw6iEHbamsZvUmm4ecWgf35buaj/ezC i7wwOOkVJ8gmNGUiaCRfAjoe9nkLwce2ENKNbZLaLnoFh9RLUG9H4eAInxLQZUXQQA2CTezz+ITQ 4TvTVz7pg4caE5Efl34WKhInFAEPRx5IxzhIt/IXwdNZInE8duQMFX6NJEkRgWxAQAAEHKr1aMNA fKKpdH3C4GvKlUb3sbeSnc02fdocRXs5LJNYrw== Received: by omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CK0PGWQR60@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:20 +0000 (GMT) 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=dRkMHaR981UE2djNCVPW4MUdY2rPYJAa6UnQ1arpxn4=; b=VhRq5mA6U/Le0FhZhCp9BX9vX0 eEJWByASrVCSrm9WetxXqV0UXZBjF0SuYe4mFnGXMFsUgOilHz8p+squ/1rM4gM36CwhSe5BBEQp6 i1dQyrlxzSUP+hK9Ax4brjnRi7zxuvpEv+ymkWeCRkQK8HkgmO0y7Vc+lYVUA7Hlj90Pkf8iPWxqv CYXqz3bl8ul96I36GIcF4ldupbg1VWOjM55w+RuDYjPUC/TOKQiKqMH+XKBjwoHp0p03NK+LpBfPw iNV++FmUm87jwl9SX46KBPV+Ri5X6qeVBMjICnW8mirhgRNBkbRKdvNkLwdTh42fXKSQ5I7volu41 cllWb9Yg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:33 +0100 Message-id: <20220606204050.2625949-4-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=164 phishscore=0 adultscore=0 malwarescore=0 clxscore=159 spamscore=0 mlxlogscore=684 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 03/20] mm/migrate: Convert writeout() to take a folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: hppE_iKBXCfbYMGMJy1XKRd2zRClmOe5 X-Proofpoint-GUID: hppE_iKBXCfbYMGMJy1XKRd2zRClmOe5 Reporting-Meta: AAERZj8mkz0aTDXy/y2S56ygoDSx2v72QWWLs4qfubVg/8QbxdpE2CEZ8CtzASYq PVKMMdtYJkgm2kasANXFHQ+olhbxt8sqFbPG7fIXDTHoiHLIA2HQrX6m7KikHGqh 4JCLtsLhx4DHmxU7EgismjAej5LtywwRX7Se1tQvgTw4gl6Hqu1Tnu5e8yl8jClr SsKQpTor+jXfGVHg0am2h1NFlgYYvIw8B9xs3exrjlMPKt6oEhlaTZ4dkG7DYusl ZPo7ZlLbJUcXTYgCuAzRp6KroaQ0W4HcSvp58/s+FGtjJfzmuiiG64Iu/oXY/E2x TSgxUZTXDwNYPn1Z8FsdaFQFyZLiCXpaov0+FRL/caCIizqWtyHbBnx/2HB9vP+P Ck/Nhx9VfNLPpBtrsakcxPWxfvwfFq4ww7TfgKSvR3t1V5XxMh1BD7S8fqaQ7HRE z1XhOC9j08MmWG2MgIEiOlt7v0gHCfIaQQadUWrvR571OjJVvRyqHLBkLXN+X4U+ 7GN5HR79miZFAuOTu9Jfor6rREC5i7nkkJ52E5bfZAzc Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index d772ce63d7e2..f19246c12fe9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -762,11 +762,10 @@ int buffer_migrate_page_norefs(struct address_space *mapping, #endif /* - * Writeback a page to clean the dirty state + * Writeback a folio to clean the dirty state */ -static int writeout(struct address_space *mapping, struct page *page) +static int writeout(struct address_space *mapping, struct folio *folio) { - struct folio *folio = page_folio(page); struct writeback_control wbc = { .sync_mode = WB_SYNC_NONE, .nr_to_write = 1, @@ -780,25 +779,25 @@ static int writeout(struct address_space *mapping, struct page *page) /* No write method for the address space */ return -EINVAL; - if (!clear_page_dirty_for_io(page)) + if (!folio_clear_dirty_for_io(folio)) /* Someone else already triggered a write */ return -EAGAIN; /* - * A dirty page may imply that the underlying filesystem has - * the page on some queue. So the page must be clean for - * migration. Writeout may mean we loose the lock and the - * page state is no longer what we checked for earlier. + * A dirty folio may imply that the underlying filesystem has + * the folio on some queue. So the folio must be clean for + * migration. Writeout may mean we lose the lock and the + * folio state is no longer what we checked for earlier. * At this point we know that the migration attempt cannot * be successful. */ remove_migration_ptes(folio, folio, false); - rc = mapping->a_ops->writepage(page, &wbc); + rc = mapping->a_ops->writepage(&folio->page, &wbc); if (rc != AOP_WRITEPAGE_ACTIVATE) /* unlocked. Relock */ - lock_page(page); + folio_lock(folio); return (rc < 0) ? -EIO : -EAGAIN; } @@ -818,7 +817,7 @@ static int fallback_migrate_folio(struct address_space *mapping, default: return -EBUSY; } - return writeout(mapping, &src->page); + return writeout(mapping, src); } /* From patchwork Mon Jun 6 20:40:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870947 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 aib29ajc252.phx1.oracleemaildelivery.com (aib29ajc252.phx1.oracleemaildelivery.com [192.29.103.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6112DCCA496 for ; Mon, 6 Jun 2022 20:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=2AkI9FlF7qNjbDqmYNQn30oa6CrQpbp9809lR4DrOLk=; b=yVoMaZhT59oYW1huxQHHiiHdpqg8CniH/3v2vj8FdjTB/Hbr6E7a1ahRd0SSJyKwb9ryRNlokJGi G1iBS3mEkfBaRatJx62y34utck2M9ebOmfUrINALyIl4ck6wdXfNdTd0aIqJmMqePEX8z/RI9qYV zl/Cnse8a0o4xBQSOJrg3UOqyEP6a0JMfhUC1KXcaHPm1/qm8JDKn3Fo0Lxgu16NOFiwRqt20ewY m1F257OnNYiHw28iG+18OjSu9ZwWBNr59LGqB0y4x1oZKN9nzWnU42DwGjjTaCetY4930tDB8XWs cInGHpqwoKehCg8mpZFcPre2Mwkzg37VaaIW1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=2AkI9FlF7qNjbDqmYNQn30oa6CrQpbp9809lR4DrOLk=; b=DbmQ41bxgvb618YDbzf8hoRgDG2m3zzDg/h0U6oGjSs7Gy4iU+V5NrpBh6QWSW6A/y+dPdwCan2u A5TBiHIUdiC9qLbI2zf/3DhOJrW3emKqt1qdKTiQJN/mYPwJcB79MZ20w/kHIg/y/c+TdHO/Y3wB UIQ7/0ZA1/w6Glaf1ym+yxrRL6xXuYCnwy7Bfr/G8yRLlvaSvYnh9zzhqMQoriMrNnE2P92ENzn3 gVVjzok5PqRKECs0QBFyGkjW2d0K8b883bKzEfbrfig9j5Q+OHqmWd4+2H4D0c7iLDof69rXrkIF nQLT5V4qkYWkxgSQuCR3ghNhX6wIlb+/BNf4mw== Received: by omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD20012NPH0WH50@omta-ad3-fd1-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:24 +0000 (GMT) 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=2z1jX0yhTDltG7l7TM/WGDPE6d/xoDTeJDDQMbm1wg8=; b=Cv8slqe8iqqf4HOlLgutAaOA1A aFZHrqpp1ecJXz6/5OQgJaQgKmewa4IH+xNKntZNhPPNG2mq0TdCdUt37Lr1Rlb0d1jJiC5N0NY/k MH0U/aTkoMggca8NkpnWB2GfbEv8k3Qmd5IKV0bs9olGVEmGhjFUfhCNRkX82E7h2m4gIdzJIK83s bHNkdkHR2JrVCWQENaRdn/efg9EVXp1QQpLyXEb/+OSm01Xpgs6y+Nu8g5hE+zcuMzIc9U7qF5UHc CxDD3zjR9BkFUEuw/J+/y4QTlNqlIzj7jIvBLCnybLdxlLB62DbDIFf5GndYJbQZ9TUlgPwmGmbBf 0wr7BlYg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:34 +0100 Message-id: <20220606204050.2625949-5-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=165 mlxscore=0 lowpriorityscore=0 priorityscore=138 phishscore=0 suspectscore=0 impostorscore=0 mlxlogscore=918 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 04/20] mm/migrate: Convert buffer_migrate_page() to buffer_migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: QnL8S7LwFXEi4oJNpS9zqOcLx7Dv10l- X-Proofpoint-ORIG-GUID: QnL8S7LwFXEi4oJNpS9zqOcLx7Dv10l- Reporting-Meta: AAFXxtGUMj8J54SMEkWTY2mXve4ghjX3ept6G3BdyTI5w+lj4lvMemYXvSdaXSM1 vsLZRT+ifd8a9byx+FyH0NMj47QHHSfjYYnh2eStF+VZh4YqKjACgTx/AgG7e8yU 0tFYxevP8ishWwx4avdDnwixJXj+/5pWArYtsmqdPaxXCVpwweozEANcl/wavap1 WzrehCgpHnyBW66jI41eQP0aqYtf5Iprri0RCkQL+S8LvG01Jruc+X8mfwHl9Ck9 MlXye6Tk2bldCU8/pjBbG/byLgEqxYmVk6RSlePxMlrv6O2i2BfeOhox86WStaM/ TH/vTOFpEPD0hKCBTz1em9xVlFvQT1Ca5RO0kaXWQPLiucg/kKXni+L1sbyx7X5z CMlTsPfOdvsGT9KV5gsE4Gx7NlXLkBRy4F/oYgGWMSYrPxZGlkHgdySylBNvce+n 6Vd2ynEWNdjM51BW7YOYwW0TabxmZby50XJE/Wy3tNXv5Ymz36Am8AstNfaOzeHO oOq7KOv6f/0iQovTi2JVFqFso8q0qc0QJfFPo6BV5fRcww== Use a folio throughout __buffer_migrate_folio(), add kernel-doc for buffer_migrate_folio() and buffer_migrate_folio_norefs(), move their declarations to buffer.h and switch all filesystems that have wired them up. Signed-off-by: Matthew Wilcox (Oracle) Reported-by: kernel test robot Reported-by: kernel test robot Reviewed-by: Christoph Hellwig --- block/fops.c | 2 +- fs/ext2/inode.c | 4 +- fs/ext4/inode.c | 4 +- fs/ntfs/aops.c | 6 +-- fs/ocfs2/aops.c | 2 +- include/linux/buffer_head.h | 10 +++++ include/linux/fs.h | 12 ------ mm/migrate.c | 76 ++++++++++++++++++++++--------------- 8 files changed, 65 insertions(+), 51 deletions(-) diff --git a/block/fops.c b/block/fops.c index d6b3276a6c68..743fc46d0aad 100644 --- a/block/fops.c +++ b/block/fops.c @@ -417,7 +417,7 @@ const struct address_space_operations def_blk_aops = { .write_end = blkdev_write_end, .writepages = blkdev_writepages, .direct_IO = blkdev_direct_IO, - .migratepage = buffer_migrate_page_norefs, + .migrate_folio = buffer_migrate_folio_norefs, .is_dirty_writeback = buffer_check_dirty_writeback, }; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 360ce3604a2d..84570c6265aa 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -973,7 +973,7 @@ const struct address_space_operations ext2_aops = { .bmap = ext2_bmap, .direct_IO = ext2_direct_IO, .writepages = ext2_writepages, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; @@ -989,7 +989,7 @@ const struct address_space_operations ext2_nobh_aops = { .bmap = ext2_bmap, .direct_IO = ext2_direct_IO, .writepages = ext2_writepages, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .error_remove_page = generic_error_remove_page, }; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1aaea53e67b5..53877ffe3c41 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3633,7 +3633,7 @@ static const struct address_space_operations ext4_aops = { .invalidate_folio = ext4_invalidate_folio, .release_folio = ext4_release_folio, .direct_IO = noop_direct_IO, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, .swap_activate = ext4_iomap_swap_activate, @@ -3668,7 +3668,7 @@ static const struct address_space_operations ext4_da_aops = { .invalidate_folio = ext4_invalidate_folio, .release_folio = ext4_release_folio, .direct_IO = noop_direct_IO, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, .swap_activate = ext4_iomap_swap_activate, diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 9e3964ea2ea0..5f4fb6ca6f2e 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c @@ -1659,7 +1659,7 @@ const struct address_space_operations ntfs_normal_aops = { .dirty_folio = block_dirty_folio, #endif /* NTFS_RW */ .bmap = ntfs_bmap, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; @@ -1673,7 +1673,7 @@ const struct address_space_operations ntfs_compressed_aops = { .writepage = ntfs_writepage, .dirty_folio = block_dirty_folio, #endif /* NTFS_RW */ - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; @@ -1688,7 +1688,7 @@ const struct address_space_operations ntfs_mst_aops = { .writepage = ntfs_writepage, /* Write dirty page to disk. */ .dirty_folio = filemap_dirty_folio, #endif /* NTFS_RW */ - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 767df51f8657..1d489003f99d 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -2462,7 +2462,7 @@ const struct address_space_operations ocfs2_aops = { .direct_IO = ocfs2_direct_IO, .invalidate_folio = block_invalidate_folio, .release_folio = ocfs2_release_folio, - .migratepage = buffer_migrate_page, + .migrate_folio = buffer_migrate_folio, .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c9d1463bb20f..b0366c89d6a4 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -267,6 +267,16 @@ int nobh_truncate_page(struct address_space *, loff_t, get_block_t *); int nobh_writepage(struct page *page, get_block_t *get_block, struct writeback_control *wbc); +#ifdef CONFIG_MIGRATION +extern int buffer_migrate_folio(struct address_space *, + struct folio *dst, struct folio *src, enum migrate_mode); +extern int buffer_migrate_folio_norefs(struct address_space *, + struct folio *dst, struct folio *src, enum migrate_mode); +#else +#define buffer_migrate_folio NULL +#define buffer_migrate_folio_norefs NULL +#endif + void buffer_init(void); /* diff --git a/include/linux/fs.h b/include/linux/fs.h index 7b380fa66983..5737c92ed286 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3217,18 +3217,6 @@ extern int generic_check_addressable(unsigned, u64); extern void generic_set_encrypted_ci_d_ops(struct dentry *dentry); -#ifdef CONFIG_MIGRATION -extern int buffer_migrate_page(struct address_space *, - struct page *, struct page *, - enum migrate_mode); -extern int buffer_migrate_page_norefs(struct address_space *, - struct page *, struct page *, - enum migrate_mode); -#else -#define buffer_migrate_page NULL -#define buffer_migrate_page_norefs NULL -#endif - int may_setattr(struct user_namespace *mnt_userns, struct inode *inode, unsigned int ia_valid); int setattr_prepare(struct user_namespace *, struct dentry *, struct iattr *); diff --git a/mm/migrate.c b/mm/migrate.c index f19246c12fe9..77b8c662c9ca 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -657,23 +657,23 @@ static bool buffer_migrate_lock_buffers(struct buffer_head *head, return true; } -static int __buffer_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode, +static int __buffer_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode, bool check_refs) { struct buffer_head *bh, *head; int rc; int expected_count; - if (!page_has_buffers(page)) - return migrate_page(mapping, newpage, page, mode); + head = folio_buffers(src); + if (!head) + return migrate_page(mapping, &dst->page, &src->page, mode); /* Check whether page does not have extra refs before we do more work */ - expected_count = expected_page_refs(mapping, page); - if (page_count(page) != expected_count) + expected_count = expected_page_refs(mapping, &src->page); + if (folio_ref_count(src) != expected_count) return -EAGAIN; - head = page_buffers(page); if (!buffer_migrate_lock_buffers(head, mode)) return -EAGAIN; @@ -704,23 +704,22 @@ static int __buffer_migrate_page(struct address_space *mapping, } } - rc = migrate_page_move_mapping(mapping, newpage, page, 0); + rc = folio_migrate_mapping(mapping, dst, src, 0); if (rc != MIGRATEPAGE_SUCCESS) goto unlock_buffers; - attach_page_private(newpage, detach_page_private(page)); + folio_attach_private(dst, folio_detach_private(src)); bh = head; do { - set_bh_page(bh, newpage, bh_offset(bh)); + set_bh_page(bh, &dst->page, bh_offset(bh)); bh = bh->b_this_page; - } while (bh != head); if (mode != MIGRATE_SYNC_NO_COPY) - migrate_page_copy(newpage, page); + folio_migrate_copy(dst, src); else - migrate_page_states(newpage, page); + folio_migrate_flags(dst, src); rc = MIGRATEPAGE_SUCCESS; unlock_buffers: @@ -730,34 +729,51 @@ static int __buffer_migrate_page(struct address_space *mapping, do { unlock_buffer(bh); bh = bh->b_this_page; - } while (bh != head); return rc; } -/* - * Migration function for pages with buffers. This function can only be used - * if the underlying filesystem guarantees that no other references to "page" - * exist. For example attached buffer heads are accessed only under page lock. +/** + * buffer_migrate_folio() - Migration function for folios with buffers. + * @mapping: The address space containing @src. + * @dst: The folio to migrate to. + * @src: The folio to migrate from. + * @mode: How to migrate the folio. + * + * This function can only be used if the underlying filesystem guarantees + * that no other references to @src exist. For example attached buffer + * heads are accessed only under the folio lock. If your filesystem cannot + * provide this guarantee, buffer_migrate_folio_noref() may be more + * appropriate. + * + * Return: 0 on success or a negative errno on failure. */ -int buffer_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode) +int buffer_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { - return __buffer_migrate_page(mapping, newpage, page, mode, false); + return __buffer_migrate_folio(mapping, dst, src, mode, false); } -EXPORT_SYMBOL(buffer_migrate_page); +EXPORT_SYMBOL(buffer_migrate_folio); -/* - * Same as above except that this variant is more careful and checks that there - * are also no buffer head references. This function is the right one for - * mappings where buffer heads are directly looked up and referenced (such as - * block device mappings). +/** + * buffer_migrate_folio_noref() - Migration function for folios with buffers. + * @mapping: The address space containing @src. + * @dst: The folio to migrate to. + * @src: The folio to migrate from. + * @mode: How to migrate the folio. + * + * Like buffer_migrate_folio() except that this variant is more careful + * and checks that there are also no buffer head references. This function + * is the right one for mappings where buffer heads are directly looked + * up and referenced (such as block device mappings). + * + * Return: 0 on success or a negative errno on failure. */ -int buffer_migrate_page_norefs(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode) +int buffer_migrate_folio_norefs(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { - return __buffer_migrate_page(mapping, newpage, page, mode, true); + return __buffer_migrate_folio(mapping, dst, src, mode, true); } #endif From patchwork Mon Jun 6 20:40:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870956 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 aib29ajc247.phx1.oracleemaildelivery.com (aib29ajc247.phx1.oracleemaildelivery.com [192.29.103.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADC7FC433EF for ; Mon, 6 Jun 2022 20:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=HXq6q/Z4naTWQ+0j7SPlFiRsk6Zdnn6dw4lyAyAHgc4=; b=MTC/5woFr1+2W5sPIHifwli68zqe50SS5xnrBlNzeu2lo9IykGETFkcVPBiLvKkljoBnenn52nY/ M2g9++zQKG2ynnWldTQhDxslhP0XfIx5o9pgDse5V+gf88P62jUtMGT1mJhqDzUxfKjIA/UfzwwY ducSvUvvPuk606neG/cqO2JqWPCOf53GLkURy38gT3X5hU0OIx34ri4pnGG/ef/Ek+I74Htty4sm 99/qUOSsL0NcJlU/MLQIsC69jbZai9MQoZxdq9WmB62WLepemkVOW2laTjo9lGa3XUwfp9Kvr8Sf UpJo6TQD/sX3Ekdg7vQt0e4jIN3KF+mTVnhqGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=HXq6q/Z4naTWQ+0j7SPlFiRsk6Zdnn6dw4lyAyAHgc4=; b=iTj5txKkJyIbGKM58Q0iI0BYTnpTKFCuU5HBI45JDn+0iEkGMgrVStHRjLqEyP5VSM7SGbHOyifU cTVwu8MaiBw5yZdVLwJJH8EgY6RL95rlzHGJbBHByDDAhaMfbBdjdE0FF+4JxU57+rlHLMu4hWBM pzYvizSjoM3xb96SZqq84wizTxAhaiLKWs+4MtLU95s6xcRmI86OSFHLuh6RD6aerjW+sMBNXIbW G1kXQfzS6SRRuEGQWPwEhjWEi9pl5BRxzKOlY0p8XPnJHNDRoS7DnSaMprROF1KkSv5janJhs83x +SImbonoop0JkmwKueiAe6mvzpB3tnbKjt4NMg== Received: by omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CQJPHMQR60@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:46 +0000 (GMT) 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=PTb1fSw49y2qxNUUq4k5t2uIOYf1rKQU0qM36b/uqdM=; b=moAsLc7xAe9cCO2yLS/2VDmHEw YBwWTVJr9kJRjwoeFhsNnd8JLuuJjbq0xBtc3hJNd0koz0AzNRiu2y+N5Os1g1/u53LaRvxXW4rdM tHwy5XlETEs430Lov51yIttD+nu/AmMuCt1+6O5d08aKIMBYPTBY0Yt54xqFYELLNo0/O6twSwDnU wa3c1U/y/ETekmwC5gKHpa1nMck5VNxLTjucI7KCgMp9l5cOztmW0nCXmpkBfBeAli7aijjbj7GhC zHPVo0ax+4QE/HagbZZ6pGGOB2yVWmyQYd5p+40+xWsAl8Ab1eGJlEDyjqzfn+/+j35DgUlM4Y7a4 FS4d0iCw==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:35 +0100 Message-id: <20220606204050.2625949-6-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=260 phishscore=0 adultscore=0 malwarescore=0 clxscore=159 spamscore=0 mlxlogscore=539 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 05/20] mm/migrate: Convert expected_page_refs() to folio_expected_refs() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: X3pBUipsu6b78NjHw_P8-aM5jONIQBN3 X-Proofpoint-ORIG-GUID: X3pBUipsu6b78NjHw_P8-aM5jONIQBN3 Reporting-Meta: AAERZj8mkz0aTDXy/y2S56ygoDSx2v72QWWLs4qfubVg/8QbxdpE2CEZ8CtzASYq PVKMMdtYJkgm2kasANVEHg+olhbxt8sqFbNyQkan9zMv8Z8tbYvT6/5R/DLBYxAk sKLUSfcvP5mIiokd/N0kDA4GbiaIvFDVOJkxKQ513G+LNFJ5nUGgSuFEEX1QGSzw bt0Sb30e3aSazbWsimkxEX6LdsC9dOUTZP06IS1IyVqIMQcNvbwtxmowNktOpZEE UAKpkiV4x2fiHhTuP+HQEIRB2TXtklHiJPvOLSeQzHihKo88erihnwEmCiQH28oh 0sFToLEOsrPImMIicATukqBiwMANLpUoxrIEwpsviSUwbocRdkW0KiBIqYaS6gP1 K8AZi29Of4Kw0CDVRCLaAsz4fxQ/WzkMXBGxFotnDj+g0bfkdSTx/CrKVds+2WuU ad9IHMlMkV3da/mUyMnvonAqVPDNsiYRFPUOBAh9owHDPqrswZleWctGGXCs8Nfa c8ylO6yylB3cskV/Vryr7jYvBVP1XV8ipyMUBVhzb1yx Now that both callers have a folio, convert this function to take a folio & rename it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/migrate.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 77b8c662c9ca..e0a593e5b5f9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -337,13 +337,18 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) } #endif -static int expected_page_refs(struct address_space *mapping, struct page *page) +static int folio_expected_refs(struct address_space *mapping, + struct folio *folio) { - int expected_count = 1; + int refs = 1; + if (!mapping) + return refs; - if (mapping) - expected_count += compound_nr(page) + page_has_private(page); - return expected_count; + refs += folio_nr_pages(folio); + if (folio_get_private(folio)) + refs++; + + return refs;; } /* @@ -360,7 +365,7 @@ int folio_migrate_mapping(struct address_space *mapping, XA_STATE(xas, &mapping->i_pages, folio_index(folio)); struct zone *oldzone, *newzone; int dirty; - int expected_count = expected_page_refs(mapping, &folio->page) + extra_count; + int expected_count = folio_expected_refs(mapping, folio) + extra_count; long nr = folio_nr_pages(folio); if (!mapping) { @@ -670,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, return migrate_page(mapping, &dst->page, &src->page, mode); /* Check whether page does not have extra refs before we do more work */ - expected_count = expected_page_refs(mapping, &src->page); + expected_count = folio_expected_refs(mapping, src); if (folio_ref_count(src) != expected_count) return -EAGAIN; From patchwork Mon Jun 6 20:40:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870950 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 aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 582C1CCA488 for ; Mon, 6 Jun 2022 20:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=bdoFGINg5KKPhjyP+gx0jyxSoykH9Ddufl/XeRvyOeo=; b=lF4J/gUuTiWPba76z/SG2L6MmrW+B1MV8Ozb7Lp6LnuEEl98Hl4vnoAGxDZLtaPi4Q/Hdzf4wXp+ UifidAeMDVs7oo27rdZ/OSuEEKxKxMdlEk6YBk1dt91huVIhbGRdf/8zUjTS7E11T8WK1GWxJCue f7rF8LWIL7QszBQpBao35yTFnreUNBeTn/6jvN3kCrvMtVIDGBNLtCi1jXqDBSNNCqbYI2j8+w++ y3nRWvlfmsoqAYqQR1n//qznmeNFZvTGHBUDe4o0FnSoZYgrMqnqYdS6IXOZ2KY/JDU7ql453KaW G/H2xLb6G9ROVjiplkhfdrqioWuAoBmJd9/e+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=bdoFGINg5KKPhjyP+gx0jyxSoykH9Ddufl/XeRvyOeo=; b=FJvDvMONx7H1SCfmWTtGVPncVgo2SZaDHOEyCfSZOALJnCbec21cou6BA3RYkcEQ3tkEa+VCHpQP ADM2iY0tUIGnoTh6uBDjBEgWDPNvV7gETiu+T5UJAn6DxGyvIicrt3vHiCRdpGHx6WqYtuYODDiH qRlltffy3QPDHCQe5krSp5HJT90SaB0mDxr+sdfH0xNoR67bQdum49hBWOQ1Z0NV/G13baiNwF49 z2l2dCO0M6DMHuA8FTg4hOX9G11JOf5Qje6ZvcauV6H9N4VdtHI0hJ/nxwEAgtC/7h7XD28DwtPg EanGBELDUQIcwN5DO/uQbcO2uiKy5sCgLuBicg== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CYCPHAG830@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:34 +0000 (GMT) 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=qQEq4mdildUXXhXlw26OgbbgbPBpQ0UP7iPop0FGmsk=; b=smk5cZ9QlxWeUzBKWfo86nVrRn 486Q4WmG9O8N7FW33RHEsLn1KdnhRCjpYsCnh2VTGHbxlEbEoaGncZWPwo88zaujLhSpvhlFYqZjF rT/pg4CkWWNMdWfegFLoYHJvmoFIm1xAxZgu4kmCe6BWjH2QkN1GsU7kYe50wZfva3uEoQHLUVRRU edvLwLiCnvO9Xryb+ZR231DA0eGBN7CXz/fAN+xjcrsnTNRjReFVIp2BGCweM6NJZGbCkhTvenoYZ cQCh2ENLaKQwbX+uc1wEhsR2j84htsXjEviyNnafZBo9+lFBva15d5sRZGRRozu2cOzqXNQM+sbim Zzrgg9gg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:36 +0100 Message-id: <20220606204050.2625949-7-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=165 mlxscore=0 lowpriorityscore=0 priorityscore=108 phishscore=0 suspectscore=0 impostorscore=0 mlxlogscore=650 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 06/20] btrfs: Convert btree_migratepage to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: 9N_QoBn3NIsul_Wr6psFgjXTrnFrwqfd X-Proofpoint-ORIG-GUID: 9N_QoBn3NIsul_Wr6psFgjXTrnFrwqfd Reporting-Meta: AAEg6SygxaT/zHvhQ6guxcm+F+gSufxaLlNvNM97o+Rp/s1cZtlPLRko2w//jpYM nFX6H1i0KaOyZCqB5MJTK2EC4UiWfa5GXi4I42j04PwAz/zhwYRQifpL+1Ff2Qgm ULzuVVyYRhce9nsu2/HMWkaZyQwMkylUxYEbjW6V9AHsLQZxuURqF2yOa3OEmLcZ lkk4xBTnIzG48+T9g8ttd/J8IKxrejm9tAfmHsLwwGAnH8LPRqXiOxA1eGQzSlSC 1ArpiOm4rvBdKbBO3aGfLz8W1+pnQ+9uWer9KocozpmS1ovxgjUFZLXVJrSadNnZ AHQUUh9sQ8C82XX7EgyskW9z/ZdOvmoMfxap1Wb1MYHyqeQPIrqEkpB3qstZXy5T dZAcfj5EnTGVSSqcWphuyB36C11v5d1605IW0+Mokrm+/7cjFNDhPse8obtFrG4h Zb9WztRLbDAebTi8O7mRpkbQUS36c3hDUCShM91YP5MFOSfN7Hrf4PQra86MZeJ8 TDwQLf8V0VsH3XbH8rUwT/C1uASb1qbIemgqYaY1okotYg== Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/btrfs/disk-io.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 12b11e645c14..9ceb73f683af 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -952,28 +952,28 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_ } #ifdef CONFIG_MIGRATION -static int btree_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode) +static int btree_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { /* * we can't safely write a btree page from here, * we haven't done the locking hook */ - if (PageDirty(page)) + if (folio_test_dirty(src)) return -EAGAIN; /* * Buffers may be managed in a filesystem specific way. * We must have no buffers or drop them. */ - if (page_has_private(page) && - !try_to_release_page(page, GFP_KERNEL)) + if (folio_get_private(src) && + !filemap_release_folio(src, GFP_KERNEL)) return -EAGAIN; - return migrate_page(mapping, newpage, page, mode); + return migrate_page(mapping, &dst->page, &src->page, mode); } +#else +#define btree_migrate_folio NULL #endif - static int btree_writepages(struct address_space *mapping, struct writeback_control *wbc) { @@ -1073,10 +1073,8 @@ static const struct address_space_operations btree_aops = { .writepages = btree_writepages, .release_folio = btree_release_folio, .invalidate_folio = btree_invalidate_folio, -#ifdef CONFIG_MIGRATION - .migratepage = btree_migratepage, -#endif - .dirty_folio = btree_dirty_folio, + .migrate_folio = btree_migrate_folio, + .dirty_folio = btree_dirty_folio, }; struct extent_buffer *btrfs_find_create_tree_block( From patchwork Mon Jun 6 20:40:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870955 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 aib29ajc247.phx1.oracleemaildelivery.com (aib29ajc247.phx1.oracleemaildelivery.com [192.29.103.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90D15C43334 for ; Mon, 6 Jun 2022 20:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=J3atSQveN5+wM19EZ8UpT4/lIUfCt7W+39dhKSs+8H8=; b=J2Xp2A7voG5s0MUs8QxgQPP5e4015aza0ZAoJ1wenEi4ehyORgPW9wApzsxVq0ypDwm27mOnycbb LCxI0BUvDX/eCwBTVVQcBF431dQdcH94OB0H66KIvIOANu31zfGDWxs29OHlNY/caQZl6hLHEMgt ttcWMsefzfZ4SL6pRfrUKKL4HPDdCcHeDuTMIYergd4v3hnFLpNK0BX2n/596pi0jDpMru2cBxd3 vEM1wWx82L6paqabcOzppwsmiZ7fjthCUJPkAtgRs+jMkRnijZtXBHlkZkwO65ZJ2CaqEM63zDGE sMJ/XjTkE5Gia+ccbcvqSwbzVSFCSM20hlzdGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=J3atSQveN5+wM19EZ8UpT4/lIUfCt7W+39dhKSs+8H8=; b=f2kfooRJ90w6v0GXg44M/+lh+DniVDoTW2hjKw/QYbPBVO3iqreY3GAILtyKTEp/R3ySl3sN7VmT AKcEDKO1jQzvNpVhmhKbcC0bGcWnbUW2+3Rkey+XK1spGdZ86PeAOALSenFP2BxY60+ZzdwjE/Js E8gr4dGB0V5Lb+sk8sxM/5E0P47sGwnY8AusYrxEK523okaQ3lj96fG+ylCIsUT8m9oglkNrTw0+ 7Jn94dsmW1IiMnTt6TUAnurTC3o4D9hbrDTphdlOLiyX1bu1WxUVepP2FZ7BNR7NFGyTm4qXraOg BA2liDquElg8GUz15l4pXK2Pf6IbejFOJUEWWQ== Received: by omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CPZPHLQR60@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:45 +0000 (GMT) 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=pP2rySBonQba80aJJurpf3Ufu7YzAk6PE/UfFF5JjqU=; b=CVvFIaE3DO4F579aJn2Gv8sjJ1 3s4aun59FYY8/cIm392ktBNn3Yfrt/zZI2FAKlmO4E3xMwJb3V8p0zjyiYNlXYHugx4ESqJjlHfb1 QG1qZiDzGvDgU/60lg9IfnGfI2mfaTj+stxEAcrFL6CEOIqb5GzPU9vw1qrk6uFLJAOZ3IkEmbCQE LzelMikinFLOzolvWeyxZFad1TDhzqH1x/JkOTw+Xol4LnPrnKqEGccXqc7eFHbh9ziaHCXeJ+DmM rrw8vPHosmQOe6zaJs4TsqpU+ayfdzgl+HFiB3jtxCoXtL62mYflqoIljhWxTii99IWQIy6G281e+ VVfyP2fw==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:37 +0100 Message-id: <20220606204050.2625949-8-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=165 mlxlogscore=570 mlxscore=0 bulkscore=0 priorityscore=108 phishscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 07/20] nfs: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: iwgZZ0aOQOHNbJFY5IZBOH4Z7HJ815ae X-Proofpoint-ORIG-GUID: iwgZZ0aOQOHNbJFY5IZBOH4Z7HJ815ae Reporting-Meta: AAEg6SygxaT/zHvhQ6guxcm+F+gSufxaLlNvNM97o+Rp/s1cZtlPLRko2w//jpYM nFX6H1i0KaOyZCqB5MJpK2EC4UiWfa5GXi5JBpDDdIWUZictQHN9Hav1y8S456Yk O+VZumnRcC/v2YZCHQjhjdqwLJQ4xY+mOUBPvfX/706RCQch8p7Jc3oYeZpT5m3U C1wkw1+l363s+EC3HY8gqkYFY2isxOeVGAJPOK0VTptQmdrMd2rjzY7P1ZvrNUM0 xgczL9RkdgKs0SaTB9AgIrO4JXeJW7iOoLBesDSQgWUxfrQN9qkHZfqBmJZG4F42 way9Q1j2u7qBAVUaB6osaOEeIEgEzXZOWAgnhOtlMMiPesHM9lYNOtRBjzIqO+y6 EE5OYW0CI10KuF81q1fOsgX9+TgbufbA8ULG2mG4BfDyKfr+684Fir67OzPSP4g0 RbUDDRn2mlEudX8m0AkveT0pP4PPGcqKwk5lBOiXMLTZSBTBIptsHbZH8FqcUIqZ pFzyireyBksUoBNzhpIRPPR4si7KrmKjqoHymbIh3+JG Use a folio throughout this function. migrate_page() will be converted later. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/nfs/file.c | 4 +--- fs/nfs/internal.h | 6 ++++-- fs/nfs/write.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 2d72b1b7ed74..549baed76351 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -533,9 +533,7 @@ const struct address_space_operations nfs_file_aops = { .write_end = nfs_write_end, .invalidate_folio = nfs_invalidate_folio, .release_folio = nfs_release_folio, -#ifdef CONFIG_MIGRATION - .migratepage = nfs_migrate_page, -#endif + .migrate_folio = nfs_migrate_folio, .launder_folio = nfs_launder_folio, .is_dirty_writeback = nfs_check_dirty_writeback, .error_remove_page = generic_error_remove_page, diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 8f8cd6e2d4db..437ebe544aaf 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -578,8 +578,10 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo) #endif #ifdef CONFIG_MIGRATION -extern int nfs_migrate_page(struct address_space *, - struct page *, struct page *, enum migrate_mode); +int nfs_migrate_folio(struct address_space *, struct folio *dst, + struct folio *src, enum migrate_mode); +#else +#define nfs_migrate_folio NULL #endif static inline int diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 1c706465d090..649b9e633459 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -2119,27 +2119,27 @@ int nfs_wb_page(struct inode *inode, struct page *page) } #ifdef CONFIG_MIGRATION -int nfs_migrate_page(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode) +int nfs_migrate_folio(struct address_space *mapping, struct folio *dst, + struct folio *src, enum migrate_mode mode) { /* - * If PagePrivate is set, then the page is currently associated with + * If the private flag is set, the folio is currently associated with * an in-progress read or write request. Don't try to migrate it. * * FIXME: we could do this in principle, but we'll need a way to ensure * that we can safely release the inode reference while holding - * the page lock. + * the folio lock. */ - if (PagePrivate(page)) + if (folio_test_private(src)) return -EBUSY; - if (PageFsCache(page)) { + if (folio_test_fscache(src)) { if (mode == MIGRATE_ASYNC) return -EBUSY; - wait_on_page_fscache(page); + folio_wait_fscache(src); } - return migrate_page(mapping, newpage, page, mode); + return migrate_page(mapping, &dst->page, &src->page, mode); } #endif From patchwork Mon Jun 6 20:40:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870949 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 aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6179CCA482 for ; Mon, 6 Jun 2022 20:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=BvTXGRhRnR/KiBMTentub4xU/joRNqXMGvgN9BDs898=; b=1QSfO83lOsHP/U+Hf93Gts9fNNQ97swLjPd2PO9l3TqcIob/m7SPpMrf9LreR445mOK/Pko49cTr qm4AXOw3Qc/t7RVZB5DahFHvPKkM0OVJKwyAVyBlN09B9f7/vXBvJgzV0RUKwFzHdG+yRa/pstB0 th17CZQxqo22adk0Zf73NODzMJUpXROzeC35SI3w2fNW1q+cpHXxumLnfVP5H0lWPMqmCrQ/iiit WIc/JdC5ZxEQWct5d+5QlbEN+qMCE5plT9dUzFfsrSV8KNELY3Tfc989LBoVoqOmG8zMzfSy2AoJ XuGjyuBdNHziOC+AfS+lnxVyZnqWz5/ca2Ucyg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=BvTXGRhRnR/KiBMTentub4xU/joRNqXMGvgN9BDs898=; b=XrhzEjutshG+ChSl0EwkgKoV2Z87Cherdy50gPWsvIrtEW4L+2QNm3YZPNQSlqBE1SmLv0BBv/cy NItR3hZpAV1BLBoGlYjIhLlcrbLDVS8PgjPJFIp9bWiw4++miUT/cXvxGPbvw+CN9OlV84K+3AYp DSQLgMCkmg8sphqgeaG5+ZvdvLgcrHiMhgvBBeOQZAzC4t3uTs4CTT4Rh3ogBNqwkwloIq9ogbhA FqMv8I7RWekH3y7dhebKO4RqjfNsEyQJnno+JZQIJrJkGvUnkTpb760LsLIgMsFdjdF4nq7XzeUz bS4CFmEl3rpt4/KUuHkugYq3j1WsYRcH2qkoFg== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CXFPH8G830@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:32 +0000 (GMT) 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=UOfFr2kCuNNQQN1tCbzkVZPiRcxwNuFu8WhD+k3kEbk=; b=flnOFKhza3ughv7JVhOQB3UNwt unJkK+04gLu6Kap8iSsI5n17Petv8ajZ5SNf2z85X1sGiGV+/O4at1NY6yYUUh9otQThec0pBNhjV LQ3DHGqLZ9wgkV10cm5ylDRcJkF7gW/EYNYxjb7tw+PQI0TNbmMp3G6/DdD6j0PLwN6ftaBG2q963 iSWRXJtFiCQCMPYSwFs/2b4lt4PVrMv5PTRj/Y/MrNjJP6VatH2fdUtSsL6pkkS9nfDYj1sL4QV6Q OU3G9rQbdmhP7nl+qK3wD97RWO0r4M2EPPu0kLi/mPzqSB9/WTtKyiKeYoaJfIGkogFD5ZUkn3fsh T5XYWXLg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:38 +0100 Message-id: <20220606204050.2625949-9-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 clxscore=165 malwarescore=0 priorityscore=138 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=718 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 08/20] mm/migrate: Convert migrate_page() to migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: ZjBTdBBrnHCLqUaviOkivtY0zmqfuKpU X-Proofpoint-ORIG-GUID: ZjBTdBBrnHCLqUaviOkivtY0zmqfuKpU Reporting-Meta: AAERZj8mkz0aTDXy/y2S56ygoDSx2v72QWWLs4qfubVg/8QbxdpE2CEZ8CtzASYq PVKMMdtYJkgm2kasANXiHQ+olhbxt8sqFbNMGVO7fozDm7hUtPbLLvPOI6w9RHp0 2ROd4x8o9/2SdRCdsAoKjpehhCHhSKitKkwxg4BgTZ2x+e63gWvZKQrjERjScsGG lPeWRvzIsFx508L9njKfOgZ2cV7AbYqZXpAmDIlQcTyLyPGMSa5IOhFmpZVvQ2yT qXUYwdo1DPQZoEzBiDrZMJJAkkfBmcwtXhZgQkfXCpWAdtUYNI4J2n90KJOpxMwc F0e1t8ga2ilbi3VcJSb/gCw7B9sXmMSIrKQF76LzWgKR6pJzlUP7WR/LGExzjGu+ UwdYCjhtesGUVFF66zYQlqTWxrUXP1TwiCaYIacH2hqCnTC3RWdFOGAbM6Hu01Jm AFwcrmw8hOW3NIlOMAUL8aQwiRe9CyfLvzqB/uLY8MBiYWPgttUiJhtYbMLojiiA wZv2eE8+TJLa0m1aNTIduLJnfK3f15Dvl2FdtqkZOa40lw== Convert all callers to pass a folio. Most have the folio already available. Switch all users from aops->migratepage to aops->migrate_folio. Also turn the documentation into kerneldoc. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 4 +-- fs/btrfs/disk-io.c | 2 +- fs/nfs/write.c | 2 +- include/linux/migrate.h | 5 ++- mm/migrate.c | 37 +++++++++++---------- mm/migrate_device.c | 3 +- mm/shmem.c | 2 +- mm/swap_state.c | 2 +- 8 files changed, 30 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c index 094f06b4ce33..8423df021b71 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c @@ -216,8 +216,8 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, * However...! * * The mmu-notifier can be invalidated for a - * migrate_page, that is alreadying holding the lock - * on the page. Such a try_to_unmap() will result + * migrate_folio, that is alreadying holding the lock + * on the folio. Such a try_to_unmap() will result * in us calling put_pages() and so recursively try * to lock the page. We avoid that deadlock with * a trylock_page() and in exchange we risk missing diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 9ceb73f683af..8e5f1fa1e972 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -968,7 +968,7 @@ static int btree_migrate_folio(struct address_space *mapping, if (folio_get_private(src) && !filemap_release_folio(src, GFP_KERNEL)) return -EAGAIN; - return migrate_page(mapping, &dst->page, &src->page, mode); + return migrate_folio(mapping, dst, src, mode); } #else #define btree_migrate_folio NULL diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 649b9e633459..69569696dde0 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -2139,7 +2139,7 @@ int nfs_migrate_folio(struct address_space *mapping, struct folio *dst, folio_wait_fscache(src); } - return migrate_page(mapping, &dst->page, &src->page, mode); + return migrate_folio(mapping, dst, src, mode); } #endif diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 069a89e847f3..4ef22806cd8e 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -25,9 +25,8 @@ extern const char *migrate_reason_names[MR_TYPES]; #ifdef CONFIG_MIGRATION extern void putback_movable_pages(struct list_head *l); -extern int migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode); +int migrate_folio(struct address_space *mapping, struct folio *dst, + struct folio *src, enum migrate_mode mode); extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free, unsigned long private, enum migrate_mode mode, int reason, unsigned int *ret_succeeded); diff --git a/mm/migrate.c b/mm/migrate.c index e0a593e5b5f9..6232c291fdb9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -594,34 +594,37 @@ EXPORT_SYMBOL(folio_migrate_copy); * Migration functions ***********************************************************/ -/* - * Common logic to directly migrate a single LRU page suitable for - * pages that do not use PagePrivate/PagePrivate2. +/** + * migrate_folio() - Simple folio migration. + * @mapping: The address_space containing the folio. + * @dst: The folio to migrate the data to. + * @src: The folio containing the current data. + * @mode: How to migrate the page. * - * Pages are locked upon entry and exit. + * Common logic to directly migrate a single LRU folio suitable for + * folios that do not use PagePrivate/PagePrivate2. + * + * Folios are locked upon entry and exit. */ -int migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode) +int migrate_folio(struct address_space *mapping, struct folio *dst, + struct folio *src, enum migrate_mode mode) { - struct folio *newfolio = page_folio(newpage); - struct folio *folio = page_folio(page); int rc; - BUG_ON(folio_test_writeback(folio)); /* Writeback must be complete */ + BUG_ON(folio_test_writeback(src)); /* Writeback must be complete */ - rc = folio_migrate_mapping(mapping, newfolio, folio, 0); + rc = folio_migrate_mapping(mapping, dst, src, 0); if (rc != MIGRATEPAGE_SUCCESS) return rc; if (mode != MIGRATE_SYNC_NO_COPY) - folio_migrate_copy(newfolio, folio); + folio_migrate_copy(dst, src); else - folio_migrate_flags(newfolio, folio); + folio_migrate_flags(dst, src); return MIGRATEPAGE_SUCCESS; } -EXPORT_SYMBOL(migrate_page); +EXPORT_SYMBOL(migrate_folio); #ifdef CONFIG_BLOCK /* Returns true if all buffers are successfully locked */ @@ -672,7 +675,7 @@ static int __buffer_migrate_folio(struct address_space *mapping, head = folio_buffers(src); if (!head) - return migrate_page(mapping, &dst->page, &src->page, mode); + return migrate_folio(mapping, dst, src, mode); /* Check whether page does not have extra refs before we do more work */ expected_count = folio_expected_refs(mapping, src); @@ -849,7 +852,7 @@ static int fallback_migrate_folio(struct address_space *mapping, !filemap_release_folio(src, GFP_KERNEL)) return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY; - return migrate_page(mapping, &dst->page, &src->page, mode); + return migrate_folio(mapping, dst, src, mode); } /* @@ -877,7 +880,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, if (likely(is_lru)) { if (!mapping) - rc = migrate_page(mapping, &dst->page, &src->page, mode); + rc = migrate_folio(mapping, dst, src, mode); else if (mapping->a_ops->migrate_folio) /* * Most folios have a mapping and most filesystems diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 5052093d0262..5dd97c39ca6a 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -718,7 +718,8 @@ void migrate_vma_pages(struct migrate_vma *migrate) continue; } - r = migrate_page(mapping, newpage, page, MIGRATE_SYNC_NO_COPY); + r = migrate_folio(mapping, page_folio(newpage), + page_folio(page), MIGRATE_SYNC_NO_COPY); if (r != MIGRATEPAGE_SUCCESS) migrate->src[i] &= ~MIGRATE_PFN_MIGRATE; } diff --git a/mm/shmem.c b/mm/shmem.c index 313ae7df59d8..e37ff6a1a6d0 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3801,7 +3801,7 @@ const struct address_space_operations shmem_aops = { .write_end = shmem_write_end, #endif #ifdef CONFIG_MIGRATION - .migratepage = migrate_page, + .migrate_folio = migrate_folio, #endif .error_remove_page = shmem_error_remove_page, }; diff --git a/mm/swap_state.c b/mm/swap_state.c index f5b6f5638908..0a2021fc55ad 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -33,7 +33,7 @@ static const struct address_space_operations swap_aops = { .writepage = swap_writepage, .dirty_folio = noop_dirty_folio, #ifdef CONFIG_MIGRATION - .migratepage = migrate_page, + .migrate_folio = migrate_folio, #endif }; From patchwork Mon Jun 6 20:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870946 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 aib29ajc254.phx1.oracleemaildelivery.com (aib29ajc254.phx1.oracleemaildelivery.com [192.29.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B4C6CCA47F for ; Mon, 6 Jun 2022 20:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=zg2lLhNFJWlg5SV1HB+o9WeV56BsrLGg7fOa8DdyGms=; b=rj+mHQqIc5EvzDoooX90Lz0SFYbRc1A9SJFVr4MOo9KA6+GlJ7EFuj4wuEj5MmvPKTtRX7CZHdby qAgarp3o/Oex3wqAF3FjQ/nG1q9+bZ5sn6IEp51jOAhK9urkoHBPDma9nE+at6CSyqbflZANNS37 k+v2FHstDd90TSrTiu6G6woi6j66MuxZiPlCuybFRHOLwJGUJe8aux//YHZDBEQexkAbxx2wUnt3 UCcnF2IvteL6yXAf+T7CttXg6w+J+fcHl1c3x6YBH6/HD9BM9jjDYkO9+M6FJwzsyluSERKWZmNt HJPiUxu3Y8KNdzF9IByzMt7oxvNuSRz4h69w5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=zg2lLhNFJWlg5SV1HB+o9WeV56BsrLGg7fOa8DdyGms=; b=CMeqjkl95XeJ9YXphS33cCYnXsLQr9UKrjqOSlIctPQSmySMxV4wTLkCwPhQ1g8hZlwU9Ws+mDud UzOpojuddBgAcVftXZjPeoMSzLYGJS0LIgmjH3/KVIyZd/rFL9qD+VIQfrfjLeN6DE9tA+ITJlxM Xkts6wG9LFjaX4gx1czOelqaKPAI/N27gvg5VyqoieQJV2H7QvfAZSSOInx8qaI5uPVoceRA5MhE vxEOMLutUtX6AKS/IN/YESD9m2jGIxtp27cX+o/dDZUPADLa8Bsb+xEs3IoDGFvqh1ZR4Xpeb37/ y/18rU/NE3zWJpKwCMRZEZLauxBgTXvloUo5dg== Received: by omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD2002HQPH1OU30@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:25 +0000 (GMT) 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=yRw8leL5SKtlh4++9TxNP+z712DV8+bDADLqGeitGxc=; b=SxeZ3A1uaIsSGG8YQDJB8CVjMo RhDHeQ42KfkDop6K5lQE8C+66YcnYa0VCURkfr5ICCpPaphHo5tX2HVRsMSJ7z/xTY+wZggTjRlxM R937PSGLmVLf2sFQ9kucQIoWF5+Ip9CCMWv+8GUOStUXo/SYT59CLtTLg4BCyeLkYS+LD24oYkB86 Gdv1EDhaJPx6MDDS40WYjhcZTnNgKHHs1PsB+4eWq1Zz4JEwiL3j3cAC0I+zzPj1FufrehBgeYqLq 9LYmEsmuoFe9IPIj9yF3rVW7aVqR5MdddkvzuRgBrp/A1g5lUBKy0RBihHd1nNA/I6c76YD4sjZsD zWdPDuag==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:39 +0100 Message-id: <20220606204050.2625949-10-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=165 mlxscore=0 lowpriorityscore=0 priorityscore=108 phishscore=0 suspectscore=0 impostorscore=0 mlxlogscore=409 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 09/20] mm/migrate: Add filemap_migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: vkIYjhstPkwDLbeIwTHQvAtEYaeVT8-P X-Proofpoint-ORIG-GUID: vkIYjhstPkwDLbeIwTHQvAtEYaeVT8-P Reporting-Meta: AAEfT4x9QmjKwdaWdGnzqkBfeuZ8Cw7odcDJYBmRXoEanMA+Ov7zgpj81MIaW95o 0bg8F0MCWjtDsfIKoD92o9aMEwAM2cTOAjlmNpvO5V+wui2HgEiTWBcYch4mIxwS CC4sRw//B0iDj2p2esOqBDg2xARy/G7o5oF+T7mo76uOBgGdULrxq7zcl3zfoAi2 HMkr7c/+FeiH7wjYPTQYJOy4VunOHLbQdHB4OaLtqjL4uYHo5baXA8fobTA0kNrO q64F2eD+n8OPPDdVfVMja6C+qbnOsxC08RFwcuivQZI3DMV2w27SFk/rfle8p5XL gefx4lxEVNG+m0ROw3ax1sawiG88pLm0X/dobsiNuSqmYpEvRryBbnK4OaDSasuB RSIuH/cnAlJMCQJBv+I/PvjjOuaE8xpauPBJWbVvSmirvHSPGBd3odvn/X1PHYBO 3zxvhu98SSI6JjlHBZjPgHfsdv0WtEEbPcSwKjW4xo0W9VXr+a/cnJpF/ng3eHh2 umdkW+I9Bu1k8FYUr4AYkCmwSTO+4Uuu0ndcwbPrRgQl There is nothing iomap-specific about iomap_migratepage(), and it fits a pattern used by several other filesystems, so move it to mm/migrate.c, convert it to be filemap_migrate_folio() and convert the iomap filesystems to use it. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/gfs2/aops.c | 2 +- fs/iomap/buffered-io.c | 25 ------------------------- fs/xfs/xfs_aops.c | 2 +- fs/zonefs/super.c | 2 +- include/linux/iomap.h | 6 ------ include/linux/pagemap.h | 6 ++++++ mm/migrate.c | 20 ++++++++++++++++++++ 7 files changed, 29 insertions(+), 34 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 106e90a36583..57ff883d432c 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -774,7 +774,7 @@ static const struct address_space_operations gfs2_aops = { .invalidate_folio = iomap_invalidate_folio, .bmap = gfs2_bmap, .direct_IO = noop_direct_IO, - .migratepage = iomap_migrate_page, + .migrate_folio = filemap_migrate_folio, .is_partially_uptodate = iomap_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 66278a14bfa7..5a91aa1db945 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -489,31 +489,6 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len) } EXPORT_SYMBOL_GPL(iomap_invalidate_folio); -#ifdef CONFIG_MIGRATION -int -iomap_migrate_page(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode) -{ - struct folio *folio = page_folio(page); - struct folio *newfolio = page_folio(newpage); - int ret; - - ret = folio_migrate_mapping(mapping, newfolio, folio, 0); - if (ret != MIGRATEPAGE_SUCCESS) - return ret; - - if (folio_test_private(folio)) - folio_attach_private(newfolio, folio_detach_private(folio)); - - if (mode != MIGRATE_SYNC_NO_COPY) - folio_migrate_copy(newfolio, folio); - else - folio_migrate_flags(newfolio, folio); - return MIGRATEPAGE_SUCCESS; -} -EXPORT_SYMBOL_GPL(iomap_migrate_page); -#endif /* CONFIG_MIGRATION */ - static void iomap_write_failed(struct inode *inode, loff_t pos, unsigned len) { diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 8ec38b25187b..5d1a995b15f8 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -570,7 +570,7 @@ const struct address_space_operations xfs_address_space_operations = { .invalidate_folio = iomap_invalidate_folio, .bmap = xfs_vm_bmap, .direct_IO = noop_direct_IO, - .migratepage = iomap_migrate_page, + .migrate_folio = filemap_migrate_folio, .is_partially_uptodate = iomap_is_partially_uptodate, .error_remove_page = generic_error_remove_page, .swap_activate = xfs_iomap_swapfile_activate, diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index bcb21aea990a..d4c3f28f34ee 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -237,7 +237,7 @@ static const struct address_space_operations zonefs_file_aops = { .dirty_folio = filemap_dirty_folio, .release_folio = iomap_release_folio, .invalidate_folio = iomap_invalidate_folio, - .migratepage = iomap_migrate_page, + .migrate_folio = filemap_migrate_folio, .is_partially_uptodate = iomap_is_partially_uptodate, .error_remove_page = generic_error_remove_page, .direct_IO = noop_direct_IO, diff --git a/include/linux/iomap.h b/include/linux/iomap.h index e552097c67e0..758a1125e72f 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -231,12 +231,6 @@ void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops); bool iomap_is_partially_uptodate(struct folio *, size_t from, size_t count); bool iomap_release_folio(struct folio *folio, gfp_t gfp_flags); void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len); -#ifdef CONFIG_MIGRATION -int iomap_migrate_page(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode); -#else -#define iomap_migrate_page NULL -#endif int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len, const struct iomap_ops *ops); int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 1caccb9f99aa..2a67c0ad7348 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1078,6 +1078,12 @@ static inline int __must_check write_one_page(struct page *page) int __set_page_dirty_nobuffers(struct page *page); bool noop_dirty_folio(struct address_space *mapping, struct folio *folio); +#ifdef CONFIG_MIGRATION +int filemap_migrate_folio(struct address_space *mapping, struct folio *dst, + struct folio *src, enum migrate_mode mode); +#else +#define filemap_migrate_folio NULL +#endif void page_endio(struct page *page, bool is_write, int err); void folio_end_private_2(struct folio *folio); diff --git a/mm/migrate.c b/mm/migrate.c index 6232c291fdb9..148dd0463dec 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -785,6 +785,26 @@ int buffer_migrate_folio_norefs(struct address_space *mapping, } #endif +int filemap_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) +{ + int ret; + + ret = folio_migrate_mapping(mapping, dst, src, 0); + if (ret != MIGRATEPAGE_SUCCESS) + return ret; + + if (folio_get_private(src)) + folio_attach_private(dst, folio_detach_private(src)); + + if (mode != MIGRATE_SYNC_NO_COPY) + folio_migrate_copy(dst, src); + else + folio_migrate_flags(dst, src); + return MIGRATEPAGE_SUCCESS; +} +EXPORT_SYMBOL_GPL(filemap_migrate_folio); + /* * Writeback a folio to clean the dirty state */ From patchwork Mon Jun 6 20:40:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870948 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 aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CCC7CCA484 for ; Mon, 6 Jun 2022 20:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=uVi3BViGwHVh3aaNhUTxQdtzqwE40surl5+dWdUrG2c=; b=y+XioO3xGaaXjhGqeIMyS2O+UG5j/F9BICkX8UAzKNgqt8fu74O7ohrv+YJ2Iu1PyGUz9UdUPaph Gr5vaP6eUxA8NhfNKrWt5d8cD4IMCH0FRGxEvB8Fj6Ui6tgFWaA4SL+IZGfVdc9QLExDuP6/st7B /k6OLWwhvV1jN0ggSaJO5GySWAPDPHkmGiKWxeKBQy9hk0KJulCk00DeMnHJ/4guCK1IgUVW68BU wCxv7iKyhBUVyu08RW+AtVjDMt4vIrpl7bheXs8KMgTZlaNqvQLtODbfpRm1088B/cBuIaoDRTFW WrGztP9PBTpB5JoGIa2hvEr5nXdLeylPWWrGTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=uVi3BViGwHVh3aaNhUTxQdtzqwE40surl5+dWdUrG2c=; b=hwxAempgrCzEfGBk6TD+ruFo2ug+7K+s73G0bcZA25G1/gO+QJl9kFZVkUGpqHQ+Ai/E4duxjc9a DEtx/b7HFmW9HE7EbKVbb7shXQMh6aL3bFvSsUGi8DOElwn0KoSg3wTYzeGBN91D4GwtL0Zftf5J lkQaBi/RVy9xsuo06eE9vfBgMLCX+DmvTNrmgXulZ+bdk6r+6Z3dd5KuWHgOx82j0I02AY747v09 /LuaEcvL8GZYKlpm7Tbhzpd97yI0agmjpNwa9G5ZEuQGIyoMR3kcCuyUvYY7PBBWUAtv8U+d+gRe x6dSg/klqtlbyy6Qf3LyD9IAQjfvx7abOY7Mog== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CWQPH6G830@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:30 +0000 (GMT) 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=MljmBGg5QLNrlXQo2zoqyO/w7uyNryh0JirP0K7S3ag=; b=crx1P1AOzfaVjsIjKFsnW/dRPz BXw2ENLZjBS3Tf/K4vlxUvTW65vSWeLe4SK5T0Xn+T+dHDiJg0i+lSt2MU+wL0lJZ5+okWaxAgbc0 Z/vst7YgLlz94wNZjneO8OUXYrNEJKVSQQicN17cN1YoPQTICS4bXGxyDlnzy9O5ahmISSxp7vpN/ Hwqq/epOdfS0GN2mfRLkGMDSNsHzoUSO3A1kzb8obP6+oMgROyOVolsUsjhQaeGAY7SVGoFC37P39 vXEmqMt5KDLiFuVK/vK6EVvywxX227bt9H9wiRu2WVwsFGhB7SVM3X8Mlqtvyz7jItHArnFsZxYgX ssmeGojg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:40 +0100 Message-id: <20220606204050.2625949-11-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxlogscore=619 mlxscore=0 spamscore=0 suspectscore=0 priorityscore=115 phishscore=0 clxscore=126 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 10/20] btrfs: Convert btrfs_migratepage to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: IgUYTdOJ0eLN-ZPTzuGT7EiDkO3eYKDa X-Proofpoint-ORIG-GUID: IgUYTdOJ0eLN-ZPTzuGT7EiDkO3eYKDa Reporting-Meta: AAERZj8mkz0aTDXy/y2S56ygoDSx2v72QWWLs4qfubVg/8QbxdpE2CEZ8CtzASYq PVKMMdtYJkgm2kasANXYHQ+olhbxt8sqFbNzkkdQIWGdmO3qcApppYWrfSRb+bnh zf0mKY8ago3PldxArik5wUYGm63ddsyRMc63aprDawLCbIZ+t+rDHWmchZ4OmZAm PORkzOAm/6tMSuIeIyT5JxbVi9sfDQj+Da9LFHV840hCKBWXOx36H9TU0xD3yLmD faIPX9ijEM8yGnSWIkkGv+r4WZffwvF2XxL4DdEhePgo34JagRYmYFI4eSUtchgw UF7MfymTtGyYgvRgWHNljEJNKXh0DRYCcfgLEzZrEbysvlH89WIGucmUS3rN9bNT rHc39XDVpN7uDNj/defdINZGiAAvrezh5STL4izvvIheTFLNZi5m1gVmzPzIZHTG HKJ3nJP1QnAxrdk9XMPAdJD/nAbOAdELfrz6ThHMi9Kve29eb5oZIiJYk0ZGNuEz qvBNkKhfpoX+yDtzq7ZulY+eSOI7sfAA8cavgYb95U0EqA== Use filemap_migrate_folio() to do the bulk of the work, and then copy the ordered flag across if needed. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/btrfs/inode.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 81737eff92f3..5f41d869c648 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8255,30 +8255,24 @@ static bool btrfs_release_folio(struct folio *folio, gfp_t gfp_flags) } #ifdef CONFIG_MIGRATION -static int btrfs_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page, +static int btrfs_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { - int ret; + int ret = filemap_migrate_folio(mapping, dst, src, mode); - ret = migrate_page_move_mapping(mapping, newpage, page, 0); if (ret != MIGRATEPAGE_SUCCESS) return ret; - if (page_has_private(page)) - attach_page_private(newpage, detach_page_private(page)); - - if (PageOrdered(page)) { - ClearPageOrdered(page); - SetPageOrdered(newpage); + if (folio_test_ordered(src)) { + folio_clear_ordered(src); + folio_set_ordered(dst); } - if (mode != MIGRATE_SYNC_NO_COPY) - migrate_page_copy(newpage, page); - else - migrate_page_states(newpage, page); return MIGRATEPAGE_SUCCESS; } +#else +#define btrfs_migrate_folio NULL #endif static void btrfs_invalidate_folio(struct folio *folio, size_t offset, @@ -11422,9 +11416,7 @@ static const struct address_space_operations btrfs_aops = { .direct_IO = noop_direct_IO, .invalidate_folio = btrfs_invalidate_folio, .release_folio = btrfs_release_folio, -#ifdef CONFIG_MIGRATION - .migratepage = btrfs_migratepage, -#endif + .migrate_folio = btrfs_migrate_folio, .dirty_folio = filemap_dirty_folio, .error_remove_page = generic_error_remove_page, .swap_activate = btrfs_swap_activate, From patchwork Mon Jun 6 20:40:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870942 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 aib29ajc245.phx1.oracleemaildelivery.com (aib29ajc245.phx1.oracleemaildelivery.com [192.29.103.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 048E1CCA48B for ; Mon, 6 Jun 2022 20:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=NKSCM2LfjJ/yopq4s8N1Z7tJbrMEPDsJ+WlIgHQ3UHA=; b=NTO4H+Zv+Gg/mHZ3stmsuKMRJ1o4hdyHdwrqADtSHXFDWjXiGMOm79WvRibJ5Az7WTEO4By7c5pa aN7MXmv1Iu+eYFuP3hWqIVOG+gY+JwUaWAEDf0k7Xq5YYx6E4aerqk5WZVXoDrK6PeYCDBOVSaai QHv+FpOklM38dHCUGJJOp0nUnKU6T+I5aKeXjB8ealgmnULW073OnvxYu40FRe7CEjWB6N3lY7lO q6QqrI4klzJhdDxRXCnDEKLkZXpqCM5ICGrlihWztH3ujYgKZofHuyuxlwC1vLNutUk7kh7XiymM HfTc7GTGlbOYSgKPdMxHcRDnmm0WFIc+wmHInA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=NKSCM2LfjJ/yopq4s8N1Z7tJbrMEPDsJ+WlIgHQ3UHA=; b=I358apc7KV1qwv016vq5/ZQlMf1rU38im3pNJqijBkMcN4/IziZzaHBj+qX6giV5M6+ITbWLoPIi tDY8I4EzEQ/GkBUZFvhXIWIiD6NfDV4HPO0NWhBUKiEUDUopkZVQaF8ti1PTCFxuAxWAQkrK+Pvq wKMYUyRbuG9s3D5jRTEoGJcSnW+OYeEFHGoNTT2VBGSBatH6HWPtAiYQC2aVGO5ObBO7sc8e1lF9 3vO/iRyDkYO0PtERmrAq21vlneLdPuOJHhKWXbf7mhFBl/ZjnTdLr2+N4WYWJ0DVZU6Ir5riNOjj XhqlMoucsXjpVh9AJ+T0ZjVr3H6CBXYJuD/nLQ== Received: by omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD2000X3PGW9NE0@omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:20 +0000 (GMT) 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=jUHtPvxpwYn/CbCKtCO4gIDrDPVTvyaQoVGtIQShqV8=; b=jSXisP6LX46D6Mw+iXYFF/5dHQ Cq+5Fi0773+cVC4U9ukK6uPnYuWIfkHADg3G9SiZaN1QWdL8Bw8OwfYPT7xfddEiqh5OKP81yWVIY qERnKHNvRO9zfbKpGHImXAVxsBisgmn/CxiCns5EQmSUyg3J6K8R2kkkIDgNoaevsqaLFhC5Wxh52 Z38Ws7TQ5Dp7rpDRe4MO4DakZ/+co05qxKtyfgyK3bXqUiSNs9vH9ETqmdeoiAv+unUA3cgwymN9t pq0eOgOppmxZCcU/ekIrK65xO/nlqiG9Pvvr5StvpmfjnqBIWv5xh9xJykbFL+Cw79+wHE0k8kIBA U9JkUfCw==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:41 +0100 Message-id: <20220606204050.2625949-12-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 mlxscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=469 adultscore=0 impostorscore=0 clxscore=116 priorityscore=115 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 11/20] ubifs: Convert to filemap_migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: pDfshP228Maqb69XkQ8L2_pyjdNblXNK X-Proofpoint-GUID: pDfshP228Maqb69XkQ8L2_pyjdNblXNK Reporting-Meta: AAFCp4idPUo21eGRRaEq8/7nxXPHS7UPiqYODDrwqZV6YFcqpaepzGao1zDNO1gO ZW1ir5bQijuBylALth1PsMGuClFzxmrexoXLRiVHyeyR17czbYR6MIvyB2mdmhOB bUn88XhIrq/CVmYixZ7JX2KyOM0sjkf/WXHFMeAUHuanq0dS52v6C5eJSqw8ghRb mkTLbTFWmHEFMKE1/A7KQuPtjV8nF2WlGAmH382tanlGT4C/GuwbIXIjej8wXeFI NrYkg2J2Bg7gj9bZ1AFOjjeRvl4F09yXXIFhcNimclKbgT9lDTpOS4dpFdmnehCq DBAPG0v3qMQw7HKIHns3e0eg2Vc/dvX4ZJ36bnIma/bpaT4TpFQ6BQoM3ACNxcjY ya2fOg1IEXMwQ9yS2rpQnS97wtv5bX+jFppY+oZYRqn8w8aLTIVDg2KrUIEUg/7w VWuFJpC4c7K/WQ9snlFY7hbm+GR8KiQruQ38k4TifJewAzUo0e0jgwRKJ5HOXM5C VW+d1lCHhQOC1R4SrINr0yHb7+j2Tsk6WH6rnsl3/12i filemap_migrate_folio() is a little more general than ubifs really needs, but it's better to share the code. Signed-off-by: Matthew Wilcox (Oracle) --- fs/ubifs/file.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 04ced154960f..f2353dd676ef 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1461,29 +1461,6 @@ static bool ubifs_dirty_folio(struct address_space *mapping, return ret; } -#ifdef CONFIG_MIGRATION -static int ubifs_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode) -{ - int rc; - - rc = migrate_page_move_mapping(mapping, newpage, page, 0); - if (rc != MIGRATEPAGE_SUCCESS) - return rc; - - if (PagePrivate(page)) { - detach_page_private(page); - attach_page_private(newpage, (void *)1); - } - - if (mode != MIGRATE_SYNC_NO_COPY) - migrate_page_copy(newpage, page); - else - migrate_page_states(newpage, page); - return MIGRATEPAGE_SUCCESS; -} -#endif - static bool ubifs_release_folio(struct folio *folio, gfp_t unused_gfp_flags) { struct inode *inode = folio->mapping->host; @@ -1649,10 +1626,8 @@ const struct address_space_operations ubifs_file_address_operations = { .write_end = ubifs_write_end, .invalidate_folio = ubifs_invalidate_folio, .dirty_folio = ubifs_dirty_folio, -#ifdef CONFIG_MIGRATION - .migratepage = ubifs_migrate_page, -#endif - .release_folio = ubifs_release_folio, + .migrate_folio = filemap_migrate_folio, + .release_folio = ubifs_release_folio, }; const struct inode_operations ubifs_file_inode_operations = { From patchwork Mon Jun 6 20:40:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870937 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 aib29ajc254.phx1.oracleemaildelivery.com (aib29ajc254.phx1.oracleemaildelivery.com [192.29.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01092CCA485 for ; Mon, 6 Jun 2022 20:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=ufj5svfC2INUMvENyYAqqd/TM8uJgDXbzIMnYpSNakk=; b=Aw/hQS3HM4p3TXCeyMpXwH6Mcomyxk1ECTuEsBGZCdbf7WYgd0M1/EdJ+YKmOYh+S6mjWaobNKec a/mulV2/hqIwpV/pbGUgF0jGQ6Fq2wwqaa2lWxQxrZ3W9kL29M8mPJ9HsmnFFnWZw0fHRI6SIJhn wFVlnV3DocooJ0Ka7CMsktzL/QhE4lHfAocM7OmiasEhid7pnMRkem7CASYBHftXwBAib+hwPSwi GhaFbaOyFxG00k2Ta/0LUpREG7SeKsvp2R/HRTOY81/FNKRrcyuAC9weuqiDOmOMz4DQ+UqOgTwu CVvSvXB8+cVKua8UnSTUE0JN5eJXj3geOk2G3Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=ufj5svfC2INUMvENyYAqqd/TM8uJgDXbzIMnYpSNakk=; b=T2a06S4xO4TnAQ38Gb+qGhO8U7wMEDhvdNuR730yQumPhV6/QNfMw+QhhY+uw7j2OWBUBgoOzYz+ mI6f0ZImcV69r6xTNbjXzET9AN0dqc0ZqShqc11HBHJEIXOHtee3v1+PcUqnwuPFSVjxWm3jHGiB P0gR0dhC58mPfROLVvVUcUw9BiNHHjRTU/b5KdNOaEPxfnVt7tQSEe3WkUiUce0tXedLM5NYrorA B6qo+gUWi9o+oZ2fLdC0+vIIdSjC1KgUOVwKjKTYD2Fb/u+SIQnVkd8U48uVdv7AGnqIbwKJNGra oEJ8hJF4cSxSDnSetSoIrwnZj3wpAUTrPQ9tVg== Received: by omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD2002EYPGUOU30@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:18 +0000 (GMT) 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=6sny7mgbMzuLsgsgFN8vZ/E7WcZlP1DaRKRtHbfX8Jw=; b=ukaURbWCm8w3KS3KzoVJUL3FxY wPlS18+1fh2iCVNChPqRPFTRbEAtlGq0XwMOhU5vLgXypaXzfZHPQHZ1bZ4aQLr6Cu5P4yx0Kxma8 0yqfDFojKiDMNDRg/HtYwsxO/5Fhsv16i+mFYNs6xr/xrTZFC/MBisglBy5L4jIm9MB5Kv2FAVqXV XxvToTCQvDD1XlfJcZCtmPoTaDK39ctCmCZdLVOEq8NDfk4AFr30qp2hJ/HL+HMnFTZ0pIgzaZ1s1 wQ/JRTi1nkJymMfIe48lYeHhHid1CC1P28h0uKjey4WY0qpcZHqgqc7fRJ3/TEyvZHuwFjaV+eKj3 1m9LeW5g==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:42 +0100 Message-id: <20220606204050.2625949-13-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 clxscore=163 impostorscore=0 adultscore=0 priorityscore=108 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=577 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 12/20] f2fs: Convert to filemap_migrate_folio() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: rBwquFiPGKp1XSfInh8SnVji7IdweOHK X-Proofpoint-GUID: rBwquFiPGKp1XSfInh8SnVji7IdweOHK Reporting-Meta: AAEdPrqLCFY7r7G7k3NOnXgTLFDvRMAkJOj1nNWRtdVINk8yzveq8HATThCmR31P UbzSuoRVU9OmERKNBKor7IvldrBUJzFw2sYtQ7LHu0qH3vy5dn/o6iElQua9nTjT 60kS3MMiSNVySLSSySUKnJ9M2PVdgSL2DkMWnpLz8BHrkjKTbMUdXi2JqMDL5HO7 zJr95DsRpIGeld4PzXT7IprgvvBAytbQDWFrSDXfIF+8l9gsiUK5PN27IuocTNl4 3jntqDt+iqqfdXHqsqIkJ0g4TTMOZhwai/bD6iYsvhjzXHdyVXqrJH3iXXp+vlW+ tnehzavsnQZLcBovja3gu7QhWrUR1Aaw360+Jk8ALRhDZr84CaxjYFL6fT4c4nk6 eZgbsQimI13CS7IoOElZH94R9YV8y4YYEdopVapg738LkaJjIf/yIa9F0FiIRKZe M68gJjrE1kBirYG1j9eyWJvxojyeXSP1lmMg0MImhELBZ46Uwvqo5HLijPcCah98 WWRr73aiGnctqrXQeuhorhneP1DYLN1rwDTv6bGtJZ22 filemap_migrate_folio() fits f2fs's needs perfectly. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/checkpoint.c | 4 +--- fs/f2fs/data.c | 40 +--------------------------------------- fs/f2fs/f2fs.h | 4 ---- fs/f2fs/node.c | 4 +--- 4 files changed, 3 insertions(+), 49 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 6d8b2bf14de0..8259e0fa97e1 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -463,9 +463,7 @@ const struct address_space_operations f2fs_meta_aops = { .dirty_folio = f2fs_dirty_meta_folio, .invalidate_folio = f2fs_invalidate_folio, .release_folio = f2fs_release_folio, -#ifdef CONFIG_MIGRATION - .migratepage = f2fs_migrate_page, -#endif + .migrate_folio = filemap_migrate_folio, }; static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 7fcbcf979737..318a3f91ad74 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3751,42 +3751,6 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) return blknr; } -#ifdef CONFIG_MIGRATION -#include - -int f2fs_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, enum migrate_mode mode) -{ - int rc, extra_count = 0; - - BUG_ON(PageWriteback(page)); - - rc = migrate_page_move_mapping(mapping, newpage, - page, extra_count); - if (rc != MIGRATEPAGE_SUCCESS) - return rc; - - /* guarantee to start from no stale private field */ - set_page_private(newpage, 0); - if (PagePrivate(page)) { - set_page_private(newpage, page_private(page)); - SetPagePrivate(newpage); - get_page(newpage); - - set_page_private(page, 0); - ClearPagePrivate(page); - put_page(page); - } - - if (mode != MIGRATE_SYNC_NO_COPY) - migrate_page_copy(newpage, page); - else - migrate_page_states(newpage, page); - - return MIGRATEPAGE_SUCCESS; -} -#endif - #ifdef CONFIG_SWAP static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk, unsigned int blkcnt) @@ -4018,15 +3982,13 @@ const struct address_space_operations f2fs_dblock_aops = { .write_begin = f2fs_write_begin, .write_end = f2fs_write_end, .dirty_folio = f2fs_dirty_data_folio, + .migrate_folio = filemap_migrate_folio, .invalidate_folio = f2fs_invalidate_folio, .release_folio = f2fs_release_folio, .direct_IO = noop_direct_IO, .bmap = f2fs_bmap, .swap_activate = f2fs_swap_activate, .swap_deactivate = f2fs_swap_deactivate, -#ifdef CONFIG_MIGRATION - .migratepage = f2fs_migrate_page, -#endif }; void f2fs_clear_page_cache_dirty_tag(struct page *page) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index d9bbecd008d2..f258a1b6faed 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3764,10 +3764,6 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, void f2fs_write_failed(struct inode *inode, loff_t to); void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length); bool f2fs_release_folio(struct folio *folio, gfp_t wait); -#ifdef CONFIG_MIGRATION -int f2fs_migrate_page(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode); -#endif bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len); void f2fs_clear_page_cache_dirty_tag(struct page *page); int f2fs_init_post_read_processing(void); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 836c79a20afc..ed1cbfb0345f 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2163,9 +2163,7 @@ const struct address_space_operations f2fs_node_aops = { .dirty_folio = f2fs_dirty_node_folio, .invalidate_folio = f2fs_invalidate_folio, .release_folio = f2fs_release_folio, -#ifdef CONFIG_MIGRATION - .migratepage = f2fs_migrate_page, -#endif + .migrate_folio = filemap_migrate_folio, }; static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i, From patchwork Mon Jun 6 20:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870940 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 aib29ajc247.phx1.oracleemaildelivery.com (aib29ajc247.phx1.oracleemaildelivery.com [192.29.103.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20F33CCA488 for ; Mon, 6 Jun 2022 20:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=hWGVZX9ItxUtVxHFxLTz/ebp/MB2xIP06CylR8zzBNw=; b=BCtmm69iuTclR7aPQpeVu/dZ/vU5D4nXE1zOs+mmGgZ1pg9BiGl6QAoRMukpHDcmJcZZMQemxpuq 7dQjxSn53XZKtIFaVdh/9doohCpCt9E6D3OBqoL744jPblyfUb2xq4HftZZh4Uk/uWiNpWu9p4Kk UUqTW8YsAVNcskXXE1KnrhGcBFYlm2UWrCX/aK/t0mGi5A7pBR6dXgP5z5QVpweWpSLyjVju0EAa 5KG+hXJS9QPJD4Nlo2uaG9Ld+erpfzyYj3hS/yWB55/m96tQk5i5VK91RgjXLjhoNbgM0iR2t+Y2 6DCqyTzxbT4EatCDWB78DRMs1Xc9S94zhB5fpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=hWGVZX9ItxUtVxHFxLTz/ebp/MB2xIP06CylR8zzBNw=; b=Dn8IvgxbGJadVD5XSXsYav6hvcToWjZZmPyLAOS1qE17Xub8akIuqTYhcP6bUyin9J14EGNKgGSp 07XzHSE/EqkFXLpIdfQVFVH7QiJ1gAdy7cMs0UKF7PU2+W9jtFMPd3fk7TE7pEgzLAICGGHNwogt 8vSzkFIdXExqHdSCxA04BoW5Ycyqn67ZUHghk4XNouy1evev9upZYOO2wVSynRdauLHyOcs7+wk/ LgxcQYuDe7sRtzZtIBj6K2yEV+yc9uJCjkqj1AFBRED/ID+5k4ZnPx3kkXH7OnPeLhvJppvgKdYt sWb+7X6o5ExaUC+qyLqu2grdqOT5MxEeOslW5w== Received: by omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CJ9PGVQR60@omta-ad1-fd3-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:19 +0000 (GMT) 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=2zqEa9EzjfvcCB/R36xszZ4AMZtdcV59XiMVDc9jTyM=; b=U+BqaoSQWdsShi/y8CPTtTig63 HCMa7+gIZx7Yyb6cusLNuXKWsG06WN8xz/erKBPWuYizRThCX0iiljqhNcZd2weflUVCtiqE770D/ Vb15aA5PxUQlAGcLo3M0XEH41Q/fMFbQWUysBrY6PEG35YJKOueNndbkU/J8qu3X5pGzhsOP7ol4W F3RaDu2I/zP67juMsLCzxygZBIwXjKCl86d9jfX6rvdn+U142VP0hON97WCqvsixaBkAVbsODa0Rm STrW9jc4kjH9X53B35Fdz629pIYD4+nkkWKOdWUlig7kbghCKRcjBc7pf8npYNE/LtOnrV8sVT0Vs SEGqa5Hg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:43 +0100 Message-id: <20220606204050.2625949-14-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 phishscore=0 mlxlogscore=467 spamscore=0 impostorscore=0 suspectscore=0 clxscore=165 malwarescore=0 lowpriorityscore=0 priorityscore=108 bulkscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 13/20] aio: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: vL4nFRRaMU5IvLmMgRjnYN3W8DhX3_Sm X-Proofpoint-GUID: vL4nFRRaMU5IvLmMgRjnYN3W8DhX3_Sm Reporting-Meta: AAEgkSS9QP2YsXqix6eEe/7MLsZzWCOonWlJ9vFpKwY+GnFzG9+JMu/PTDS+yZwk aX99cUSaLdyt9E4xKcdBmZhAXnud0pOW37k2BazGmCShWgzFeC2zsiIMkGijXZ3e Gz0BQOv7F9D5yW0waKK4/POTxNSkP4nmacSAu7J6gqkMZat+AxpVWuVk/qchz4Lt R1PldaiJyB6PcmeqMsgigobVNoucdVYy5Mf1j7gqCOQ/m4PYvut3hI5VJn/Nf+Av GK8yGerPPkTrf5ot/jrfDI68z215EqCoqJefjUdxAxTD+LXXJ8Vqxgf8GaDdVxC2 7utGeb2jCt1HHrNNaHVKcdzZAETlqWkPo2v6Qn8BiMz6IZheXJhP8AG6muJ+z7iN ceXbWS8hdwcuPRPKvVZ0LcrtAFHeFYDuDU/yqV2EHu+9JzY+5reY0PH7jOMHh4W9 Hb+VCAACvgOM60z02/GpH9ebw78ROZ6wzRYkTK6q0aHcJM+iQadM+NydsPMkyMDy BC8e7Di7DP8c+rFn/XjrcqYVtnEHPJeOPrEG/aIAjGo8 Use a folio throughout this function. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/aio.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 3c249b938632..a1911e86859c 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -400,8 +400,8 @@ static const struct file_operations aio_ring_fops = { }; #if IS_ENABLED(CONFIG_MIGRATION) -static int aio_migratepage(struct address_space *mapping, struct page *new, - struct page *old, enum migrate_mode mode) +static int aio_migrate_folio(struct address_space *mapping, struct folio *dst, + struct folio *src, enum migrate_mode mode) { struct kioctx *ctx; unsigned long flags; @@ -435,10 +435,10 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, goto out; } - idx = old->index; + idx = src->index; if (idx < (pgoff_t)ctx->nr_pages) { - /* Make sure the old page hasn't already been changed */ - if (ctx->ring_pages[idx] != old) + /* Make sure the old folio hasn't already been changed */ + if (ctx->ring_pages[idx] != &src->page) rc = -EAGAIN; } else rc = -EINVAL; @@ -447,27 +447,27 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, goto out_unlock; /* Writeback must be complete */ - BUG_ON(PageWriteback(old)); - get_page(new); + BUG_ON(folio_test_writeback(src)); + folio_get(dst); - rc = migrate_page_move_mapping(mapping, new, old, 1); + rc = folio_migrate_mapping(mapping, dst, src, 1); if (rc != MIGRATEPAGE_SUCCESS) { - put_page(new); + folio_put(dst); goto out_unlock; } /* Take completion_lock to prevent other writes to the ring buffer - * while the old page is copied to the new. This prevents new + * while the old folio is copied to the new. This prevents new * events from being lost. */ spin_lock_irqsave(&ctx->completion_lock, flags); - migrate_page_copy(new, old); - BUG_ON(ctx->ring_pages[idx] != old); - ctx->ring_pages[idx] = new; + folio_migrate_copy(dst, src); + BUG_ON(ctx->ring_pages[idx] != &src->page); + ctx->ring_pages[idx] = &dst->page; spin_unlock_irqrestore(&ctx->completion_lock, flags); - /* The old page is no longer accessible. */ - put_page(old); + /* The old folio is no longer accessible. */ + folio_put(src); out_unlock: mutex_unlock(&ctx->ring_lock); @@ -475,13 +475,13 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, spin_unlock(&mapping->private_lock); return rc; } +#else +#define aio_migrate_folio NULL #endif static const struct address_space_operations aio_ctx_aops = { .dirty_folio = noop_dirty_folio, -#if IS_ENABLED(CONFIG_MIGRATION) - .migratepage = aio_migratepage, -#endif + .migrate_folio = aio_migrate_folio, }; static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) From patchwork Mon Jun 6 20:40:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870957 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 aib29ajc249.phx1.oracleemaildelivery.com (aib29ajc249.phx1.oracleemaildelivery.com [192.29.103.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E876C43334 for ; Mon, 6 Jun 2022 20:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=sug3bC8gsEvGc03k5/UPZA624BldfG0gsXUuQm5kn3c=; b=uIW6CHKqxSizpK8jd+J7cnXakJiNa5SUCT62iKfers5a8P8I4hsevluylkSV8N04ObERLBe4h9Kc 7thbH1SOa/j9Y8JZL6k7uyxsbU8/dGD16J/ws3buXKopqY0kjj/6kKObVJ2c0RsArL2b1L0eVEFB O7IY69rYYx2ihSc1r2bmxXp/hgMBJalY3nB6HbAbqEmvpj2GmYcIlKvQybiPih49ugmQecVMU+h7 j+L3PGNW8JpcJrbOfV0TX5c+3nCpUL+EG/ZfuhFJNVmk6i5CmiSv9PHS3HIMfyGMmgDrBt8Nanei 92XVdTbkaSKAVK2zOvs3FUx2BejrH8DxHyquyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=sug3bC8gsEvGc03k5/UPZA624BldfG0gsXUuQm5kn3c=; b=twxjUiPv/URY3wgpkzBEY7BS9yeS0uNCfk8B/uepj/QXj068xB2tRaqUXMJOAiZqKeiwR2//6DOR 1LK78ZdHNcCEO/K89PX/8SiMmUAxLUOGF3q3bqmC1WcRFoy381dkEFMAM+WyTJrXqJZYE3xNP1vg VhNdMYBKT4vzg5eng5rw3vdxGpXS5V0PmwHQgPWOKjWWQoEY48cSEAl8LifoBLeGGfB1EbbfxteG Dc5YCeWfJOqB6eKvpF5yIQDnvoTIqTRTS8gZywFbCKXjw0vBwGXcuq80Mlad8ucgDm52YnFwo7SU XuzNIvp/0CC0ektVqGDle/iBwllmZMxUi4OcYw== Received: by omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200MD2PHRI5E0@omta-ad2-fd1-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:51 +0000 (GMT) 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=o3aaQHfQtp8mApg3jGvaUbMxXMesQjforjwRq7Bq2eU=; b=FEnR7eEx/VqQapCb2J1x1R7fqn GHGdnHs4TAUYPhigynTRMZ8qU4EWbsdGE3TfoyFJqfBAgGTtewYKTmiwvMMYa2HzGM87YYHNNNBAf 25WKlfaBUvQt5+7ogUbK8K0pDyk13POFE1JCVwn42/GfMWEBrYZHN2/3N10M2ljY4Z2NIxy968T1O HE7TzEF3cSl9U3cZr+DVtzHy9GRmE/G/dKDgi6vIqQx9YHC1/Rfaz1Ct+G2LHZg/lo5tSznhIMqdV W1GO7z8A4xasl5WYZ2TeCzudph+MgQrRtd+cB9PyhUGii++9HtpbBEllVTWL/01DS9ex+eqAgijud Ea0r0KAw==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:44 +0100 Message-id: <20220606204050.2625949-15-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 clxscore=159 malwarescore=0 priorityscore=164 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=312 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 14/20] hugetlb: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: hJo-X_1AV9k7o0ft57n4pIJ8V4BQkiu_ X-Proofpoint-ORIG-GUID: hJo-X_1AV9k7o0ft57n4pIJ8V4BQkiu_ Reporting-Meta: AAGI4P+5Pc6vSwoYAy3AC6quC2xEsBAf5twOOeg84tkHyK+Yrw30v4F7hc11T6XE yfv4UbpObC/Zpepo7kN2Okv+89cPpVp26SGp9B6T8paGQnh0OpBtnAQGrzG+FqpQ hnrj4VAPNFBsZQqpm6B75PSiKFNarjskoVcbN4Vx9pNxqlQmUH1WmPpgSuCGE6I4 wGdp8egmLTyYLfA+L3L6UA+ohrjnpJ0RxMovXMS9iLsFEsU7VJRVpQkSNXEGD1os ryL4R8D2C7zCzeKJIfxzAhmA3OsNJygbEqbtu6xfRIv/j35NSrpPquj0NIUiGPN5 ioCsbyAYSX/7VtlJk3vJGJ+qu1PK8pVU5FX7U14hbGjQ+qL+sUQUmDWyYpSeTluu ubRwOoDYSF5Tma19W6eZncI0D2Pi6LCFnMJiBzwKDn7346KBcdsheBzPOLzB0db3 UKezD9s0gvi8FZp0+ijPPicGlwhK+hInKEFTaujvBeRk90l8lCBkzsatgwz6vZKo S2WbhWGcnJZztb5uJ2buvYC/navbQ3zVo6yuVS/p7pU= This involves converting migrate_huge_page_move_mapping(). We also need a folio variant of hugetlb_set_page_subpool(), but that's for a later patch. Signed-off-by: Matthew Wilcox (Oracle) Reported-by: kernel test robot --- fs/hugetlbfs/inode.c | 19 ++++++++++--------- include/linux/migrate.h | 6 +++--- mm/migrate.c | 18 +++++++++--------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 14d33f725e05..583ca3f52c04 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -954,25 +954,26 @@ static int hugetlbfs_symlink(struct user_namespace *mnt_userns, return error; } -static int hugetlbfs_migrate_page(struct address_space *mapping, - struct page *newpage, struct page *page, +static int hugetlbfs_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { int rc; - rc = migrate_huge_page_move_mapping(mapping, newpage, page); + rc = migrate_huge_page_move_mapping(mapping, dst, src); if (rc != MIGRATEPAGE_SUCCESS) return rc; - if (hugetlb_page_subpool(page)) { - hugetlb_set_page_subpool(newpage, hugetlb_page_subpool(page)); - hugetlb_set_page_subpool(page, NULL); + if (hugetlb_page_subpool(&src->page)) { + hugetlb_set_page_subpool(&dst->page, + hugetlb_page_subpool(&src->page)); + hugetlb_set_page_subpool(&src->page, NULL); } if (mode != MIGRATE_SYNC_NO_COPY) - migrate_page_copy(newpage, page); + folio_migrate_copy(dst, src); else - migrate_page_states(newpage, page); + folio_migrate_flags(dst, src); return MIGRATEPAGE_SUCCESS; } @@ -1142,7 +1143,7 @@ static const struct address_space_operations hugetlbfs_aops = { .write_begin = hugetlbfs_write_begin, .write_end = hugetlbfs_write_end, .dirty_folio = noop_dirty_folio, - .migratepage = hugetlbfs_migrate_page, + .migrate_folio = hugetlbfs_migrate_folio, .error_remove_page = hugetlbfs_error_remove_page, }; diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 4ef22806cd8e..088749471485 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -35,8 +35,8 @@ extern int isolate_movable_page(struct page *page, isolate_mode_t mode); extern void migrate_page_states(struct page *newpage, struct page *page); extern void migrate_page_copy(struct page *newpage, struct page *page); -extern int migrate_huge_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page); +int migrate_huge_page_move_mapping(struct address_space *mapping, + struct folio *dst, struct folio *src); extern int migrate_page_move_mapping(struct address_space *mapping, struct page *newpage, struct page *page, int extra_count); void migration_entry_wait_on_locked(swp_entry_t entry, pte_t *ptep, @@ -67,7 +67,7 @@ static inline void migrate_page_copy(struct page *newpage, struct page *page) {} static inline int migrate_huge_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page) + struct folio *dst, struct folio *src) { return -ENOSYS; } diff --git a/mm/migrate.c b/mm/migrate.c index 148dd0463dec..a8edd226c72d 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -475,26 +475,26 @@ EXPORT_SYMBOL(folio_migrate_mapping); * of folio_migrate_mapping(). */ int migrate_huge_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page) + struct folio *dst, struct folio *src) { - XA_STATE(xas, &mapping->i_pages, page_index(page)); + XA_STATE(xas, &mapping->i_pages, folio_index(src)); int expected_count; xas_lock_irq(&xas); - expected_count = 2 + page_has_private(page); - if (!page_ref_freeze(page, expected_count)) { + expected_count = 2 + folio_has_private(src); + if (!folio_ref_freeze(src, expected_count)) { xas_unlock_irq(&xas); return -EAGAIN; } - newpage->index = page->index; - newpage->mapping = page->mapping; + dst->index = src->index; + dst->mapping = src->mapping; - get_page(newpage); + folio_get(dst); - xas_store(&xas, newpage); + xas_store(&xas, dst); - page_ref_unfreeze(page, expected_count - 1); + folio_ref_unfreeze(src, expected_count - 1); xas_unlock_irq(&xas); From patchwork Mon Jun 6 20:40:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870952 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 aib29ajc254.phx1.oracleemaildelivery.com (aib29ajc254.phx1.oracleemaildelivery.com [192.29.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 526D5CCA486 for ; Mon, 6 Jun 2022 20:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=j9oIlB2zpOVUvxG7czgZCBdrSOn/dyS3rp4c+8XX6xc=; b=FWnNBoeldp5I7x5eACrMRmCw9BT2oO7fZZxCd15rIsxJC1AIULJvQVsRwrjcEVQg5rqIFMjQAoK+ UWWXOi1LA7zODSeo83e/MgFwHP5YNi9fewIfLT+TWbJSjZcslvnWrDx6iq/gGQXLa4IRsVQqBzW2 urmjwTSc2pHsJSwFgo0IKEQfZJmCyBmiofgX0xTsezt10nB/AIietfwDE+DRBnKAaCigQDocjuK9 i0Nh6nz1F85BnA5da/0QbwQlRgGQyA1EGypAnijTSPk2/OBC6zl7wFWLQdbM8Cs/hrAwyNTJnw5g LupGgV29Y3kiPlMcVK69L12TjYJ/wNQ8N8qlEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=j9oIlB2zpOVUvxG7czgZCBdrSOn/dyS3rp4c+8XX6xc=; b=S3gco9PHhIlBPzMqThZCLO3u6FUfJ9Mol7QbZf4RGRtjAuNkTfGX8urOMAqaCBpYza9D2bUp81Nt Zq9NFBAY/3C/kBSR0lWVh/3679bIv38CiiYqANCsRyFe0m7x1yYs7lnXjwoT9qXKnrj8SaqpkEs9 pQvOYhXPUAdI+YH82MPWadbfIIAMDF1f6JYM5ci7LVeDBTE+1GJx/eQKNK47qbSQPp2VcSdGaofL +BiVg5eyHDrXcsQqONqhTitPkEzS34vGhiV4z7qqvOSWbSfT7n0M6Idphb+jAshcaZpzqno90NQJ jwdZL9ZZYvm9Upj9VQWj8WTefQLnURN+3+MwlQ== Received: by omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD2002KJPHEOU30@omta-ad3-fd3-301-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:38 +0000 (GMT) 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=xi6bfdZ9kew/Ht/n6wJe844q1fNiFHAUuQwBybhvWV8=; b=SPlA9TQH81xoMoIY10n2YxKfFT FsYePoVkMqprqpv6ZpSb8LgcBJlPTx6ZiQnv9+DpcX1C8BhCoh731GzGv3vwXqOhVgpjWqAcZ9x5Q yXSG40C4z1zTwsHq25TqavEFM/aIkrZ74keXov/lJSFAeAlVFO92OjNCITHAZeey74UYtElj1IkQ9 igzOLTZbXbr/H/xrC6wuD1gd2dEhozUsRpbKST11t4x3padiQWXP0MH6RjFWVF6lx2GnIIN77FMNF eqfhiP3IbavqdfjHnrPmIl/jNgL2ME2jYU2bFfEUdA0P2115AUzGiBLzXrUZQ116ZbPHL/l6z5/G3 D9YuFHRg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:45 +0100 Message-id: <20220606204050.2625949-16-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 clxscore=159 malwarescore=0 priorityscore=164 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=675 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 15/20] balloon: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: 1zX6lc62PuACt5tnD3dktslE7eifBdt8 X-Proofpoint-ORIG-GUID: 1zX6lc62PuACt5tnD3dktslE7eifBdt8 Reporting-Meta: AAFCp4idPUo21eGRRaEq8/7nxXPHS7UPiqYODDrwqZV6YFcqpaepzGao1zDNO1gO ZW1ir5bQijuBylALth2jsMGuClFzxmrexoUodPt+TKgU/EFk1WH8aye5Do/DJAxm k9JP7qQppQZ1zbBUaBdJGZ2nvgxsbFWKn+rvRkGRyp/YJZkmwOKvWHq55jZ25c3w rSjdbCGFohma9my1wg04qficUv09gnKS6mn/XaO8bKBLCtXTE/tit5O/Y3MlUhkF nmRpjZkg2Nohp6sobCCzP42Sc5+a5w78Jkz/OuLouse1C7rFxgQmV27Db8oAko2U WNZ31CraeIMB07UTlIYB2Xlx0N5j6MbwYKkf3uxcwjEXrXRDviG11mn6diDmQOL/ kZkrOtbjFDGTAXe2IpGI3DClhSyc8/TbsMFav/ZuH7UvnQct5uzLDMLWExDKqE2A QB16JuGzolo8q+LkTH7bywzgwq4JVzgNCl4jK5EeoAKtLyEJF8AXU2hU8GtndtiQ 6nbK6GiFup8jaNwZFTWdBCQmn0MLh+b4R5hkmCIek9MM4Q== This is little more than changing the types over; there's no real work being done in this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/balloon_compaction.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index 4b8eab4b3f45..3f75b876ad76 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c @@ -230,11 +230,10 @@ static void balloon_page_putback(struct page *page) /* move_to_new_page() counterpart for a ballooned page */ -static int balloon_page_migrate(struct address_space *mapping, - struct page *newpage, struct page *page, - enum migrate_mode mode) +static int balloon_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { - struct balloon_dev_info *balloon = balloon_page_device(page); + struct balloon_dev_info *balloon = balloon_page_device(&src->page); /* * We can not easily support the no copy case here so ignore it as it @@ -244,14 +243,14 @@ static int balloon_page_migrate(struct address_space *mapping, if (mode == MIGRATE_SYNC_NO_COPY) return -EINVAL; - VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(!PageLocked(newpage), newpage); + VM_BUG_ON_FOLIO(!folio_test_locked(src), src); + VM_BUG_ON_FOLIO(!folio_test_locked(dst), dst); - return balloon->migratepage(balloon, newpage, page, mode); + return balloon->migratepage(balloon, &dst->page, &src->page, mode); } const struct address_space_operations balloon_aops = { - .migratepage = balloon_page_migrate, + .migrate_folio = balloon_migrate_folio, .isolate_page = balloon_page_isolate, .putback_page = balloon_page_putback, }; From patchwork Mon Jun 6 20:40:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870953 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 aib29ajc245.phx1.oracleemaildelivery.com (aib29ajc245.phx1.oracleemaildelivery.com [192.29.103.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2B6AC433EF for ; Mon, 6 Jun 2022 20:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=SzKxGzaHMyo5iaEhMZ9VmvqryT31JQPgBSwMdN5cpnc=; b=Z6DhXeWAPiMKXK9fjGlLmh175wr9j1C6D8Bcn0+VP7PMoeawaz+ug4LhT2cysXUBgFtvFpZiQSbk dWJiAdvM7RZ+3jaA+bUedZrPBLJrySn3h7DH3sTVpTD5kXwv28ZAC7eOLNRNhSpSAy5Tn+K+0Pp1 a5yrhZDypYkpN2khKNGnDCOIK75XtGQMJG2EHU1wG5VzrrCEdX9zHjoEZpo9l9tnuG6gfYgmYcM/ fEbZKrZjO9kUaTWPeZP6NlMsVIiJutSg0lhEEHYgTCemtgMOV3nQWbBiWyEwn2ciMoDQZS8ubJV+ frlGCoBHhQeE9cPjQaq89Zi7oIxN3WWgNXvKAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=SzKxGzaHMyo5iaEhMZ9VmvqryT31JQPgBSwMdN5cpnc=; b=IENT6nZMrdIqDEL5PQGTZqwK9PMgLoyLYaduipvI9xcBRtrKrdaXZiXUoeI1ea+WHkuXZLoU1XQx L5wf4aZix8h4pdcIbp7AYEYsNabeT2YMyZUju+jXxDSJ6VuFA9jEZd/913dBDRQw9ggX5xYhiJDD 37nSLCHC5xYjwPMNW9VtTKG0QTrfnKr4fQxp7eT1/KhK+DloMCd60FRhb+PdOuPyV6ZvUHwYBvol wFhUbES/jjK6CstdzUTp45JnOjmdqPLfbOCqoILAod+h3lTmKGtW/z3QA9CFjAfhughX93oBSBao BWdU3UlciJiuKOKlqpISu28ytgGjvFEVHrr4Sw== Received: by omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD20003LPHI9NF0@omta-ad1-fd1-102-us-phoenix-1.omtaad1.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:42 +0000 (GMT) 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=sw3xGMu8EIPPhanldW93F5IagC/JMQIeTrByOXSqams=; b=JRGvxIipv7m6v6BYy6Iv5o96an NjXbRwZx1kTpdL1gggi3uNnj2ZYHaGoDzYgFT9yWRY6RNrAPmjSRZuyOiiwaQM/1+M4AVwuYk+PBK EhpIMqcN0q2USPv0aKU3dVjpSas0DHRDV7v4Cj/0tVzmx9G3IVaaTh1VHsmINPnXLtdg0pn0oK/os mZ5HSWwosmZWEQkulkmXHnZdh3UXU16V/nVWQplhy19ME/Fyl4IioqID8E9V19f67diSrjjEsp+Bj J6Yy4FA8M6KmTvtuBy+S1CbohBt8Z1KKKPT8ganbhA1EGJjXoSXsZPQfL0++fMRIBpXima3JffJKS uzjNM9wQ==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:46 +0100 Message-id: <20220606204050.2625949-17-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=159 mlxlogscore=536 mlxscore=0 bulkscore=0 priorityscore=164 phishscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 16/20] secretmem: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: fFXg4b7ZzURE9_pNWpjcXyFDpc2MhKbb X-Proofpoint-ORIG-GUID: fFXg4b7ZzURE9_pNWpjcXyFDpc2MhKbb Reporting-Meta: AAFoIncgYQltppzQvoGu4W81sOqKD8aOPaGyY4BItN7kLBkcXxiy48u7XqACaa3m KUy5WRXJQBTijgfud2BJlbgKlLALLOqAjoAEl2HVNLEzo2lp52pLHm5GXuagXCdd wQ5aOC14VQ6qVm+oPpv4g3JZJVDZXxpvq1t1EgVJEFW8UZ10R4EZ6QzANy65uaQj K7CCKOq9za3ILseTYVFtMYOl7k/uA6svmKnbB41kXimFg0A0eKc89R+Zmn0WI9wL a9uqAWf9M33RKuSXX1aS8VX+D3AKpIgHgTijatAgKiUybEN2FF0L2FZgXHB5gGx6 XvsFv1JUx9Yca9mJOL7TXIaVn7D2jzhB5QpM5njWs0yAzdhgLzlebUrsHWoqLXLu CUgw7Ni6QgHoyU+bQY+n0NlPTWVd87AFzMUTz1vjdvp/Y8W8DD9il6EQra9Yo7ZW kwvNLQwMQEaERryl9uVW42NJR+x/JHua3epf6Wcw/sn6VJYriRvEADOWF2Ycwb11 wJ1pr8j/EIhw2RiRdrgiAiXjwcuTnCMylYzgFuq3nydB This is little more than changing the types over; there's no real work being done in this function. Signed-off-by: Matthew Wilcox (Oracle) --- mm/secretmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 206ed6b40c1d..9c7f6e3bf3e1 100644 --- a/mm/secretmem.c +++ b/mm/secretmem.c @@ -138,8 +138,8 @@ static bool secretmem_isolate_page(struct page *page, isolate_mode_t mode) return false; } -static int secretmem_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page, +static int secretmem_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { return -EBUSY; @@ -154,7 +154,7 @@ static void secretmem_free_folio(struct folio *folio) const struct address_space_operations secretmem_aops = { .dirty_folio = noop_dirty_folio, .free_folio = secretmem_free_folio, - .migratepage = secretmem_migratepage, + .migrate_folio = secretmem_migrate_folio, .isolate_page = secretmem_isolate_page, }; From patchwork Mon Jun 6 20:40:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870939 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 aib29ajc255.phx1.oracleemaildelivery.com (aib29ajc255.phx1.oracleemaildelivery.com [192.29.103.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C8A0CCA486 for ; Mon, 6 Jun 2022 20:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=o5nLBirGmYOJb2lrxEGaJvMPJTV0xcLQYA32yNnDwkk=; b=JNg1evALYqkYyhjVqmiFAsMAFMGQUyHcwZHf5NE4D5da4jo9Uyg2PziB/OVqfD58S894gMU+xWrd XcoOGUBKqR03qu8o1nHjWUDGFHjL24cpc2n8Qyn65encC0DQxDl007NneUgW2hx1VfXvClb2F+8L ONuAafC6ohmw57eVs4TzJr0iv2ddYcRO8o/Sam1aU6ikLaZoVA3IOzYjN9ocUtoN8SAH6QVIE9Mk XSbQUQV704OjjAfSc8MwQMUq74VGbJWe7wbY9KD75HvXyhlVRyqMw1bQSUzfqUEID2AVJZa0azT+ sStOwZNGLkTINMPy5/CaBU4EVw5rXNgyON/k/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=o5nLBirGmYOJb2lrxEGaJvMPJTV0xcLQYA32yNnDwkk=; b=Zq2YiKw8O60XFmx2iTtccre0bKaMThWKdMIxIlAvFIIzjS87XfqgH7cF+HSVJyqVz0DhtW2FUTs7 B5JMq60IgGv04lo6++n5sEEeQrna8ISfjj3o3yXHZW8idlKLkhLjyStqv7ZxndeHnBrtt220dmEV JIdaodhU81IkWuaPagm/F44C5i5Y9jRfq2P1e9BxsFna1lzY5Ik24DUXOIv1y1nQPuzY4hXJE9a+ 92xJKZ5o9OXFacNtx47IHJaM33lH2fPTZQymsSY2zLU0fg2p9Pex1uByy3/zhvhRJQ91bqxIXdyU znVuJctajA9ywiEVm+PQPv1Su2yGzEdRddmyEA== Received: by omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CJ0PGVLS30@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:19 +0000 (GMT) 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=Nbr9wUy4GZu/A9I5fNiEUH8YjHUTRzvYZO3QnrtHfqs=; b=Gd3hSiL+/E0dfHLBarUzOacZ5+ RgLt/HR3/LRhEZeLymFVkZyeDV4o45ibioJi0eraHf6ehCGQbtosb1TjID04N286tCzWwDmpddr27 H3ByN9G6hK5riWHYLqRkTy3GsEZUgLnYhezqas1+XNq5pmGlpRnM2NevyEDgUXJ8ZYsVlaLiCT3RO 8Ehpw8He8k5yQNPfIvPT9F5a/3yz8jOKKKyGe7pM1yVoqkDKz2YPmFcUn0VPuUW3SPY9tPOvKaZJU 1Vf1NH8uVC9GEQzwQCTJYo35GSSSaLqMV3XH1X1fzAEkojyoaH3wkOkh+Z2rcUydL6L7kLEvUr3mZ LKB+9tpQ==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:47 +0100 Message-id: <20220606204050.2625949-18-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxlogscore=656 mlxscore=0 spamscore=0 suspectscore=0 priorityscore=108 phishscore=0 clxscore=163 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 17/20] z3fold: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: akP4faCjPKCNeCZ4DQQs3K7vssJ9Eqx9 X-Proofpoint-GUID: akP4faCjPKCNeCZ4DQQs3K7vssJ9Eqx9 Reporting-Meta: AAHQEyQGSzSJQNGu8bPCUMoAs4dNlMrHzztuJWhktkafkkoBvrE1ujnh/k4YV8eR 7ywSA1cPhApfMmn2clb34DSVj51jM5oSm2Kbh4GnFAqoqOVpcn5229uedWlp1/eC o85QGlKeysem8xfbMT7ysnj36O3qdaWxyIre1tPbc6HF4wj8XH/WAUyAVLKoF9YH /i59xIXO3W6myJ6SiNb2arPs2nOP2X5aPKlWkErpwwNxeS0qBwR7HRYj4yMBxH1v 8i4mEsg5JqUWDFvnfyicrnQ4/RqLihEu2Nl2wMr7yuNDWa5YqfAyNgwSwu/rHOZf nWV6bPa/wCvoyAuv0ZrAD4lcufWKeESNeLuuvEHrn1GENVpXoH5UzUx1PBZ3BPG9 7JHHlMh3iX4tQ2u7y8xMVurE3u+0ayVF2hgSe5K1JGBc4956yt0A3Kjj/mBBO7GI HbtN/G5hLAZcfY/qMGtn+l/XmytiqMhNFw61jhLXjXIuXNyJ5HphygGouzE9g0za 21nwOp7y2YjwdDbF14pWzQpGCV7k3/vrkzecpRrN0jN2 z3fold doesn't really use folios, but it needs to be called like this in order to migrate an individual page. Convert from a folio back to a page until we decide how to handle migration better for z3fold. Signed-off-by: Matthew Wilcox (Oracle) --- mm/z3fold.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index f41f8b0d9e9a..5d091c41fb35 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1554,9 +1554,11 @@ static bool z3fold_page_isolate(struct page *page, isolate_mode_t mode) return false; } -static int z3fold_page_migrate(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode) +static int z3fold_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { + struct page *newpage = &dst->page; + struct page *page = &src->page; struct z3fold_header *zhdr, *new_zhdr; struct z3fold_pool *pool; struct address_space *new_mapping; @@ -1644,7 +1646,7 @@ static void z3fold_page_putback(struct page *page) static const struct address_space_operations z3fold_aops = { .isolate_page = z3fold_page_isolate, - .migratepage = z3fold_page_migrate, + .migrate_folio = z3fold_migrate_folio, .putback_page = z3fold_page_putback, }; From patchwork Mon Jun 6 20:40:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870941 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 aib29ajc251.phx1.oracleemaildelivery.com (aib29ajc251.phx1.oracleemaildelivery.com [192.29.103.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F810CCA48E for ; Mon, 6 Jun 2022 20:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=biioD3r8xoOjpaGul/VIbmJ4EUj5EXXIVmipjMZu/cs=; b=iRAhIVrRDb0snUcm/UFmhErNIE5azD1DFsTkVLBumS4iBQ/nEom42QKBZVTFtAzctfLW9MNmVCJ3 EyC0vxXF3gjpxDSuupDtWNwLvtgtgi+vc48GblN5HHfOgav7TcYTLLWtVor1wyyaID/jrjSqWkJn FsecsDqmPGWKr35nZzYqVpRgyY02jy6fc66RC1A045kVYiEVvvyVesgasFc3h45USgcyGz9+FEjt 0Fq/8kYRFaQGftAa+Nq8nBYQN7rYrHHDAqvljHtHuRG4evomQqhZ2Qzl3XQReIp75PeSdNMBxYDO P9J6LRg4xyh6R+BDxFo1o07oGmQZ3RoeCsBLjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=biioD3r8xoOjpaGul/VIbmJ4EUj5EXXIVmipjMZu/cs=; b=cZJwVK9n3pHjpy9+jrU0FGHUxF1XDLPZjlrpaYgxVRS159cn2ORvyQwmAeBm2FH4SwaUUhdyCi6f 6Ts8Y5pxT+ZfYmXr2zhlcn81Kn+y6Byi84/U4gAA3xwjso3Mf0qpsd0MGqWuoPhkTTRfNFfHty0B HVk2xqOcczieZ0+PT4yQ4lsCaqKMWEN85PZKBR2AKvP66z53puZ5xtwHAIV+NcjaE7yyLej3LZc7 T8a0w0wOPzzpOVXOtZ0XRaEeaLIwuMVkzHZkuOxGMFRBoj1neJH6rpycXPx+IYEzzsaESUqFsNOi q53bd1tead1TgkCZEvgd+AmmTIHNLQOEZUZ/GQ== Received: by omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200M91PGW5EE0@omta-ad2-fd3-202-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:20 +0000 (GMT) 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=NFScYX57GEbw0yH/d1QXpe8YFpfaQsvuaQCT3ii6ess=; b=mDp4J3wn+JfgTBMvZgEUqjDjOc MdvHmectsbLkZvfTk8nG6ytXS1+4dBHiC4pMAhcy3dH+w+BngrUwTH364Opf+ULDH9RffR6xS8W1s NvNCsPvgWsTpdK5si++BB7gskVwFgeJKaRz9oSkBMT/tvUH1htLz8dXlAm4tajf1oQVpZT/iQpp3Z 3qvjBqAGoN/HgsaNXSczCYJXunICX2cMGKbV8nqWYAZ1dFtuqgFYtfMpTC7xMxk50hUBGd3mZWqxV 6hlTudv8DYvIDVhKEtAVCLpJUOSZgQOHlnJd6eZoWquUE4SD1aKFk5s64qg6Qy5XVFt9b2QyPeQP8 VdadEfOg==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:48 +0100 Message-id: <20220606204050.2625949-19-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=159 mlxscore=0 lowpriorityscore=0 priorityscore=164 phishscore=0 suspectscore=0 impostorscore=0 mlxlogscore=668 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 18/20] zsmalloc: Convert to migrate_folio X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: 7-lD1oDmqA0xZLeE94WLbZNh8Lxi5cIb X-Proofpoint-ORIG-GUID: 7-lD1oDmqA0xZLeE94WLbZNh8Lxi5cIb Reporting-Meta: AAF+vZBWuqLKC6usvZHinyb0SmD4DKO0jDi7uG/wvmazqRqZXze/vVflvuW+2aQ5 h5WPpgSaHOzsalLcvu/5B+tsgjdKmVxIhES5+7356aURXIBb99urw8MvDjmlvUCC lANQzEX6d/JmXz6ULL8OIzWhJpJuSL3925klBskWBOYK7DM3hhEAZWp709Mqd8L3 tZfJZM22tLth5gLR9Cy4qALeFJjkKXFynqnaQi+Qla7L5dr9W0gBsLOIHVgzwg4M cYz0ZncfXPuj6qGtCzWh7UFthmuIeRN1rcHDbxZHpS9WMbAgNk6V/p5LgfTFg80S xzyGZ7SFM+RwbGrtbT+vaN6xIcK7aB9aQeLydQiaNGkRuE0lhYcuY/Tgt1l7tZH0 CfcvqIgn36D4S+R6qfdqrubzgB+2AAJZvRrwB3rCoWnckxicUMMNpqjDuKNr1/Qh xaEHWcJASm/6OcG1PxvBUr34Ddeu6aFQYBZvOMiWdFwY/ZLMQRDx1MOhWfg1oeSm acR9Yfmtv9xtsS72bZnrmWC1Xet354T5oOMxAuBWLv/j zsmalloc doesn't really use folios, but it needs to be called like this in order to migrate an individual page. Convert from a folio back to a page until we decide how to handle migration better for zsmalloc. Signed-off-by: Matthew Wilcox (Oracle) --- mm/zsmalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 5d5fc04385b8..8ed79121195a 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1865,9 +1865,11 @@ static bool zs_page_isolate(struct page *page, isolate_mode_t mode) return true; } -static int zs_page_migrate(struct address_space *mapping, struct page *newpage, - struct page *page, enum migrate_mode mode) +static int zs_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, enum migrate_mode mode) { + struct page *newpage = &dst->page; + struct page *page = &src->page; struct zs_pool *pool; struct size_class *class; struct zspage *zspage; @@ -1966,7 +1968,7 @@ static void zs_page_putback(struct page *page) static const struct address_space_operations zsmalloc_aops = { .isolate_page = zs_page_isolate, - .migratepage = zs_page_migrate, + .migrate_folio = zs_migrate_folio, .putback_page = zs_page_putback, }; From patchwork Mon Jun 6 20:40:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870938 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 aib29ajc250.phx1.oracleemaildelivery.com (aib29ajc250.phx1.oracleemaildelivery.com [192.29.103.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 146B1CCA47F for ; Mon, 6 Jun 2022 20:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=xVM7UO5fDs0HX8yTI+kIO0QlrweIp4ctSVjaQallcPg=; b=vU/tOMeLB8VGxOvxiLlfohvBTS/Rh4GGXtHRbcQbBQzt0nXyL/pLKV7ceg8dNHPmYfubOI9FXNKJ xP4evdsL9aAKMzVHtu1DbjfBwbAJRNF7O9D/4pzFMKHRkbjNXX2ImgV3tgQtMJv+GGwj/y27U3eh JTDAHEnupP+aikUEI0ChTRzeGxf9EvWSgCcGPITqMxxajh/roHNrm5xDyC5uHpyZX8pYObJfS/FQ iKSm/WygbqneXcUQGyOPOHlqsRlfubI4tlzQc81oDJrZTlNnpsdFa4PnmfR+36bQ8/gITnfyBMx0 oU8aXwjyQ4/AGLMutTwdXiF2LpuqAG8XPLJNcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=xVM7UO5fDs0HX8yTI+kIO0QlrweIp4ctSVjaQallcPg=; b=TrLJd0/0fyOmMvR5wHpKejrzQ4SngYTAQXZ9S9nV1gatizZUB+2Z54jp2fwrRlBkxGHlhZaWCNc4 T7qYGIxxuaG4R5+o0rwQDm85rTHH6qWTx5iujOV8Yu6sGSgNGeD5GJQ5YKhYPk1KQUD2AzmTjNlG lQIBnGwNB+Sui4aZv4q/Smi3HPhutxvHZt/btz4rp2+ioEkhOf51P+Nv2laqzyKEqvE5hXxVNQgd WioKzkBkEv1OsSPL/95ubEQka+glajH9c3s48ZxZibwD1Y4RFYx+GcPHhzdb7gNMbxZUKAq6hbS+ bgxJs9RrQKTbccEzFnVyw5q75cKf8oZhrqH1hQ== Received: by omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CT2PGVG830@omta-ad2-fd3-201-us-phoenix-1.omtaad2.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:19 +0000 (GMT) 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=jShwzeL+5O6p6+KB8AXJd8QTjTM3rLlLO0YNnyhkzoU=; b=j8WB6rbesWftHu8QIJhuNjLLRv 8UGF1DKSTdZLPDZ0Kov24duPgp8KMpi6m8VEsqm5e1sZdIO0hAb54JNjAbS00XQgXdsCx8+PvicwO rYdGhK7Gy6I6AX03/exLoIxL+gMZQDduaqInpnkGl13x/6LHcmOMXo+u8SO/crNY4L5fIgFOEe3TY clMZRMy11m0K44+Yi9a6EjLXZgw7NLEoTTdV/oEJbaeKVMorPM13Ba1mk7M/T/X6/bkJL+qWpRRnS 1wANzqWwYhqp/CK739JNy4OmGeFkTAhy3sEt9IXLj+oIA+NjHnNm9hNBqc/doCVMUizMtdR2GOaOc gaaqEAJA==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:49 +0100 Message-id: <20220606204050.2625949-20-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 impostorscore=0 clxscore=165 malwarescore=0 priorityscore=108 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=259 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 19/20] fs: Remove aops->migratepage() X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-ORIG-GUID: rAbmb_lw_pHy4fLOVKao6BO_Jv3bR7Jz X-Proofpoint-GUID: rAbmb_lw_pHy4fLOVKao6BO_Jv3bR7Jz Reporting-Meta: AAF+vZBWuqLKC6usvZHinyb0SmD4DKO0jDi7uG/wvmazqRqZXze/vVflvuW+2aQ5 h5WPpgSaHOzsalLcvu/uB+tsgjdKmVxIhETsUtUjyTFE4cJXxgTho9LMSLx1+s8R HMrm5C1+Fo1TyJ3lQjv7kbB+Jq5x+Jspfs5GGnc1UXLJ5EFQhTImfWEgS6j6ynlH nhhL6S6wzcffgfB162XnLV1ITxYnJ6ZKBOVivJ8tujnA5r0mZtnOdux0MetqdxnH co4AP61hYbmGqz6/Vv5zYzm8GucXbyRcDV3meG55VOYDC9Nvg5rA1bPwae2PO/zQ h2i+60Dnmj6+mYSzRTpc2+h/jKZkzSAGTYOYbplPUJ/YSv3kME2kRk/1DMNec7bN /6ParZxckGQk92LcXmNEyDrgkQ2tafeN4h2A+lVSEnK/2LIrRs7k6veVRf1C5TaD qomNzirLUHaA3Zh3t3LD8F+rFUx/Sj6Ks1zVclIEuMFyZ9iU7dV4+r6TxQzDYX9f XoL2NPrA5/IM1Kmb1kJ/+ZzLE1LZrxu25FlTGZjwbsat With all users converted to migrate_folio(), remove this operation. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/fs.h | 2 -- mm/compaction.c | 5 ++--- mm/migrate.c | 10 +--------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 5737c92ed286..95347cc035ae 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -367,8 +367,6 @@ struct address_space_operations { */ int (*migrate_folio)(struct address_space *, struct folio *dst, struct folio *src, enum migrate_mode); - int (*migratepage) (struct address_space *, - struct page *, struct page *, enum migrate_mode); bool (*isolate_page)(struct page *, isolate_mode_t); void (*putback_page)(struct page *); int (*launder_folio)(struct folio *); diff --git a/mm/compaction.c b/mm/compaction.c index db34b459e5d9..f0dc62159c0e 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1034,7 +1034,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, /* * Only pages without mappings or that have a - * ->migratepage callback are possible to migrate + * ->migrate_folio callback are possible to migrate * without blocking. However, we can be racing with * truncation so it's necessary to lock the page * to stabilise the mapping as truncation holds @@ -1046,8 +1046,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, mapping = page_mapping(page); migrate_dirty = !mapping || - mapping->a_ops->migrate_folio || - mapping->a_ops->migratepage; + mapping->a_ops->migrate_folio; unlock_page(page); if (!migrate_dirty) goto isolate_fail_put; diff --git a/mm/migrate.c b/mm/migrate.c index a8edd226c72d..c5560430dce4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -911,9 +911,6 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, */ rc = mapping->a_ops->migrate_folio(mapping, dst, src, mode); - else if (mapping->a_ops->migratepage) - rc = mapping->a_ops->migratepage(mapping, &dst->page, - &src->page, mode); else rc = fallback_migrate_folio(mapping, dst, src, mode); } else { @@ -928,12 +925,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, goto out; } - if (mapping->a_ops->migrate_folio) - rc = mapping->a_ops->migrate_folio(mapping, dst, src, - mode); - else - rc = mapping->a_ops->migratepage(mapping, &dst->page, - &src->page, mode); + rc = mapping->a_ops->migrate_folio(mapping, dst, src, mode); WARN_ON_ONCE(rc == MIGRATEPAGE_SUCCESS && !folio_test_isolated(src)); } From patchwork Mon Jun 6 20:40:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12870951 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 aib29ajc255.phx1.oracleemaildelivery.com (aib29ajc255.phx1.oracleemaildelivery.com [192.29.103.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E752BCCA489 for ; Mon, 6 Jun 2022 20:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=oss-phx-1109; d=oss.oracle.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=V+9CehEAPPuI3fNIUY2ajjDOqqoujhvpYab3d8y00Lw=; b=2kTIN65DkNByLxb8Sd8SWW3jGJlyGjvE3Daednvt7NKsv9CP/mw7AN7jbneJ6Nyfw/OzkpQ+IdEZ zDXzaQUZzExjVdV5GDZJvDXfRipxWKwJ3lPvLfq/QEOEXIGuhfozLCDF+lVWqVBP9j4tDQciG+x4 92SAokLnqrfJkRL0vRpZjqOXOGLqc526u0E/1UGwuwiPZQpWvujcb5am46piQnxSfI16drgFZ9Eg y2jfxaLspzHPLq+e/guwdfg1osKb7q2es/Pi+FKOtzzhFm9TSp6WMtDB8Jlti2VbWlszQP99GCkW 7yLPTb01w6wQcVYTGjYXdJyAo0JeZmFMvfcWwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-phx-20191217; d=phx1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=V+9CehEAPPuI3fNIUY2ajjDOqqoujhvpYab3d8y00Lw=; b=kK/HTbD00hD5muIhMO2PaRqIxEauUFb4B8CBh2CRxEMS0oJ8rKcFUsYz5fp2EkN7OlQ3chod2HBE 6d7fYKmR5ap7xWVr9xNkPd75NTK3hnkVXW4XrMyaFlBJahfW7DRhQA9f12z5WHG3wchKPugzsUjP IlW1Flc34KDvV8z6Xk+VGXb50fHJl/kFI/CAx7rjkGo94AEGii8GSibITdIg/kM1CpN8RCrUBTTx 7zPEfcaVdNEwGxzN1YVOFkqxhTxPl6bHQv4swMQI4oF8XdMz61GtxMlOe5UWu5IURD7be/InmJ1x AqrSUE6fqwVs6yS4IXK5tFjWLQSnBrFyVXOyuQ== Received: by omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20220517 64bit (built May 17 2022)) with ESMTPS id <0RD200CP6PHBLS30@omta-ad3-fd3-302-us-phoenix-1.omtaad3.vcndpphx.oraclevcn.com> for ocfs2-devel@archiver.kernel.org; Mon, 06 Jun 2022 20:41:35 +0000 (GMT) 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=quK8OUavZ3OQPvhjOxFusobdtZi/WBT8qXGvQ++yDug=; b=tGIvKVNaAMu+xJKfT56my7OcDx h9X6EZkV+3b6YmzNyoYE3J6PNxC8ld3BfaS12Hr37OHw34qvlxQU6NGjNQ/dhsoPlowRv53o4VZC8 91hwnrb/Zx7IV1o0tPxKat0n3HHdibhLf1anGJsS6EN4ly8FblGaD7fyrz5/ADem0hQXlXK2IoJvA sPpCKXuC4FxWa83HkItcygw65l/Lm7ADmBY+uIWsBaElOylJp/RskeiJHQuGZ0eifLCpWGHHcEWMR 60Qcs3Ka1CFA2jYOxR4TNlZ/5Tzf5uG0HfDIKzfTaxNpzixl4yt2Na7VkKuOo78WUgHz+NeXqWgXa nGtfT5aA==; To: linux-fsdevel@vger.kernel.org Date: Mon, 6 Jun 2022 21:40:50 +0100 Message-id: <20220606204050.2625949-21-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-reply-to: <20220606204050.2625949-1-willy@infradead.org> References: <20220606204050.2625949-1-willy@infradead.org> MIME-version: 1.0 X-Source-IP: 90.155.50.34 X-Proofpoint-Virus-Version: vendor=nai engine=6400 definitions=10370 signatures=594849 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=165 mlxlogscore=479 mlxscore=0 bulkscore=0 priorityscore=108 phishscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206060082 domainage_hfrom=8378 Cc: linux-aio@kvack.org, linux-nfs@vger.kernel.org, cluster-devel@redhat.com, linux-ntfs-dev@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [Ocfs2-devel] [PATCH 20/20] mm/folio-compat: Remove migration compatibility functions X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Matthew Wilcox \(Oracle\) via Ocfs2-devel" Reply-to: "Matthew Wilcox \(Oracle\)" Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7bit Errors-to: ocfs2-devel-bounces@oss.oracle.com X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Spam: Clean X-Proofpoint-GUID: plaom_dgnwYDorRDDhFeZFJzj9Gxok7B X-Proofpoint-ORIG-GUID: plaom_dgnwYDorRDDhFeZFJzj9Gxok7B Reporting-Meta: AAF+vZBWuqLKC6usvZHinyb0SmD4DKO0jDi7uG/wvmazqRqZXze/vVflvuW+2aQ5 h5WPpgSaHOzsalLcvu9gCOtsgjdKmVxIhET3yaxlxFLF3/iHivjZdA6H9NA0fD7Y EY0uwtgvb4osqwc48Zp3ct+kchHNGcb/rrRJo2U6dHBpYkQ2D06MVFQjk2iHgQSp FZi6//ZHVihmAHl7nMdviYTMMHZ36f2XJU9EqpaaKtvxui/xlZgaxzhilyzLCvAl IezB+/yGFavMdLfBLj2D6FhhvE8Rc2kucrvfWK3n/09FUR88eQ5JmhUsl3ef1x35 TOo6INhmJsAn5WtTwOhwHuaCdWTNj0tVvQlaPkh17VrzRpaICRnl78XRQoDov2/J kQgMoFSmLzr0avjpxmtuNc5LSENaXkRyvvZvtXDdGscErm+BFjbZ3nTdNDjccn3h aAiyc/l3oMk1Y87F2I8X9UAC+NqTRTTxanpAUNbTB2SrRGzX1uMZaogbcf8Ckscj AliA11ys4hKVG0bg7/xfZMtPL1kXtypCtFFzVGrq6dJGwQ== migrate_page_move_mapping(), migrate_page_copy() and migrate_page_states() are all now unused after converting all the filesystems from aops->migratepage() to aops->migrate_folio(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/migrate.h | 11 ----------- mm/folio-compat.c | 22 ---------------------- mm/ksm.c | 2 +- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 088749471485..4670f3aec232 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -33,12 +33,8 @@ extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free, extern struct page *alloc_migration_target(struct page *page, unsigned long private); extern int isolate_movable_page(struct page *page, isolate_mode_t mode); -extern void migrate_page_states(struct page *newpage, struct page *page); -extern void migrate_page_copy(struct page *newpage, struct page *page); int migrate_huge_page_move_mapping(struct address_space *mapping, struct folio *dst, struct folio *src); -extern int migrate_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page, int extra_count); void migration_entry_wait_on_locked(swp_entry_t entry, pte_t *ptep, spinlock_t *ptl); void folio_migrate_flags(struct folio *newfolio, struct folio *folio); @@ -59,13 +55,6 @@ static inline struct page *alloc_migration_target(struct page *page, static inline int isolate_movable_page(struct page *page, isolate_mode_t mode) { return -EBUSY; } -static inline void migrate_page_states(struct page *newpage, struct page *page) -{ -} - -static inline void migrate_page_copy(struct page *newpage, - struct page *page) {} - static inline int migrate_huge_page_move_mapping(struct address_space *mapping, struct folio *dst, struct folio *src) { diff --git a/mm/folio-compat.c b/mm/folio-compat.c index 20bc15b57d93..458618c7302c 100644 --- a/mm/folio-compat.c +++ b/mm/folio-compat.c @@ -51,28 +51,6 @@ void mark_page_accessed(struct page *page) } EXPORT_SYMBOL(mark_page_accessed); -#ifdef CONFIG_MIGRATION -int migrate_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page, int extra_count) -{ - return folio_migrate_mapping(mapping, page_folio(newpage), - page_folio(page), extra_count); -} -EXPORT_SYMBOL(migrate_page_move_mapping); - -void migrate_page_states(struct page *newpage, struct page *page) -{ - folio_migrate_flags(page_folio(newpage), page_folio(page)); -} -EXPORT_SYMBOL(migrate_page_states); - -void migrate_page_copy(struct page *newpage, struct page *page) -{ - folio_migrate_copy(page_folio(newpage), page_folio(page)); -} -EXPORT_SYMBOL(migrate_page_copy); -#endif - bool set_page_writeback(struct page *page) { return folio_start_writeback(page_folio(page)); diff --git a/mm/ksm.c b/mm/ksm.c index 54f78c9eecae..e8f8c1a2bb39 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -712,7 +712,7 @@ static struct page *get_ksm_page(struct stable_node *stable_node, * however, it might mean that the page is under page_ref_freeze(). * The __remove_mapping() case is easy, again the node is now stale; * the same is in reuse_ksm_page() case; but if page is swapcache - * in migrate_page_move_mapping(), it might still be our page, + * in folio_migrate_mapping(), it might still be our page, * in which case it's essential to keep the node. */ while (!get_page_unless_zero(page)) {