File encryption external storage fixes

Some improvements to the performance if files from externally mounted storages get shared.