On Sun, Oct 12, 2014 at 10:55:54PM +0000, Duncan wrote: [...] > It's the raid-factor. =:^) > > Btrfs in the kernel is apparently accounting for raid-factor in used > space in whatever function standard df is using, but not in available > space, even where that available space is already chunk-allocated (btrfs > fi show, individual devices, size vs. used, where "used" simply means > chunk-allocated for show) and thus the raid-factor known.
Nice analysis. There must be a bug then. The raid factor is taken into account when calculating the usable space: super.c:btrfs_statfs(): 1827 buf->f_bavail = total_free_data; 1828 ret = btrfs_calc_avail_data_space(fs_info->tree_root, &total_free_data); 1829 if (ret) { 1830 mutex_unlock(&fs_info->chunk_mutex); 1831 mutex_unlock(&fs_info->fs_devices->device_list_mutex); 1832 return ret; 1833 } 1834 buf->f_bavail += div_u64(total_free_data, factor); but it looks like the free space is counted twice, lines 1827 and 1834. The function btrfs_calc_avail_data_space does the guesswork "how much space could be still allocated" in the logical units, basically simulating the allocator logic. I'll have a look as I've touched btrfs_statfs last. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html