diff mbox

[1/4] block: fix the count of PGPGOUT for WRITE_SAME

Message ID ccd2433b-c197-bce3-fec7-14467f864d19@linux.alibaba.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jiufei Xue Feb. 26, 2018, 12:04 p.m. UTC
The vm counters is counted in sectors, so we should do the conversation
in submit_bio.

Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and
partitions index")

Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
---
 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Omar Sandoval Feb. 26, 2018, 8:52 p.m. UTC | #1
On Mon, Feb 26, 2018 at 08:04:35PM +0800, Jiufei Xue wrote:
> The vm counters is counted in sectors, so we should do the conversation
> in submit_bio.
> 
> Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and
> partitions index")

The Fixes line shouldn't be wrapped. Besides that,

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
> ---
>  block/blk-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 2d1a7bb..6d82c4f 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2434,7 +2434,7 @@ blk_qc_t submit_bio(struct bio *bio)
>  		unsigned int count;
>  
>  		if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
> -			count = queue_logical_block_size(bio->bi_disk->queue);
> +			count = queue_logical_block_size(bio->bi_disk->queue) >> 9;
>  		else
>  			count = bio_sectors(bio);
>  
> -- 
> 1.9.4
>
Bart Van Assche Feb. 26, 2018, 11:43 p.m. UTC | #2
On Mon, 2018-02-26 at 20:04 +0800, Jiufei Xue wrote:
> The vm counters is counted in sectors, so we should do the conversation

> in submit_bio.

> 

> Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and

> partitions index")

> 

> Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>

> ---

>  block/blk-core.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/block/blk-core.c b/block/blk-core.c

> index 2d1a7bb..6d82c4f 100644

> --- a/block/blk-core.c

> +++ b/block/blk-core.c

> @@ -2434,7 +2434,7 @@ blk_qc_t submit_bio(struct bio *bio)

>  		unsigned int count;

>  

>  		if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))

> -			count = queue_logical_block_size(bio->bi_disk->queue);

> +			count = queue_logical_block_size(bio->bi_disk->queue) >> 9;

>  		else

>  			count = bio_sectors(bio);


Since this is a fix for a kernel v4.14 change, please add a
"Cc: stable@vger.kernel.org" tag.

Thanks,

Bart.
Christoph Hellwig Feb. 27, 2018, 12:10 a.m. UTC | #3
Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 2d1a7bb..6d82c4f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2434,7 +2434,7 @@  blk_qc_t submit_bio(struct bio *bio)
 		unsigned int count;
 
 		if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
-			count = queue_logical_block_size(bio->bi_disk->queue);
+			count = queue_logical_block_size(bio->bi_disk->queue) >> 9;
 		else
 			count = bio_sectors(bio);