All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] cleanup for ublk
@ 2023-02-07  7:00 Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:00 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] 5+ messages in thread

* [PATCH 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data()
  2023-02-07  7:00 [PATCH 0/3] cleanup for ublk Ziyang Zhang
@ 2023-02-07  7:00 ` Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:00 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.

Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
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] 5+ messages in thread

* [PATCH 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq()
  2023-02-07  7:00 [PATCH 0/3] cleanup for ublk Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
@ 2023-02-07  7:00 ` Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Ziyang Zhang
  2023-02-07  7:11 ` [PATCH 0/3] cleanup for ublk Ziyang Zhang
  3 siblings, 0 replies; 5+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:00 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] 5+ messages in thread

* [PATCH 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata
  2023-02-07  7:00 [PATCH 0/3] cleanup for ublk Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Ziyang Zhang
  2023-02-07  7:00 ` [PATCH 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Ziyang Zhang
@ 2023-02-07  7:00 ` Ziyang Zhang
  2023-02-07  7:11 ` [PATCH 0/3] cleanup for ublk Ziyang Zhang
  3 siblings, 0 replies; 5+ messages in thread
From: Ziyang Zhang @ 2023-02-07  7:00 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.

Fixes: 6d9e6dfdf3b2 ("ublk: defer disk allocation")
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] 5+ messages in thread

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

On 2023/2/7 15:00, Ziyang Zhang wrote:
> 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(-)
> 

Sorry, this patchset is wrong, please see the resent one.

Ziyang Zhang

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

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

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.