From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>,
linux-block@vger.kernel.org, josef@toxicpanda.com,
nbd@other.debian.org, eblake@redhat.com, vincent.chen@sifive.com,
Leon Schuermann <leon@is.currently.online>,
Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH] nbd: fix partial sending
Date: Thu, 17 Oct 2024 23:42:50 +0800 [thread overview]
Message-ID: <ZxEwelJ__pzSMDPo@fedora> (raw)
In-Reply-To: <140c4437-fea2-482b-a43f-4ffe6c35e3d2@kernel.dk>
On Thu, Oct 17, 2024 at 09:22:22AM -0600, Jens Axboe wrote:
> On 10/17/24 9:13 AM, Bart Van Assche wrote:
> > On 10/17/24 4:36 AM, Ming Lei wrote:
> >> +static blk_status_t nbd_send_pending_cmd(struct nbd_device *nbd,
> >> + struct nbd_cmd *cmd)
> >> +{
> >> + struct request *req = blk_mq_rq_from_pdu(cmd);
> >> + unsigned long deadline = READ_ONCE(req->deadline);
> >> + unsigned int wait_ms = 2;
> >> + blk_status_t res;
> >> +
> >> + WARN_ON_ONCE(test_bit(NBD_CMD_REQUEUED, &cmd->flags));
> >> +
> >> + while (true) {
> >> + res = nbd_send_cmd(nbd, cmd, cmd->index);
> >> + if (res != BLK_STS_RESOURCE)
> >> + return res;
> >> + if (READ_ONCE(jiffies) + msecs_to_jiffies(wait_ms) >= deadline)
> >> + break;
> >> + msleep(wait_ms);
> >> + wait_ms *= 2;
> >> + }
> >
> > I think that there are better solutions to wait until more data
> > can be sent, e.g. by using the kernel equivalent of the C library
> > function select().
>
> It's vfs_poll() - but I don't think that'd be worth it here, the nbd
> driver sets BLK_MQ_F_BLOCKING anyway. Using a poll trigger for this
> would be a lot more complicated, and need quite a bit of support code.
Agree.
It is one unlikely event and not worth vfs_poll() here.
And the retry with exponential backoff wait should work just fine.
Thanks,
Ming
next prev parent reply other threads:[~2024-10-17 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 11:36 [PATCH] nbd: fix partial sending Ming Lei
2024-10-17 15:13 ` Bart Van Assche
2024-10-17 15:22 ` Jens Axboe
2024-10-17 15:42 ` Ming Lei [this message]
2024-10-17 15:47 ` Kevin Wolf
2024-10-18 0:33 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZxEwelJ__pzSMDPo@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=eblake@redhat.com \
--cc=josef@toxicpanda.com \
--cc=kwolf@redhat.com \
--cc=leon@is.currently.online \
--cc=linux-block@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=vincent.chen@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).