]> git-server-git.apps.pok.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>
Thu, 13 Oct 2022 11:11:38 +0000 (13:11 +0200)
commit9eb2ddbde3749b0a740d86183ac92e2ce811765d
tree9d2ba463cd4f340e42fc530b68e16800a2673354
parent3016e16199e31ebcb09d11500f26cd010bc157ae
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>
(cherry picked from commit af96e6dae3f4c3e30f91cb26d6579a6b5a726862)
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