From: Wenwei Tao Date: Thu, 7 Jul 2016 07:54:07 +0000 (+0200) Subject: lightnvm: break the loop when rqd is not null X-Git-Tag: v4.8-rc1~161^2~48 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0de2415bb730ee26ce4c90778696d3559f4312c5;p=karo-tx-linux.git lightnvm: break the loop when rqd is not null Break the loop when rqd is not null to reduce an unnecessary schedule. Signed-off-by: Wenwei Tao Signed-off-by: Matias Bjørling Signed-off-by: Jens Axboe --- diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index de86d72dcdf0..736e66968bc6 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -96,10 +96,13 @@ static void rrpc_discard(struct rrpc *rrpc, struct bio *bio) sector_t len = bio->bi_iter.bi_size / RRPC_EXPOSED_PAGE_SIZE; struct nvm_rq *rqd; - do { + while (1) { rqd = rrpc_inflight_laddr_acquire(rrpc, slba, len); + if (rqd) + break; + schedule(); - } while (!rqd); + } if (IS_ERR(rqd)) { pr_err("rrpc: unable to acquire inflight IO\n");