@@ -1240,6 +1240,15 @@ static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
found_start,
found_start + found_len - 1,
wbc);
+ if (unlikely(ret < 0))
+ btrfs_err_rl(fs_info,
+"failed to run delalloc range, root %lld ino %llu folio %llu submit_bitmap %*pbl start %llu len %u: %d",
+ inode->root->root_key.objectid,
+ btrfs_ino(inode),
+ folio_pos(folio),
+ fs_info->sectors_per_page,
+ &bio_ctrl->submit_bitmap,
+ found_start, found_len, ret);
} else {
/*
* We've hit an error during previous delalloc range,
@@ -1506,6 +1515,13 @@ static int extent_writepage(struct folio *folio, struct btrfs_bio_ctrl *bio_ctrl
PAGE_SIZE, bio_ctrl, i_size);
if (ret == 1)
return 0;
+ if (ret < 0)
+ btrfs_err_rl(fs_info,
+"failed to submit blocks, root %lld ino %llu folio %llu submit_bitmap %*pbl: %d",
+ BTRFS_I(inode)->root->root_key.objectid,
+ btrfs_ino(BTRFS_I(inode)),
+ folio_pos(folio), fs_info->sectors_per_page,
+ &bio_ctrl->submit_bitmap, ret);
bio_ctrl->wbc->nr_to_write--;
During my development on aarch64 with 64K page size and 4K sector size, I'm hitting several problems related to error handling of extent_writepage(), most of them are caused by btrfs_run_delalloc_range() failure with -ENOSPC error. This error itself is already a problem for our data/metadata space reservation code, but we also need extra info like the submit_bitmap to calculate if the error handling is doing its job correctly. So add two btrfs_err_rl()s to indicate the errors that is affecting the error handling of extent_writepage(), which has already saved me several times during debugging. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/extent_io.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)