Quantum gates in mesoscopic atomic ensembles based on adiabatic passage and Rydberg blockade