In some cases this was to restore buoyancy to compensate for wartime weight additions, as well as for torpedo protection.
In specific situations, this was achieved to re-establish buoyancy in response to wartime weight increases, as well as for defensive purposes against torpedoes.