Skip to content

Commit

Permalink
Merge pull request #10375 from xiexingguo/xxg-wip-fix-bmap-ut-failure
Browse files Browse the repository at this point in the history
os/bluestore: use small encoding for bluefs extent and fnode

Reviewed-by: Igor Fedotov <ifedotov@mirantis.com>
  • Loading branch information
Igor Fedotov committed Jul 26, 2016
2 parents 0b9eeaa + cdbe210 commit c24d480
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/os/bluestore/BlueFS.cc
Expand Up @@ -1357,7 +1357,7 @@ void BlueFS::flush_bdev()
}
}

int BlueFS::_allocate(unsigned id, uint64_t len, vector<bluefs_extent_t> *ev)
int BlueFS::_allocate(uint8_t id, uint64_t len, vector<bluefs_extent_t> *ev)
{
dout(10) << __func__ << " len 0x" << std::hex << len << std::dec
<< " from " << id << dendl;
Expand Down
2 changes: 1 addition & 1 deletion src/os/bluestore/BlueFS.h
Expand Up @@ -232,7 +232,7 @@ class BlueFS {
FileRef _get_file(uint64_t ino);
void _drop_link(FileRef f);

int _allocate(unsigned bdev, uint64_t len, vector<bluefs_extent_t> *ev);
int _allocate(uint8_t bdev, uint64_t len, vector<bluefs_extent_t> *ev);
int _flush_range(FileWriter *h, uint64_t offset, uint64_t length);
int _flush(FileWriter *h, bool force);
void wait_for_aio(FileWriter *h); // safe to call without a lock
Expand Down
17 changes: 9 additions & 8 deletions src/os/bluestore/bluefs_types.cc
Expand Up @@ -5,23 +5,24 @@
#include "common/Formatter.h"
#include "include/uuid.h"
#include "include/stringify.h"
#include "include/small_encoding.h"

// bluefs_extent_t

void bluefs_extent_t::encode(bufferlist& bl) const
{
ENCODE_START(1, 1, bl);
::encode(offset, bl);
::encode(length, bl);
small_encode_lba(offset, bl);
small_encode_varint_lowz(length, bl);
::encode(bdev, bl);
ENCODE_FINISH(bl);
}

void bluefs_extent_t::decode(bufferlist::iterator& p)
{
DECODE_START(1, p);
::decode(offset, p);
::decode(length, p);
small_decode_lba(offset, p);
small_decode_varint_lowz(length, p);
::decode(bdev, p);
DECODE_FINISH(p);
}
Expand Down Expand Up @@ -119,8 +120,8 @@ vector<bluefs_extent_t>::iterator bluefs_fnode_t::seek(
void bluefs_fnode_t::encode(bufferlist& bl) const
{
ENCODE_START(1, 1, bl);
::encode(ino, bl);
::encode(size, bl);
small_encode_varint(ino, bl);
small_encode_varint(size, bl);
::encode(mtime, bl);
::encode(prefer_bdev, bl);
::encode(extents, bl);
Expand All @@ -130,8 +131,8 @@ void bluefs_fnode_t::encode(bufferlist& bl) const
void bluefs_fnode_t::decode(bufferlist::iterator& p)
{
DECODE_START(1, p);
::decode(ino, p);
::decode(size, p);
small_decode_varint(ino, p);
small_decode_varint(size, p);
::decode(mtime, p);
::decode(prefer_bdev, p);
::decode(extents, p);
Expand Down
4 changes: 2 additions & 2 deletions src/os/bluestore/bluefs_types.h
Expand Up @@ -9,9 +9,9 @@

class bluefs_extent_t : public AllocExtent{
public:
uint16_t bdev;
uint8_t bdev;

bluefs_extent_t(uint16_t b = 0, uint64_t o = 0, uint32_t l = 0)
bluefs_extent_t(uint8_t b = 0, uint64_t o = 0, uint32_t l = 0)
: AllocExtent(o, l), bdev(b) {}

void encode(bufferlist&) const;
Expand Down

0 comments on commit c24d480

Please sign in to comment.