Skip to content

Commit 9d7db41

Browse files
adam900710kdave
authored andcommitted
btrfs: move the mapping_set_error() out of the loop in end_bbio_data_write()
Previously we have to call mapping_set_error() inside the for_each_folio_all() loop, because we do not have a better way to grab an inode, other than through folio->mapping. But nowadays every btrfs_bio has its inode member populated, thus we can easily grab the inode and its i_mapping easily, without the help from a folio. Now we can move that mapping_set_error() out of the loop, and use bbio->inode to grab the i_mapping. Reviewed-by: David Sterba <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 99fe7e5 commit 9d7db41

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/btrfs/extent_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,14 @@ static void end_bbio_data_write(struct btrfs_bio *bbio)
530530
u32 len = fi.length;
531531

532532
bio_size += len;
533-
if (error)
534-
mapping_set_error(folio->mapping, error);
535-
536533
ASSERT(btrfs_folio_test_ordered(fs_info, folio, start, len));
537534
btrfs_folio_clear_ordered(fs_info, folio, start, len);
538535
btrfs_folio_clear_writeback(fs_info, folio, start, len);
539536
}
540537

538+
if (error)
539+
mapping_set_error(bbio->inode->vfs_inode.i_mapping, error);
540+
541541
btrfs_finish_ordered_extent(bbio->ordered, bbio->file_offset, bio_size, !error);
542542
bio_put(bio);
543543
}

0 commit comments

Comments
 (0)