Isn't is better to move "name[0] == '\0'" check to bdrv_create_dirty_bitmap, near existed name checking?+ if (!name || name[0] == '\0') {
+ if (granularity < 512 || is_power_of_2(granularity)) { + error_setg(errp, "Granularity must be power of 2 " + "and greater than 512"); + return; + } + } else { + granularity = 65536; + }
Why not using something like DEFAULT_CLUSTER_SIZE, as in block/qcow2.h ? -- Best regards, Vladimir