Skip to content

Commit c94b734

Browse files
Matthew Wilcox (Oracle)kdave
Matthew Wilcox (Oracle)
authored andcommitted
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) <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8fde439 commit c94b734

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

fs/btrfs/disk-io.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,8 +3833,7 @@ static int write_dev_supers(struct btrfs_device *device,
38333833
* Wait for write completion of superblocks done by write_dev_supers,
38343834
* @max_mirrors same for write and wait phases.
38353835
*
3836-
* Return number of errors when page is not found or not marked up to
3837-
* date.
3836+
* Return number of errors when folio is not found or not marked up to date.
38383837
*/
38393838
static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
38403839
{
@@ -3848,7 +3847,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
38483847
max_mirrors = BTRFS_SUPER_MIRROR_MAX;
38493848

38503849
for (i = 0; i < max_mirrors; i++) {
3851-
struct page *page;
3850+
struct folio *folio;
38523851

38533852
ret = btrfs_sb_log_location(device, i, READ, &bytenr);
38543853
if (ret == -ENOENT) {
@@ -3863,27 +3862,29 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
38633862
device->commit_total_bytes)
38643863
break;
38653864

3866-
page = find_get_page(device->bdev->bd_inode->i_mapping,
3867-
bytenr >> PAGE_SHIFT);
3868-
if (!page) {
3865+
folio = filemap_get_folio(device->bdev->bd_inode->i_mapping,
3866+
bytenr >> PAGE_SHIFT);
3867+
if (IS_ERR(folio)) {
38693868
errors++;
38703869
if (i == 0)
38713870
primary_failed = true;
38723871
continue;
38733872
}
3874-
/* Page is submitted locked and unlocked once the IO completes */
3875-
wait_on_page_locked(page);
3876-
if (PageError(page)) {
3873+
ASSERT(folio_order(folio) == 0);
3874+
3875+
/* Folio will be unlocked once the write completes. */
3876+
folio_wait_locked(folio);
3877+
if (folio_test_error(folio)) {
38773878
errors++;
38783879
if (i == 0)
38793880
primary_failed = true;
38803881
}
38813882

38823883
/* Drop our reference */
3883-
put_page(page);
3884+
folio_put(folio);
38843885

38853886
/* Drop the reference from the writing run */
3886-
put_page(page);
3887+
folio_put(folio);
38873888
}
38883889

38893890
/* log error, force error return */

0 commit comments

Comments
 (0)