Reversible and irreversible magnetization in long Josephson junctions