Skip to content

Commit 3bc36d1

Browse files
committed
crimson/os/seastore/rbm: remove unnecessary copy during ool write
Signed-off-by: Myoungwon Oh <[email protected]>
1 parent 918539e commit 3bc36d1

File tree

7 files changed

+12
-14
lines changed

7 files changed

+12
-14
lines changed

src/crimson/os/seastore/random_block_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class RandomBlockManager {
122122
crimson::ct_error::enospc,
123123
crimson::ct_error::erange
124124
>;
125-
virtual write_ertr::future<> write(paddr_t addr, bufferptr &buf) = 0;
125+
virtual write_ertr::future<> write(paddr_t addr, bufferptr buf) = 0;
126126

127127
using open_ertr = crimson::errorator<
128128
crimson::ct_error::input_output_error,

src/crimson/os/seastore/random_block_manager/block_rb_manager.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,16 @@ bool BlockRBManager::check_valid_range(rbm_abs_addr addr, bufferptr &bptr) {
129129

130130
BlockRBManager::write_ertr::future<> BlockRBManager::write(
131131
paddr_t paddr,
132-
bufferptr &bptr)
132+
bufferptr bptr)
133133
{
134134
ceph_assert(device);
135135
rbm_abs_addr addr = convert_paddr_to_abs_addr(paddr);
136136
if (!check_valid_range(addr, bptr)) {
137137
return crimson::ct_error::erange::make();
138138
}
139-
bufferptr bp = bufferptr(ceph::buffer::create_page_aligned(bptr.length()));
140-
bp.copy_in(0, bptr.length(), bptr.c_str());
141139
return device->write(
142140
addr,
143-
std::move(bp));
141+
bptr);
144142
}
145143

146144
BlockRBManager::read_ertr::future<> BlockRBManager::read(

src/crimson/os/seastore/random_block_manager/block_rb_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BlockRBManager final : public RandomBlockManager {
4343
*/
4444

4545
read_ertr::future<> read(paddr_t addr, bufferptr &buffer) final;
46-
write_ertr::future<> write(paddr_t addr, bufferptr &buf) final;
46+
write_ertr::future<> write(paddr_t addr, bufferptr buf) final;
4747
open_ertr::future<> open() final;
4848
close_ertr::future<> close() final;
4949

src/crimson/os/seastore/random_block_manager/nvme_block_device.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ NVMeBlockDevice::mount_ret NVMeBlockDevice::mount()
112112

113113
write_ertr::future<> NVMeBlockDevice::write(
114114
uint64_t offset,
115-
bufferptr &&bptr,
115+
bufferptr bptr,
116116
uint16_t stream) {
117117
logger().debug(
118118
"block: write offset {} len {}",
@@ -127,13 +127,13 @@ write_ertr::future<> NVMeBlockDevice::write(
127127
}
128128
if (is_end_to_end_data_protection()) {
129129
return seastar::do_with(
130-
std::move(bptr),
130+
bptr,
131131
[this, offset] (auto &bptr) {
132132
return nvme_write(offset, bptr.length(), bptr.c_str());
133133
});
134134
}
135135
return seastar::do_with(
136-
std::move(bptr),
136+
bptr,
137137
[this, offset, length, supported_stream] (auto& bptr) {
138138
return io_device[supported_stream].dma_write(
139139
offset, bptr.c_str(), length).handle_exception(

src/crimson/os/seastore/random_block_manager/nvme_block_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class NVMeBlockDevice : public RBMDevice {
221221

222222
write_ertr::future<> write(
223223
uint64_t offset,
224-
bufferptr &&bptr,
224+
bufferptr bptr,
225225
uint16_t stream = 0) override;
226226

227227
using RBMDevice::read;

src/crimson/os/seastore/random_block_manager/rbm_device.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ write_ertr::future<> RBMDevice::write_rbm_superblock()
9393
auto bp = bufferptr(ceph::buffer::create_page_aligned(super.block_size));
9494
assert(bl.length() < super.block_size);
9595
iter.copy(bl.length(), bp.c_str());
96-
return write(RBM_START_ADDRESS, std::move(bp));
96+
return write(RBM_START_ADDRESS, bp);
9797
}
9898

9999
read_ertr::future<rbm_superblock_t> RBMDevice::read_rbm_superblock(
@@ -212,7 +212,7 @@ open_ertr::future<> EphemeralRBMDevice::open(
212212

213213
write_ertr::future<> EphemeralRBMDevice::write(
214214
uint64_t offset,
215-
bufferptr &&bptr,
215+
bufferptr bptr,
216216
uint16_t stream) {
217217
LOG_PREFIX(EphemeralRBMDevice::write);
218218
ceph_assert(buf);

src/crimson/os/seastore/random_block_manager/rbm_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class RBMDevice : public Device {
128128
*/
129129
virtual write_ertr::future<> write(
130130
uint64_t offset,
131-
bufferptr &&bptr,
131+
bufferptr bptr,
132132
uint16_t stream = 0) = 0;
133133

134134
virtual discard_ertr::future<> discard(
@@ -223,7 +223,7 @@ class EphemeralRBMDevice : public RBMDevice {
223223

224224
write_ertr::future<> write(
225225
uint64_t offset,
226-
bufferptr &&bptr,
226+
bufferptr bptr,
227227
uint16_t stream = 0) override;
228228

229229
using RBMDevice::read;

0 commit comments

Comments
 (0)