Thermodynamics of O ordering in YBa2Cu3O6+x