因为函数y=f(x)是函数y=a x(a>0且a≠1)的反函数,且y=f(x)的图象过点(2,1),
所以函数y=a x经过(1,2),所以a=2,
所以函数y=f(x)=log 2x.
故答案为:log 2x.