]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw/rgw_file: Move RGW{ListBuckets,Readdir}Request::eof() to .cc file
authorKefu Chai <tchaikov@gmail.com>
Mon, 12 May 2025 02:01:28 +0000 (10:01 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 13 Jun 2025 22:14:09 +0000 (06:14 +0800)
commit57322f32ae9f088108e133a2e27c5a4cbe1aca68
treed7c281f80ba74e192b7a8ebfff6b18104857914c
parenta372d624b5a21f2bb8d860b21e6b0ca210c12f06
rgw/rgw_file: Move RGW{ListBuckets,Readdir}Request::eof() to .cc file

Move RGWListBucketsRequest::eof() and RGWReaddirRequest::eof()
implementations from header to rgw/rgw_file.cc for better consistency
with our custom  RGWFileHandle::readdir_offset formatting.

Previously, these functions relied on boost::variant's global operator<<,
but we have our own specialized operator<< for readdir_offset in rgw_file_int.h.
Our implementation is optimized for the case where readdir_offset contains a
const char* and uses unlikely() for performance, unlike boost's default
formatter.

By moving implementations to the .cc file (after our custom operator<<
definition), we ensure they use our formatting logic and resolve potential
conflicts. This also properly addresses the fact that friend declarations
don't serve as function declarations. This change also paves the road to
migrate from boost::variant to std::variant, which does not provide the
global operator<<, so we will have to use our operator<< overload.

To preserve the previous inline behavior, both functions are explicitly
marked with the 'inline' keyword. Verification of inlining was performed
using:

```
readelf -s -W --demangle build/src/rgw/CMakeFiles/rgw_a.dir/rgw_file.cc.o | grep "Request::eof"
```
With `CMAKE_BUILD_TYPE=RelWithDebInfo`, both functions are confirmed to be
inlined as they don't appear in the symbol table, maintaining existing
behavior.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/rgw/rgw_file.cc
src/rgw/rgw_file_int.h