Ed Sheeran was intensely unhappy in the first decade of his career.