-
Darrick J. Wong authored
When bigalloc is enabled, using ext2fs_block_alloc_stats2() to free any block in a cluster has the effect of freeing the entire cluster. This is problematic if a caller instructs us to punch, say, blocks 12-15 of a 16-block cluster, because blocks 0-11 now point to a "free" cluster. The naive way to solve this problem is to see if any of the other blocks in this logical cluster map to a physical cluster. If so, then we know that the cluster is still in use and it mustn't be freed. Otherwise, we are punching the last mapped block in this cluster, so we can free the cluster. The implementation given only does the rigorous checks for the partial clusters at the beginning and end of the punching range. Reviewed-by:
Zheng Liu <wenqing.lz@taobao.com> Signed-off-by:
Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by:
"Theodore Ts'o" <tytso@mit.edu>
84397754