If doing sync write, we should update the inode block not only when the inode size increased, but also in case the hole was filled that caused allocation of the direct blocks.
I believe that the existing test already has this covered. The test (resid > uio->uio_resid) is checking that any data has been written. In the typical case this is at the end of the file and the size will have increased. But if the write was in the middle of a file filling in a hole then this test will catch that and cause the inode to be written.