Skip to content

Commit f9a8403

Browse files
authored
Merge pull request ceph#61878 from linuxbox2/wip-cksum-badalg
rgw: cksum: implement support for new CRC64NVME checksum algorithm and related fixes Reviewed-by: Casey Bodley <[email protected]>
2 parents 37baace + ee03b50 commit f9a8403

26 files changed

+3147
-80
lines changed

COPYING

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,26 @@ License: GNU Affero General Public License, Version 3
224224
Files: src/common/*s390x*
225225
Copyright: 2024 IBM <[email protected]>
226226
License: Apache License, version 2.0
227+
228+
Files: src/rgw/madler/*
229+
License:
230+
Copyright (C) 2014-2025 Mark Adler
231+
232+
This software is provided 'as-is', without any express or implied warranty.
233+
In no event will the authors be held liable for any damages arising from the
234+
use of this software.
235+
236+
Permission is granted to anyone to use this software for any purpose,
237+
including commercial applications, and to alter it and redistribute it
238+
freely, subject to the following restrictions:
239+
240+
1. The origin of this software must not be misrepresented; you must not claim
241+
that you wrote the original software. If you use this software in a
242+
product, an acknowledgment in the product documentation would be
243+
appreciated but is not required.
244+
2. Altered source versions must be plainly marked as such, and must not be
245+
misrepresented as being the original software.
246+
3. This notice may not be removed or altered from any source distribution.
247+
248+
Mark Adler
249+

src/crypto/isa-l/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# build isa-l_crypto from its makefile and expose as target ISAL::Crypto
2+
set(CEPH_HAVE_ISAL, TRUE)
3+
24
include(BuildISALCrypto)
35
build_isal_crypto()
46

src/rgw/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ if(WITH_RADOSGW_ARROW_FLIGHT)
1919
message("-- arrow flight is installed")
2020
endif(WITH_RADOSGW_ARROW_FLIGHT)
2121

22+
if(CEPH_HAVE_ISAL)
23+
message("-- building RGW with ISA-L support")
24+
add_definitions(-DSPDK_CONFIG_ISAL)
25+
endif()
26+
2227
function(gperf_generate input output)
2328
add_custom_command(
2429
OUTPUT ${output}
@@ -51,6 +56,10 @@ set(librgw_common_srcs
5156
services/svc_user_rados.cc
5257
services/svc_zone.cc
5358
services/svc_zone_utils.cc
59+
spdk/crc64.c
60+
madler/crc64nvme.c
61+
madler/crc32iso_hdlc.c
62+
madler/crc32iscsi.c
5463
rgw_account.cc
5564
rgw_acl.cc
5665
rgw_acl_s3.cc
@@ -65,6 +74,7 @@ set(librgw_common_srcs
6574
rgw_bucket.cc
6675
rgw_bucket_layout.cc
6776
rgw_cache.cc
77+
rgw_cksum.cc
6878
rgw_cksum_pipe.cc
6979
rgw_common.cc
7080
rgw_compression.cc

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3841,6 +3841,7 @@ int RadosMultipartUpload::init(const DoutPrefixProvider *dpp, optional_yield y,
38413841
multipart_upload_info upload_info;
38423842
upload_info.dest_placement = dest_placement;
38433843
upload_info.cksum_type = cksum_type;
3844+
upload_info.cksum_flags = cksum_flags;
38443845

38453846
if (obj_legal_hold) {
38463847
upload_info.obj_legal_hold_exist = true;
@@ -4256,6 +4257,7 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
42564257
return -EIO;
42574258
}
42584259
cksum_type = upload_info.cksum_type;
4260+
cksum_flags = upload_info.cksum_flags;
42594261
placement = upload_info.dest_placement;
42604262
upload_information = upload_info;
42614263
*rule = &placement;

src/rgw/madler/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (C) 2014-2025 Mark Adler
2+
3+
This software is provided 'as-is', without any express or implied warranty.
4+
In no event will the authors be held liable for any damages arising from the
5+
use of this software.
6+
7+
Permission is granted to anyone to use this software for any purpose,
8+
including commercial applications, and to alter it and redistribute it
9+
freely, subject to the following restrictions:
10+
11+
1. The origin of this software must not be misrepresented; you must not claim
12+
that you wrote the original software. If you use this software in a
13+
product, an acknowledgment in the product documentation would be
14+
appreciated but is not required.
15+
2. Altered source versions must be plainly marked as such, and must not be
16+
misrepresented as being the original software.
17+
3. This notice may not be removed or altered from any source distribution.
18+
19+
Mark Adler
20+

src/rgw/madler/crc32iscsi.c

Lines changed: 463 additions & 0 deletions
Large diffs are not rendered by default.

src/rgw/madler/crc32iscsi.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// The _bit, _byte, and _word routines return the CRC of the len
2+
// bytes at mem, applied to the previous CRC value, crc. If mem is
3+
// NULL, then the other arguments are ignored, and the initial CRC,
4+
// i.e. the CRC of zero bytes, is returned. Those routines will all
5+
// return the same result, differing only in speed and code
6+
// complexity. The _rem routine returns the CRC of the remaining
7+
// bits in the last byte, for when the number of bits in the
8+
// message is not a multiple of eight. The low bits bits of the low
9+
// byte of val are applied to crc. bits must be in 0..8.
10+
11+
#include <stddef.h>
12+
#include <stdint.h>
13+
14+
// Compute the CRC a bit at a time.
15+
uint32_t crc32iscsi_bit(uint32_t crc, void const *mem, size_t len);
16+
17+
// Compute the CRC of the low bits bits in val.
18+
uint32_t crc32iscsi_rem(uint32_t crc, unsigned val, unsigned bits);
19+
20+
// Compute the CRC a byte at a time.
21+
uint32_t crc32iscsi_byte(uint32_t crc, void const *mem, size_t len);
22+
23+
// Compute the CRC a word at a time.
24+
uint32_t crc32iscsi_word(uint32_t crc, void const *mem, size_t len);
25+
26+
// Compute the combination of two CRCs.
27+
uint32_t crc32iscsi_comb(uint32_t crc1, uint32_t crc2, uintmax_t len2);

0 commit comments

Comments
 (0)