bdev: set iovs on correct bdev_io in spdk_bdev_io_put_buf

spdk_bdev_io_put_buf() is responsible for reclaiming
bdev-allocated buffers from a bdev_io.  If there are
bdev_ios waiting for one of these buffers, it calls
spdk_bdev_io_set_buf() on the next bdev_io in the queue.
This will set the iov_base and iov_len on the bdev_io
to point to the bdev-allocated buffer.

But spdk_bdev_io_put_buf() was calling spdk_bdev_io_set_buf()
on the just completed bdev_io, not the next bdev_io in the
queue.  So fix that.

Fixes: 844aedf8 ("bdev: Simplify get/set/put buf functions")
Reported-by: Alan Tu
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibbcad6e35a3db6991bd7deb3516229572f021638
Reviewed-on: https://review.gerrithub.io/424881
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2018-09-06 12:10:44 -07:00
parent 44a43939e8
commit f3cedcc7fe

View File

@ -420,7 +420,7 @@ spdk_bdev_io_put_buf(struct spdk_bdev_io *bdev_io)
tmp = STAILQ_FIRST(stailq);
aligned_buf = (void *)(((uintptr_t)buf + 511) & ~511UL);
spdk_bdev_io_set_buf(bdev_io, aligned_buf, tmp->internal.buf_len);
spdk_bdev_io_set_buf(tmp, aligned_buf, tmp->internal.buf_len);
STAILQ_REMOVE_HEAD(stailq, internal.buf_link);
tmp->internal.buf = buf;