OPTION(mds_hack_log_expire_for_better_stats, 0, OPT_BOOL, false),
OPTION(osd_data, 0, OPT_STR, ""),
OPTION(osd_journal, 0, OPT_STR, ""),
+ OPTION(osd_journal_size, 0, OPT_INT, 0), // in mb
OPTION(osd_balance_reads, 0, OPT_BOOL, false),
OPTION(osd_flash_crowd_iat_threshold, 0, OPT_INT, 0),
OPTION(osd_flash_crowd_iat_alpha, 0, OPT_DOUBLE, 0.125),
// osd
const char *osd_data;
const char *osd_journal;
+ int osd_journal_size; // in mb
bool osd_balance_reads;
int osd_flash_crowd_iat_threshold; // flash crowd interarrival time threshold in ms
double osd_flash_crowd_iat_alpha;
#define dout_prefix *_dout << dbeginl << "journal "
-int FileJournal::_open(bool forwrite)
+int FileJournal::_open(bool forwrite, bool create)
{
int flags;
} else {
flags = O_RDONLY;
}
+ if (create)
+ flags |= O_CREAT;
if (fd >= 0)
::close(fd);
- fd = ::open(fn.c_str(), flags);
+ fd = ::open(fn.c_str(), flags, 0644);
if (fd < 0) {
dout(2) << "_open failed " << errno << " " << strerror(errno) << dendl;
return -errno;
max_size = st.st_size;
block_size = st.st_blksize;
+ if (create && max_size < (g_conf.osd_journal_size << 20)) {
+ __u64 newsize = g_conf.osd_journal_size << 20;
+ dout(10) << "_open extending to " << newsize << " bytes" << dendl;
+ r = ::ftruncate(fd, newsize);
+ if (r == 0)
+ max_size = newsize;
+ }
+
if (max_size == 0) {
// hmm, is this a raw block device?
#ifdef BLKGETSIZE64
{
dout(2) << "create " << fn << dendl;
- int err = _open(true);
+ int err = _open(true, true);
if (err < 0) return err;
// write empty header
Cond write_cond;
bool write_stop;
- int _open(bool wr);
+ int _open(bool wr, bool create=false);
void print_header();
void read_header();
bufferptr prepare_header();
cat <<EOF >> $conf
[osd$osd]
osd data = dev/osd$osd
+ osd journal = dev/osd$osd/journal
+ osd journal size = 100
EOF
echo mkfs osd$osd
echo $SUDO $CEPH_BIN/cosd -i $osd $ARGS --mkfs # --debug_journal 20 --debug_osd 20 --debug_filestore 20 --debug_ebofs 20