$m$ is the mass of considered volume of the liquid. It varies. So you can see, in your equation $mgh=\frac 12 mv^2$, $m$ cancels out from the both sides. It's your choice to decide whether it is unit mass or the overall mass of water (not recommended) or the mass of a selected volume. Though it doesn't matter in your final result, which I guess is $v$. (But it is better to take $m$ as the mass of a tiny amount of water flows through the hole)
To be perfectly correct, I recommend you to consider $m$ as the mass of a tiny amount of water (as I have mentioned before). The reason is this: since $h$ is the height to the surface from the bottom, the gravitational potential energy of overall mass of water is $mg\frac h2$, because the centre of mass situated at the height of $\frac h2$ from the bottom. To make your equation valid, you are considering a tiny amount of water at the surface (think it as a droplet for better understanding) which has potential energy of $mgh$. That is the tiny amount of water (or droplet) which gains $v$ exit velocity at the hole. So it is not suitable to consider $m$ as the mass of overall water, because $v$ varies with the decrease of $h$.