Commit c94b7349 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by David Sterba

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: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8fde439b
...@@ -3833,8 +3833,7 @@ static int write_dev_supers(struct btrfs_device *device, ...@@ -3833,8 +3833,7 @@ static int write_dev_supers(struct btrfs_device *device,
* Wait for write completion of superblocks done by write_dev_supers, * Wait for write completion of superblocks done by write_dev_supers,
* @max_mirrors same for write and wait phases. * @max_mirrors same for write and wait phases.
* *
* Return number of errors when page is not found or not marked up to * Return number of errors when folio is not found or not marked up to date.
* date.
*/ */
static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) 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) ...@@ -3848,7 +3847,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
max_mirrors = BTRFS_SUPER_MIRROR_MAX; max_mirrors = BTRFS_SUPER_MIRROR_MAX;
for (i = 0; i < max_mirrors; i++) { for (i = 0; i < max_mirrors; i++) {
struct page *page; struct folio *folio;
ret = btrfs_sb_log_location(device, i, READ, &bytenr); ret = btrfs_sb_log_location(device, i, READ, &bytenr);
if (ret == -ENOENT) { if (ret == -ENOENT) {
...@@ -3863,27 +3862,29 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) ...@@ -3863,27 +3862,29 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
device->commit_total_bytes) device->commit_total_bytes)
break; break;
page = find_get_page(device->bdev->bd_inode->i_mapping, folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
bytenr >> PAGE_SHIFT); bytenr >> PAGE_SHIFT);
if (!page) { if (IS_ERR(folio)) {
errors++; errors++;
if (i == 0) if (i == 0)
primary_failed = true; primary_failed = true;
continue; continue;
} }
/* Page is submitted locked and unlocked once the IO completes */ ASSERT(folio_order(folio) == 0);
wait_on_page_locked(page);
if (PageError(page)) { /* Folio will be unlocked once the write completes. */
folio_wait_locked(folio);
if (folio_test_error(folio)) {
errors++; errors++;
if (i == 0) if (i == 0)
primary_failed = true; primary_failed = true;
} }
/* Drop our reference */ /* Drop our reference */
put_page(page); folio_put(folio);
/* Drop the reference from the writing run */ /* Drop the reference from the writing run */
put_page(page); folio_put(folio);
} }
/* log error, force error return */ /* log error, force error return */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment