By the density functional theory for crystallization, it is shown that for vortex lines in an underlying layered structure a smectic phase with period m=2 can be stabilized by strong layer pinning. The freezing of vortex liquid is then two-step, a second-order liquid-smectic transition and a first-order smectic-lattice transition. DFT also indicates that a direct, first-order liquid-lattice transition preempts the smectic order with m>2 irrespectively of the pinning strength. Possible H-T phase diagrams are mapped out. Implications of the DFT results to the interlayer Josephson vortex system in high-Tc cuprates are given.