public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND 0/3] cleanup for ublk
@ 2023-02-07  7:08 Ziyang Zhang
  2023-02-07  7:08 ` [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:08 UTC (permalink / raw)
  To: axboe, ming.lei; +Cc: linux-block, linux-kernel, joseph.qi, Ziyang Zhang

Hi, this series contain cleanup for code and comment of ublk including
removing unnecessary NULL check, unused variable and comment fix.

Ziyang Zhang (3):
  ublk: remove unnecessary NULL check in ublk_rq_has_data()
  ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
  ublk: pass NULL to blk_mq_alloc_disk() as queuedata

 drivers/block/ublk_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.18.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data()
  2023-02-07  7:08 [PATCH RESEND 0/3] cleanup for ublk Ziyang Zhang
@ 2023-02-07  7:08 ` Ziyang Zhang
  2023-02-07 14:06   ` Ming Lei
  2023-02-07  7:08 ` [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:08 UTC (permalink / raw)
  To: axboe, ming.lei; +Cc: linux-block, linux-kernel, joseph.qi, Ziyang Zhang

bio_has_data() allows a NULL bio so the NULL check in
ublk_rq_has_data() is unnecessary.

Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index c932e9ea5a0f..55fccce68a9c 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -322,7 +322,7 @@ static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev,
 
 static inline bool ublk_rq_has_data(const struct request *rq)
 {
-	return rq->bio && bio_has_data(rq->bio);
+	return bio_has_data(rq->bio);
 }
 
 static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq,
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
  2023-02-07  7:08 [PATCH RESEND 0/3] cleanup for ublk Ziyang Zhang
  2023-02-07  7:08 ` [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
@ 2023-02-07  7:08 ` Ziyang Zhang
  2023-02-07 14:07   ` Ming Lei
  2023-02-07  7:08 ` [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Ziyang Zhang
  2023-02-07 14:21 ` [PATCH RESEND 0/3] cleanup for ublk Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:08 UTC (permalink / raw)
  To: axboe, ming.lei; +Cc: linux-block, linux-kernel, joseph.qi, Ziyang Zhang

WRITE_ZEROES won't return bytes returned just like FLUSH and DISCARD,
and we can end it directly. Add missing comment for it in
ublk_complete_rq().

Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 55fccce68a9c..06eddefdf02a 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -665,7 +665,7 @@ static void ublk_complete_rq(struct request *req)
 	}
 
 	/*
-	 * FLUSH or DISCARD usually won't return bytes returned, so end them
+	 * FLUSH, DISCARD or WRITE_ZEROES usually won't return bytes returned, so end them
 	 * directly.
 	 *
 	 * Both the two needn't unmap.
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata
  2023-02-07  7:08 [PATCH RESEND 0/3] cleanup for ublk Ziyang Zhang
  2023-02-07  7:08 ` [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
  2023-02-07  7:08 ` [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
@ 2023-02-07  7:08 ` Ziyang Zhang
  2023-02-07 14:08   ` Ming Lei
  2023-02-07 14:21 ` [PATCH RESEND 0/3] cleanup for ublk Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:08 UTC (permalink / raw)
  To: axboe, ming.lei; +Cc: linux-block, linux-kernel, joseph.qi, Ziyang Zhang

queuedata is not referenced in ublk_drv and we can use driver_data
instead. Pass NULL to blk_mq_alloc_disk() as queuedata while allocating
ublk's gendisk.

Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 06eddefdf02a..d83fe2c2b3ba 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1578,7 +1578,7 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
 		goto out_unlock;
 	}
 
-	disk = blk_mq_alloc_disk(&ub->tag_set, ub);
+	disk = blk_mq_alloc_disk(&ub->tag_set, NULL);
 	if (IS_ERR(disk)) {
 		ret = PTR_ERR(disk);
 		goto out_unlock;
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data()
  2023-02-07  7:08 ` [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
@ 2023-02-07 14:06   ` Ming Lei
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lei @ 2023-02-07 14:06 UTC (permalink / raw)
  To: Ziyang Zhang; +Cc: axboe, linux-block, linux-kernel, joseph.qi

On Tue, Feb 07, 2023 at 03:08:37PM +0800, Ziyang Zhang wrote:
> bio_has_data() allows a NULL bio so the NULL check in
> ublk_rq_has_data() is unnecessary.
> 
> Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
  2023-02-07  7:08 ` [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
@ 2023-02-07 14:07   ` Ming Lei
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lei @ 2023-02-07 14:07 UTC (permalink / raw)
  To: Ziyang Zhang; +Cc: axboe, linux-block, linux-kernel, joseph.qi

On Tue, Feb 07, 2023 at 03:08:38PM +0800, Ziyang Zhang wrote:
> WRITE_ZEROES won't return bytes returned just like FLUSH and DISCARD,
> and we can end it directly. Add missing comment for it in
> ublk_complete_rq().
> 
> Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
> ---
>  drivers/block/ublk_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index 55fccce68a9c..06eddefdf02a 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -665,7 +665,7 @@ static void ublk_complete_rq(struct request *req)
>  	}
>  
>  	/*
> -	 * FLUSH or DISCARD usually won't return bytes returned, so end them
> +	 * FLUSH, DISCARD or WRITE_ZEROES usually won't return bytes returned, so end them
>  	 * directly.
>  	 *
>  	 * Both the two needn't unmap.

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks, 
Ming


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata
  2023-02-07  7:08 ` [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Ziyang Zhang
@ 2023-02-07 14:08   ` Ming Lei
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lei @ 2023-02-07 14:08 UTC (permalink / raw)
  To: Ziyang Zhang; +Cc: axboe, linux-block, linux-kernel, joseph.qi

On Tue, Feb 07, 2023 at 03:08:39PM +0800, Ziyang Zhang wrote:
> queuedata is not referenced in ublk_drv and we can use driver_data
> instead. Pass NULL to blk_mq_alloc_disk() as queuedata while allocating
> ublk's gendisk.
> 
> Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks, 
Ming


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND 0/3] cleanup for ublk
  2023-02-07  7:08 [PATCH RESEND 0/3] cleanup for ublk Ziyang Zhang
                   ` (2 preceding siblings ...)
  2023-02-07  7:08 ` [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Ziyang Zhang
@ 2023-02-07 14:21 ` Jens Axboe
  3 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2023-02-07 14:21 UTC (permalink / raw)
  To: ming.lei, Ziyang Zhang; +Cc: linux-block, linux-kernel, joseph.qi


On Tue, 07 Feb 2023 15:08:36 +0800, Ziyang Zhang wrote:
> removing unnecessary NULL check, unused variable and comment fix.
> 
> Ziyang Zhang (3):
>   ublk: remove unnecessary NULL check in ublk_rq_has_data()
>   ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
>   ublk: pass NULL to blk_mq_alloc_disk() as queuedata
> 
> [...]

Applied, thanks!

[1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data()
      commit: 731e208d7b4b38d2bac4b7c53403c8abbf306d01
[2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
      commit: b352389e7ba34bdb5bcf4254fa1e85319ba76352
[3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata
      commit: 1972d038a5401781377d3ce2d901bf7763a43589

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-02-07 14:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07  7:08 [PATCH RESEND 0/3] cleanup for ublk Ziyang Zhang
2023-02-07  7:08 ` [PATCH RESEND 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
2023-02-07 14:06   ` Ming Lei
2023-02-07  7:08 ` [PATCH RESEND 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
2023-02-07 14:07   ` Ming Lei
2023-02-07  7:08 ` [PATCH RESEND 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Ziyang Zhang
2023-02-07 14:08   ` Ming Lei
2023-02-07 14:21 ` [PATCH RESEND 0/3] cleanup for ublk Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox