Skip to content

Commit

Permalink
Merge pull request #7628 from liewegas/wip-journal-block-size
Browse files Browse the repository at this point in the history
os/filestore/FileJournal: set block size via config option

Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
  • Loading branch information
liewegas committed Mar 7, 2016
2 parents f78d7e8 + caa73ba commit 216967d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -1065,6 +1065,7 @@ OPTION(filestore_debug_verify_split, OPT_BOOL, false)
OPTION(journal_dio, OPT_BOOL, true)
OPTION(journal_aio, OPT_BOOL, true)
OPTION(journal_force_aio, OPT_BOOL, false)
OPTION(journal_block_size, OPT_INT, 4096)

// max bytes to search ahead in journal searching for corruption
OPTION(journal_max_corrupt_search, OPT_U64, 10<<20)
Expand Down
28 changes: 14 additions & 14 deletions src/os/filestore/FileJournal.cc
Expand Up @@ -44,7 +44,8 @@
#define dout_prefix *_dout << "journal "

const static int64_t ONE_MEG(1 << 20);
const static int CEPH_MINIMUM_BLOCK_SIZE(4096);
const static int CEPH_DIRECTIO_ALIGNMENT(4096);


int FileJournal::_open(bool forwrite, bool create)
{
Expand Down Expand Up @@ -148,7 +149,7 @@ int FileJournal::_open_block_device()
<< dendl;
max_size = bdev_sz;

block_size = CEPH_MINIMUM_BLOCK_SIZE;
block_size = g_conf->journal_block_size;

if (g_conf->journal_discard) {
discard = block_device_support_discard(fn.c_str());
Expand Down Expand Up @@ -288,7 +289,7 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize,
else {
max_size = oldsize;
}
block_size = MAX(blksize, (blksize_t)CEPH_MINIMUM_BLOCK_SIZE);
block_size = g_conf->journal_block_size;

if (create && g_conf->journal_zero_on_create) {
derr << "FileJournal::_open_file : zeroing journal" << dendl;
Expand Down Expand Up @@ -503,9 +504,11 @@ int FileJournal::open(uint64_t fs_op_seq)
<< block_size << " (required for direct_io journal mode)" << dendl;
return -EINVAL;
}
if ((header.alignment % CEPH_MINIMUM_BLOCK_SIZE) && directio) {
dout(0) << "open journal alignment " << header.alignment << " is not multiple of minimum block size "
<< CEPH_MINIMUM_BLOCK_SIZE << " (required for direct_io journal mode)" << dendl;
if ((header.alignment % CEPH_DIRECTIO_ALIGNMENT) && directio) {
dout(0) << "open journal alignment " << header.alignment
<< " is not multiple of minimum directio alignment "
<< CEPH_DIRECTIO_ALIGNMENT << " (required for direct_io journal mode)"
<< dendl;
return -EINVAL;
}

Expand Down Expand Up @@ -1048,13 +1051,10 @@ void FileJournal::align_bl(off64_t pos, bufferlist& bl)
{
// make sure list segments are page aligned
if (directio && (!bl.is_aligned(block_size) ||
!bl.is_n_align_sized(CEPH_MINIMUM_BLOCK_SIZE))) {
assert(0 == "bl should be align");
if ((bl.length() & (CEPH_MINIMUM_BLOCK_SIZE - 1)) != 0 ||
(pos & (CEPH_MINIMUM_BLOCK_SIZE - 1)) != 0)
dout(0) << "rebuild_page_aligned failed, " << bl << dendl;
assert((bl.length() & (CEPH_MINIMUM_BLOCK_SIZE - 1)) == 0);
assert((pos & (CEPH_MINIMUM_BLOCK_SIZE - 1)) == 0);
!bl.is_n_align_sized(CEPH_DIRECTIO_ALIGNMENT))) {
assert((bl.length() & (CEPH_DIRECTIO_ALIGNMENT - 1)) == 0);
assert((pos & (CEPH_DIRECTIO_ALIGNMENT - 1)) == 0);
assert(0 == "bl was not aligned");
}
}

Expand Down Expand Up @@ -1641,7 +1641,7 @@ int FileJournal::prepare_entry(vector<ObjectStore::Transaction>& tls, bufferlist
}
// footer
ebl.append((const char*)&h, sizeof(h));
ebl.rebuild_aligned(CEPH_MINIMUM_BLOCK_SIZE);
ebl.rebuild_aligned(CEPH_DIRECTIO_ALIGNMENT);
tbl->claim(ebl);
return h.len;
}
Expand Down

0 comments on commit 216967d

Please sign in to comment.