On Tue, Dec 05, 2017 at 04:40:27PM -0500, Harish Kasiviswanathan wrote: > create = dio->op == REQ_OP_WRITE; > - if (dio->flags & DIO_SKIP_HOLES) { > + if (dio->flags & DIO_SKIP_HOLES && > + i_size_read(dio->inode) > 0) { > if (fs_startblk <= ((i_size_read(dio->inode) - 1) >> > i_blkbits)) i_size_read() isn't cheap on 32-bit SMP ... do we actually need to sample it at all here, or is it enough to use the i_size that was sampled earlier? IOW: create = dio->op == REQ_OP_WRITE; - if (dio->flags & DIO_SKIP_HOLES) { - if (fs_startblk <= ((i_size_read(dio->inode) - 1) >> - i_blkbits)) + if (dio->flags & DIO_SKIP_HOLES && dio->i_size) { + if (fs_startblk <= (dio->i_size - 1) >> i_blkbits)) Another possibility would be to tweak the comparison slightly ... if (dio->flags & DIO_SKIP_HOLES) { - if (fs_startblk <= ((i_size_read(dio->inode) - 1) >> - i_blkbits)) + if (fs_startblk < ((i_size_read(dio->inode) + + (1UL << i_blkbits) - 1) >> i_blkbits)) Or we could use a temporary variable to avoid reading i_size twice.