Skip to content

Commit 1ad8679

Browse files
committed
os/bluestore/compression: Main part of recompression feature
Add feature of recompression scanner that looks around write region to see how much would be gained, if we read some more around and wrote more. Added Compression.h / Compression.cc. Added debug_bluestore_compression dout. Created Scanner class. Provides write_lookaround() for scanning loaded extents. Signed-off-by: Adam Kupczyk <[email protected]>
1 parent a21f5a3 commit 1ad8679

File tree

5 files changed

+694
-1
lines changed

5 files changed

+694
-1
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "common/WorkQueue.h"
5858
#include "kv/KeyValueHistogram.h"
5959
#include "Writer.h"
60+
#include "Compression.h"
6061

6162
#if defined(WITH_LTTNG)
6263
#define TRACEPOINT_DEFINE
@@ -4405,6 +4406,16 @@ BlueStore::extent_map_t::iterator BlueStore::ExtentMap::maybe_split_at(uint32_t
44054406
return p;
44064407
}
44074408

4409+
// If there exist extent at `offset` return it,
4410+
// otherwise return smallest that `offset < logical_offset`.
4411+
BlueStore::extent_map_t::iterator BlueStore::ExtentMap::seek_nextent(
4412+
uint64_t offset)
4413+
{
4414+
Extent dummy(offset);
4415+
auto p = extent_map.lower_bound(dummy);
4416+
return p;
4417+
}
4418+
44084419
bool BlueStore::ExtentMap::has_any_lextents(uint64_t offset, uint64_t length)
44094420
{
44104421
auto fp = seek_lextent(offset);

src/os/bluestore/BlueStore.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class BlueStore : public ObjectStore,
271271
struct BufferSpace;
272272
struct Collection;
273273
struct Onode;
274+
class Scanner;
274275
class Estimator;
275276
typedef boost::intrusive_ptr<Collection> CollectionRef;
276277
typedef boost::intrusive_ptr<Onode> OnodeRef;
@@ -1171,6 +1172,8 @@ class BlueStore : public ObjectStore,
11711172
/// seek to the first lextent including or after offset
11721173
extent_map_t::iterator seek_lextent(uint64_t offset);
11731174
extent_map_t::const_iterator seek_lextent(uint64_t offset) const;
1175+
/// seek to the exactly the extent, or after offset
1176+
extent_map_t::iterator seek_nextent(uint64_t offset);
11741177

11751178
/// split extent
11761179
extent_map_t::iterator split_at(extent_map_t::iterator p, uint32_t offset);

0 commit comments

Comments
 (0)