Study of nanoscale magnetization dynamics and reversal following ultrafast optical excitation by resonant X-ray diffraction