Need to loop to write untill all data written or error happened Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>