an apparatus and a method for maintaining a file system is described . a method may include receiving a request for allocating a first block of a file system to a file , the first block comprising a first data from the file . the method also includes computing a first hash value by hashing the first data with a first hashing procedure and computing a second hash value by hashing the first data with a second hashing procedure . the method also includes using the first and the second hash values to determine whether a tree structure among a plurality of tree structures has a matching hash value among a plurality of hash values . each of the plurality of hash values in the tree structure correspond to a block among a plurality of blocks stored in the file system . the method further includes in response to determining that the tree structure has the matching hash value , allocating the corresponding block to the file and updating a reference count of the corresponding block in the tree structure .