- if (sector_boundary % CLUSTER_SIZE(*ef->sb) == 0)
- cluster = exfat_next_cluster(ef, node, cluster);
- erase_raw(ef, SECTOR_SIZE(*ef->sb),
- exfat_c2o(ef, cluster) + sector_boundary % CLUSTER_SIZE(*ef->sb));
- sector_boundary += SECTOR_SIZE(*ef->sb);
+ cluster = exfat_next_cluster(ef, node, cluster);
+ /* the cluster cannot be invalid because we have just allocated it */
+ if (CLUSTER_INVALID(cluster))
+ exfat_bug("invalid cluster in file");
+ erase_raw(ef, CLUSTER_SIZE(*ef->sb), exfat_c2o(ef, cluster));
+ cluster_boundary += CLUSTER_SIZE(*ef->sb);