If it is genuine your quadratic version will perform the same number of writes as the linear time solution.
If it is non-genuine what do you care how many writes it will perform? In that case the media is trash anyways.
The quadratic test will take an eternity due to the n^2 hashing operations and reads unless it terminates extremely early.
If you really have a need to terminate writing early, you could at least perform only a few reads randomly after each write (which will terminate early with high probably not long after you reached the maximum).
you just want two non-nested loops.