Yeah, unfortuantely writting the whole file over cannot be avoided. It's the way the file system works. I guess you could think of each file as a type of FILO stack.