From 99a1020f0aa4f5a35f8ea1ecec090d1bf9cb5b15 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 7 Dec 2017 13:20:27 -0700 Subject: [PATCH] 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 Change-Id: I6578a1440d0404f600c055a5e37f28468b633d6f Reviewed-on: https://review.gerrithub.io/390899 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Daniel Verkamp --- lib/blob/blobstore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 7894feb2a..8376de4ae 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -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); }