1. A method comprising: selecting candidate files for optimization by traversing a file system; identifying a plurality of blocks in the plurality of candidate files; sending a block list and a plurality of tokens to a storage sub-system for optimization, the blocks list corresponding to the plurality of blocks in the plurality of candidate files and the plurality of tokens corresponding to the plurality of candidate files, wherein optimization includes deduplication and compression; receiving a notification that a file in the plurality of candidate files has been optimized, wherein the notification includes information on optimized data location, wherein upon receipt of the notification, a token in the plurality of tokens is used to determine if the file in tile plurality of candidate files has changed during optimization; wherein if the file has not changed, a stub file including a filemap needed to find the optimized data is generated.