Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1554446

Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block count to be cleaned

From Jeff Moyer <jmoyer@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block count to be cleaned
Date 2017-01-09 17:10 +0100
Message-ID <sXKGe-6kS-27@gated-at.bofh.it> (permalink)
References <sXmXf-7DZ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Chandan Rajendra <chandan@linux.vnet.ibm.com> writes:

> The code currently uses sdio->blkbits to compute the number of blocks to
> be cleaned. However sdio->blkbits is derived from the logical block size
> of the underlying block device (Refer to the definition of
> do_blockdev_direct_IO()). Due to this, generic/299 test would rarely
> fail when executed on an ext4 filesystem with 64k as the block size and
> when using a virtio based disk (having 512 byte as the logical block
> size) inside a kvm guest.
>
> This commit fixes the bug by using inode->i_blkbits to compute the
> number of blocks to be cleaned.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
> ---
>  fs/direct-io.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index aeae8c0..b20adf9 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -905,6 +905,7 @@ static inline void dio_zero_block(struct dio *dio, struct dio_submit *sdio,
>  static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
>  			struct buffer_head *map_bh)
>  {
> +	const unsigned i_blkbits = dio->inode->i_blkbits;

NAK.  Please see commit ab73857e354 ("direct-io: don't read
inode->i_blkbits multiple times").

I think you want:

	const unsigned i_blkbits = sdio->blkbits + sdio->blkfactor;

as is used elsewhere in the code.

Cheers,
Jeff

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] do_direct_IO: Use inode->i_blkbits to compute block count to be cleaned Chandan Rajendra <chandan@linux.vnet.ibm.com> - 2017-01-08 15:50 +0100
  Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block  count to be cleaned Christoph Hellwig <hch@infradead.org> - 2017-01-09 15:00 +0100
  Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block count  to be cleaned Jens Axboe <axboe@kernel.dk> - 2017-01-09 16:40 +0100
  Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block count to be cleaned Jeff Moyer <jmoyer@redhat.com> - 2017-01-09 17:10 +0100
  Re: [PATCH] do_direct_IO: Use inode->i_blkbits to compute block  count to be cleaned Jan Kara <jack@suse.cz> - 2017-01-09 21:30 +0100
  Re: [PATCH] direct-io: don't introduce another read of  inode->i_blkbits Jens Axboe <axboe@kernel.dk> - 2017-01-09 22:50 +0100
  [PATCH] direct-io: don't introduce another read of inode->i_blkbits Jeff Moyer <jmoyer@redhat.com> - 2017-01-09 22:50 +0100
    Re: [PATCH] direct-io: don't introduce another read of inode->i_blkbits Chandan Rajendra <chandan@linux.vnet.ibm.com> - 2017-01-10 06:30 +0100
      Re: [PATCH] direct-io: don't introduce another read of  inode->i_blkbits Jens Axboe <axboe@kernel.dk> - 2017-01-10 21:40 +0100

csiph-web