]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: make C++ cmp&write semantics equal to C API
authorJonas Pfefferle <pepperjo@japf.ch>
Fri, 5 Aug 2022 17:37:55 +0000 (19:37 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 12 Aug 2022 11:57:54 +0000 (13:57 +0200)
commitaf96e6dae3f4c3e30f91cb26d6579a6b5a726862
treeaad75a340c15aa6b45689a4b74e8ed24908cc3b4
parentd80cff0dd665d660cd545c5a66d265b6bf732c73
librbd: make C++ cmp&write semantics equal to C API

The compare and write C++ API (both sync and async) does not check
compare bufferlist length and executes compare ops of bufferlist length
size, even if (write) "len" is smaller than bufferlist length.
This patch changes this behavior by always issuing compares and
writes of "len" size to match the C API. The bufferlist length
can be greater than "len" for both compare and write but only
"len" bytes are compared and written. If the bufferlist length
is smaller than "len" the call will fail.

Signed-off-by: Jonas Pfefferle <pepperjo@japf.ch>
src/include/rbd/librbd.hpp
src/librbd/io/ImageRequest.cc
src/librbd/io/ImageRequest.h
src/librbd/librbd.cc
src/test/librbd/test_librbd.cc