Hello! On Thu 26-12-19 12:37:50, Pali Rohár wrote: > During testing of udfinfo tool (from udftools project) I found that > udfinfo's implementation for calculating free space does not work when > UDF filesystem has Metadata partition (according to OSTA UDF 2.50). > > Year ago in udfinfo for calculating free space I used same algorithm as > is implemented in kernel UDF driver, function udf_count_free(). So I > suspect kernel driver could have it incorrectly implemented too, but I'm > not sure. So I'm sending this email to let you know about it. > > What is the problem? UDF Metadata partition is stored directly on UDF > Physical partition and therefore free space calculation needs to be done > from Physical one (same applies for Virtual partition). But Metadata > partition contains mapping table for logical <--> physical blocks, so > reading data needs to be done always from Metadata partition. Also in > UDF terminology are two different things: Partition and Partition Map. > And "partition number" is a bit misleading as sometimes it refers to > "Partition" and sometimes to "Partition Map" what are two different > things. Thanks for the note! You're right that we probably misreport amount of free space in the UDF filesystems with Metadata partition. Luckily the kernel driver supports filesystems with Metadata partition or Virtual partition only in read-only mode so the bug does not cause any real harm. > Calculation problem in udfinfo I fixed in this commit: > https://github.com/pali/udftools/commit/1763c9f899bdbdb68b1a44a8cb5edd5141107043 Thanks for the link, I'll fixup the kernel code. BTW, how did you test this? Do you have any UDF image with Metadata partition? Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR