btrfs: Replace panic() with proper error handling in Inode.cpp

Replace kernel panics with ERROR() logging and proper error return
codes for unhandled extent types and unsupported compression types
in FindBlock() and ReadAt(). This prevents system crashes when
encountering unknown/unimplemented extent types.

Hashtags: gsoc2026
Change-Id: I0aec28dbbb5304c149f4a969d7017c347c876648
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10475
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
anujbillore-0-0
2026-04-08 11:24:20 +00:00
committed by Adrien Destugues
parent f02a32d987
commit 6f5f5465f4
@@ -196,8 +196,11 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t* _length)
off_t logical = 0;
if (extent_data->Type() == BTRFS_EXTENT_DATA_REGULAR)
logical = diff + extent_data->disk_offset;
else
panic("unknown extent type; %d\n", extent_data->Type());
else {
ERROR("unknown extent type; %d\n", extent_data->Type());
free(extent_data);
return B_BAD_DATA;
}
status = fVolume->FindBlock(logical, physical);
if (_length != NULL)
*_length = extent_data->Size() - diff;
@@ -270,7 +273,7 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
off_t diff = pos - search_key.Offset();
if (extent_data->Type() != BTRFS_EXTENT_DATA_INLINE) {
panic("unknown extent type; %d\n", extent_data->Type());
ERROR("unknown extent type; %d\n", extent_data->Type());
return B_BAD_DATA;
}