I am writing a service that saves files and may potentially fill up one storage and may have a secondary storage to fall back to. I'd like to monitor the amount of free space on the primary storage and quit even trying to write to it if it's running low on free space. To do this, I was thinking of calling GetDiskFreeSpaceEx somewhat frequently - maybe once every few seconds. Is GetDiskFreeSpaceEx expensive - is there a reason not to do this? OR, is there a better pattern to accomplish what I'm trying to do?
[EDIT] The kind of answer I was hoping for might come from either
A)someone who has an idea of what GetDiskFreeSpaceEx actually does behind the scenes who might say either "don't do that, the system does all the expensive operations when you ask for the free disk space" or "that's fine to do; the system keeps a count of that in memory and just has to retrieve it for you" or
B)someone who has written an application with a similar requirement, and already been down this road and down the research