summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-04-20 05:49:56 +0300
committerDavid Sterba <dsterba@suse.com>2024-05-07 22:31:10 +0300
commitc94b7349b8592d2787284d470c10a17583c9d205 (patch)
treeb3a6b22365ef088cc126ab93b72731c93f2de383 /fs
parent8fde439b2d77356a2e0ace70cd8e24a4a5ded352 (diff)
downloadlinux-c94b7349b8592d2787284d470c10a17583c9d205.tar.xz
btrfs: convert super block writes to folio in wait_dev_supers()
This is a direct conversion from pages to folios, assuming single page folio. Also removes a few calls to compound_head() and calls to obsolete APIs. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e0bdf3ed2449..5e2293c5b747 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3833,8 +3833,7 @@ static int write_dev_supers(struct btrfs_device *device,
* Wait for write completion of superblocks done by write_dev_supers,
* @max_mirrors same for write and wait phases.
*
- * Return number of errors when page is not found or not marked up to
- * date.
+ * Return number of errors when folio is not found or not marked up to date.
*/
static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
{
@@ -3848,7 +3847,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
max_mirrors = BTRFS_SUPER_MIRROR_MAX;
for (i = 0; i < max_mirrors; i++) {
- struct page *page;
+ struct folio *folio;
ret = btrfs_sb_log_location(device, i, READ, &bytenr);
if (ret == -ENOENT) {
@@ -3863,27 +3862,29 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
device->commit_total_bytes)
break;
- page = find_get_page(device->bdev->bd_inode->i_mapping,
- bytenr >> PAGE_SHIFT);
- if (!page) {
+ folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
+ bytenr >> PAGE_SHIFT);
+ if (IS_ERR(folio)) {
errors++;
if (i == 0)
primary_failed = true;
continue;
}
- /* Page is submitted locked and unlocked once the IO completes */
- wait_on_page_locked(page);
- if (PageError(page)) {
+ ASSERT(folio_order(folio) == 0);
+
+ /* Folio will be unlocked once the write completes. */
+ folio_wait_locked(folio);
+ if (folio_test_error(folio)) {
errors++;
if (i == 0)
primary_failed = true;
}
/* Drop our reference */
- put_page(page);
+ folio_put(folio);
/* Drop the reference from the writing run */
- put_page(page);
+ folio_put(folio);
}
/* log error, force error return */