Large-scale structure of solar magnetic fields and coronal mass ejections