implement the de-duplication while writing the dirty pages