The first write after file create fails to take the direct IO (Peer-to-Peer) path and falls back to slower software copy. The function get_more_block() sets 'create' to 0 after comparing 'unsigned long fs_startblk = 0' with 'long long (i_size_read(dio->inode) - 1) >> i_blkbits = 0xfffffffffffff'. Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@xxxxxxx> --- fs/direct-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index 3aafb33..588aa17 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -687,8 +687,8 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio, */ create = dio->op == REQ_OP_WRITE; if (dio->flags & DIO_SKIP_HOLES) { - if (fs_startblk <= ((i_size_read(dio->inode) - 1) >> - i_blkbits)) + if ((loff_t)fs_startblk <= + ((i_size_read(dio->inode) - 1) >> i_blkbits)) create = 0; } -- 2.7.4