Abstract:
A method for modifying file contents of a flash file stored in a flash memory while balancing wear of the flash memory includes: finding first file nodes recording the file contents to be modified; searching for a plurality of void file nodes in the flash memory, selecting void nodes as second file nodes, and sequencing the second nodes based on node versions thereof; writing modified contents of the first nodes to one or more of the second nodes in ascending order of node versions of the second nodes; building node link information of the second nodes that have been written; marking the first nodes with a predetermined flag; vacating the first nodes that have been marked with the predetermined flag, and canceling node link information of the first nodes; and updating node versions of the second nodes that have been written and the first nodes that have been vacated.