static int logfs_delete_dd(struct inode *dir, loff_t pos) { /* * Getting called with pos somewhere beyond eof is either a goofup * within this file or means someone maliciously edited the * (crc-protected) journal. */ BUG_ON(beyond_eof(dir, pos)); dir->i_ctime = dir->i_mtime = CURRENT_TIME; log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos); return logfs_delete(dir, pos, NULL); }
bLSM::bLSM(int log_mode, pageid_t max_c0_size, pageid_t internal_region_size, pageid_t datapage_region_size, pageid_t datapage_size, const char *path) { recovering = true; this->max_c0_size = max_c0_size; this->mean_c0_run_length = max_c0_size; this->num_c0_mergers = 0; r_val = 3.0; // MIN_R tree_c0 = NULL; tree_c0_mergeable = NULL; c0_is_merging = false; tree_c1_prime = NULL; tree_c1 = NULL; tree_c1_mergeable = NULL; tree_c2 = NULL; // This bool is purely for external code. this->accepting_new_requests = true; this->shutting_down_ = false; c0_flushing = false; c1_flushing = false; current_timestamp = 0; expiry = 0; this->merge_mgr = 0; tmerger = new tupleMerger(&replace_merger); header_mut = rwlc_initlock(); pthread_mutex_init(&rb_mut, 0); pthread_cond_init(&c0_needed, 0); pthread_cond_init(&c0_ready, 0); pthread_cond_init(&c1_needed, 0); pthread_cond_init(&c1_ready, 0); epoch = 0; this->internal_region_size = internal_region_size; this->datapage_region_size = datapage_region_size; this->datapage_size = datapage_size; this->log_mode = log_mode; this->batch_size = 0; std::string log_dir(path); if (log_dir.length() != 0) { if (log_dir[log_dir.length()-1] != '/') log_dir += "/"; } log_dir += "lsm_log"; //log_file = stasis_log_file_pool_open("lsm_log", log_file = stasis_log_file_pool_open(log_dir.c_str(), stasis_log_file_mode, stasis_log_file_permissions); }
quint8 settings::get_log_path(QString *dir) { if( !is_logged ) return 1; dir->clear(); dir->append( user_dir.absolutePath() ); dir->append( QString("/log") ); QDir log_dir( *dir ); if( !log_dir.exists() ) { if( !log_dir.mkpath( *dir ) ) return 2; } return 0; }
static int logfs_replace_inode(struct inode *dir, struct dentry *dentry, struct logfs_disk_dentry *dd, struct inode *inode) { loff_t pos; int err; err = logfs_get_dd(dir, dentry, dd, &pos); if (err) return err; dd->ino = cpu_to_be64(inode->i_ino); dd->type = logfs_type(inode); err = write_dir(dir, dd, pos); if (err) return err; log_dir("Replace dentry (%lx, %llx) %s -> %llx\n", dir->i_ino, pos, dd->name, be64_to_cpu(dd->ino)); return write_inode(dir); }