/* Update the free cluster info of FatInfoSector of the volume. */
VOID FatComputeFreeInfo(IN FAT_VOLUME *Volume)
/* Update the free cluster info of FatInfoSector of the volume. */
VOID FatComputeFreeInfo(IN FAT_VOLUME *Volume)
{
  UINTN  Index;
  if (!Volume->FreeInfoValid) {
    Volume->FreeInfoValid                       = TRUE;
    Volume->FatInfoSector.FreeInfo.ClusterCount = 0;
    for (Index = Volume->MaxCluster + 1; Index >= FAT_MIN_CLUSTER; Index--) {
      if (Volume->DiskError) {
        break;
      }
      if (FatGetFatEntry (Volume, Index) == FAT_CLUSTER_FREE) {
        Volume->FatInfoSector.FreeInfo.ClusterCount += 1;
        Volume->FatInfoSector.FreeInfo.NextCluster   = (UINT32)Index;
      }
    }
    Volume->FatInfoSector.Signature          = FAT_INFO_SIGNATURE;
    Volume->FatInfoSector.InfoBeginSignature = FAT_INFO_BEGIN_SIGNATURE;
    Volume->FatInfoSector.InfoEndSignature   = FAT_INFO_END_SIGNATURE;
  }
}