blob: move data_ro check into rw_iov function

This keeps the top level functions as simple pass-throughs
which will simplify some future commits.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6578a1440d0404f600c055a5e37f28468b633d6f

Reviewed-on: https://review.gerrithub.io/390899
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2017-12-07 13:20:27 -07:00
parent c127a23690
commit 99a1020f0a

View File

@ -1303,6 +1303,11 @@ _spdk_blob_request_submit_rw_iov(struct spdk_blob *blob, struct spdk_io_channel
assert(blob != NULL);
if (!read && blob->data_ro) {
cb_fn(cb_arg, -EPERM);
return;
}
if (length == 0) {
cb_fn(cb_arg, 0);
return;
@ -2939,10 +2944,6 @@ void spdk_bs_io_writev_blob(struct spdk_blob *blob, struct spdk_io_channel *chan
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t length,
spdk_blob_op_complete cb_fn, void *cb_arg)
{
if (blob->data_ro) {
cb_fn(cb_arg, -EPERM);
return;
}
_spdk_blob_request_submit_rw_iov(blob, channel, iov, iovcnt, offset, length, cb_fn, cb_arg, false);
}