Defending champion Ronnie O'Sullivan booked his place into the semi-finals of the Shanghai Masters on Thursday after beating Ding Junhui.