Skip to content

Commit 736b005

Browse files
Ming Leiaxboe
authored andcommitted
ublk: remove __ublk_quiesce_dev()
Remove __ublk_quiesce_dev() and open code for updating device state as QUIESCED. We needn't to drain inflight requests in __ublk_quiesce_dev() any more, because all inflight requests are aborted in ublk char device release handler. Also we needn't to set ->canceling in __ublk_quiesce_dev() any more because it is done unconditionally now in ublk_ch_release(). Reviewed-by: Uday Shankar <ushankar@purestorage.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250416035444.99569-7-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 82a8a30 commit 736b005

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

drivers/block/ublk_drv.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ struct ublk_params_header {
209209

210210
static void ublk_stop_dev_unlocked(struct ublk_device *ub);
211211
static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq);
212-
static void __ublk_quiesce_dev(struct ublk_device *ub);
213212
static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub,
214213
struct ublk_queue *ubq, int tag, size_t offset);
215214
static inline unsigned int ublk_req_build_flags(struct request *req);
@@ -1586,7 +1585,8 @@ static int ublk_ch_release(struct inode *inode, struct file *filp)
15861585
ublk_stop_dev_unlocked(ub);
15871586
} else {
15881587
if (ublk_nosrv_dev_should_queue_io(ub)) {
1589-
__ublk_quiesce_dev(ub);
1588+
/* ->canceling is set and all requests are aborted */
1589+
ub->dev_info.state = UBLK_S_DEV_QUIESCED;
15901590
} else {
15911591
ub->dev_info.state = UBLK_S_DEV_FAIL_IO;
15921592
for (i = 0; i < ub->dev_info.nr_hw_queues; i++)
@@ -1832,21 +1832,6 @@ static void ublk_wait_tagset_rqs_idle(struct ublk_device *ub)
18321832
}
18331833
}
18341834

1835-
static void __ublk_quiesce_dev(struct ublk_device *ub)
1836-
{
1837-
int i;
1838-
1839-
pr_devel("%s: quiesce ub: dev_id %d state %s\n",
1840-
__func__, ub->dev_info.dev_id,
1841-
ub->dev_info.state == UBLK_S_DEV_LIVE ?
1842-
"LIVE" : "QUIESCED");
1843-
/* mark every queue as canceling */
1844-
for (i = 0; i < ub->dev_info.nr_hw_queues; i++)
1845-
ublk_get_queue(ub, i)->canceling = true;
1846-
ublk_wait_tagset_rqs_idle(ub);
1847-
ub->dev_info.state = UBLK_S_DEV_QUIESCED;
1848-
}
1849-
18501835
static void ublk_force_abort_dev(struct ublk_device *ub)
18511836
{
18521837
int i;

0 commit comments

Comments
 (0)