Count dirty blocks and expose an API to get dirty count