So I misread the code in the beginning, so the actual btrfs SB are being wiped out by the for loop which calls zer_dev_clamped. And in there all superblocks between 0 - block_count are zeored. And block_count is actual physical size of the device, right. And this value can further be limited by the max_block_count being passed, which in mkfs case is what's passed to -b. So instead of adding more code, why not just call zero_dev_clamped with the return value of btrfs_device_size rather than the possibly clamped one block_count? That you always unconditionally will be sure to zero out all the sb which are on the device, irrespective of the size of the fs? Something like :
Hm. Actually I didn't want to zero unless I find a valid SB at the copy#2. I was kind of wanted suggestions if there is something that I am missing if I write beyond the -b <blockcount>. I don't find anything wrong though. I look at it as a kind of wipeall.
Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
