mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:50:54 +07:00
nbd: only set MSG_MORE when we have more to send
A user noticed that write performance was horrible over loopback and we
traced it to an inversion of when we need to set MSG_MORE. It should be
set when we have more bvec's to send, not when we are on the last bvec.
This patch made the test go from 20 iops to 78k iops.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Fixes: 429a787be6
("nbd: fix use-after-free of rq/bio in the xmit path")
Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
88a7503376
commit
d61b7f972d
@ -271,7 +271,7 @@ static inline int sock_send_bvec(struct nbd_device *nbd, int index,
|
||||
static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
|
||||
{
|
||||
struct request *req = blk_mq_rq_from_pdu(cmd);
|
||||
int result, flags;
|
||||
int result;
|
||||
struct nbd_request request;
|
||||
unsigned long size = blk_rq_bytes(req);
|
||||
struct bio *bio;
|
||||
@ -310,7 +310,6 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
|
||||
if (type != NBD_CMD_WRITE)
|
||||
return 0;
|
||||
|
||||
flags = 0;
|
||||
bio = req->bio;
|
||||
while (bio) {
|
||||
struct bio *next = bio->bi_next;
|
||||
@ -319,9 +318,8 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
|
||||
|
||||
bio_for_each_segment(bvec, bio, iter) {
|
||||
bool is_last = !next && bio_iter_last(bvec, iter);
|
||||
int flags = is_last ? 0 : MSG_MORE;
|
||||
|
||||
if (is_last)
|
||||
flags = MSG_MORE;
|
||||
dev_dbg(nbd_to_dev(nbd), "request %p: sending %d bytes data\n",
|
||||
cmd, bvec.bv_len);
|
||||
result = sock_send_bvec(nbd, index, &bvec, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user