According to http://young.physics.ucsc.edu/112/magnetic.pdf, the free energy $F$ in the presence of a magnetic field is given by \begin{equation} dF = -SdT -MdB, \end{equation} where $M$ is the total magnetic dipole moment of the system and $B$ is the "external magnetic field". Consequently, the magnetic moment can be calculated as \begin{equation} M = \left( \frac{\partial F}{\partial B} \right)_T. \end{equation} I am slightly confused since the author afterwards states that there is a difference between $B$, $B_\text{ext}$ and $\mu_0 H$ and that "from now on" he will just use the symbol $B$. But he used that symbol already from the beginning and only called the field "external", which I find confusing.
So my question: To be 100% rigorous, should these two equations contain $B_\text{ext}$ (by which I understand the flux density of the field measured in vacuum, i.e. with the sample removed)? Are the equations still valid if there are any free currents (in contrast to bound magnetic moments) in the material?