@@ -3214,6 +3214,22 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
clear_reserved_extent &&
!test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) &&
!test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
+ /*
+ * Notify the user that some data has been lost due
+ * to an error, unless we were already expected to
+ * remove the data because of truncate.
+ *
+ * Put both logical and physical addresses here
+ * because we're about to remove the mapping that
+ * would have allowed the user to translate from
+ * one to the other.
+ */
+ if (ret && !truncated)
+ btrfs_err_rl(fs_info,
+"dropping unwritten extent at root %lld ino %llu offset [%llu,%llu] physical %llu length %llu",
+ btrfs_root_id(inode->root), btrfs_ino(inode),
+ unwritten_start, end, ordered_extent->disk_bytenr,
+ ordered_extent->disk_num_bytes);
/*
* Discard the range before returning it back to the
* free space pool