return round_up_to(size, super.block_size);
}
-void BlueFS::compact_log()
+void BlueFS::compact_log()/*_LNF_LD_NF_D*/
{
if (!cct->_conf->bluefs_replay_recovery_disable_compact) {
if (cct->_conf->bluefs_compact_log_sync) {
_compact_log_sync_LNF_LD();
} else {
- _compact_log_async_LD_NF_D();
+ _compact_log_async_LD_LNF_D();
}
}
}
* 8. Release the old log space. Clean up.
*/
-void BlueFS::_compact_log_async_LD_NF_D() //also locks FW for new_writer
+void BlueFS::_compact_log_async_LD_LNF_D() //also locks FW for new_writer
{
dout(10) << __func__ << dendl;
// only one compaction allowed at one time
return 0;
}
-void BlueFS::flush_range(FileWriter *h, uint64_t offset, uint64_t length) {
+void BlueFS::flush_range(FileWriter *h, uint64_t offset, uint64_t length)/*_WF*/
+{
std::unique_lock hl(h->lock);
_flush_range_F(h, offset, length);
}
}
#endif
-void BlueFS::append_try_flush(FileWriter *h, const char* buf, size_t len)
+void BlueFS::append_try_flush(FileWriter *h, const char* buf, size_t len)/*_WF_LNF_NF_LD_D*/
{
bool flushed_sum = false;
{
}
}
-void BlueFS::flush(FileWriter *h, bool force)
+void BlueFS::flush(FileWriter *h, bool force)/*_WF_LNF_NF_LD_D*/
{
bool flushed = false;
int r;
return new_data;
}
-int BlueFS::truncate(FileWriter *h, uint64_t offset)
+int BlueFS::truncate(FileWriter *h, uint64_t offset)/*_WF_L*/
{
std::lock_guard hl(h->lock);
dout(10) << __func__ << " 0x" << std::hex << offset << std::dec
return 0;
}
-int BlueFS::fsync(FileWriter *h)
+int BlueFS::fsync(FileWriter *h)/*_WF_WD_WLD_WLNF_WNF*/
{
std::unique_lock hl(h->lock);
uint64_t old_dirty_seq = 0;
return 0;
}
-int BlueFS::preallocate(FileRef f, uint64_t off, uint64_t len)
+int BlueFS::preallocate(FileRef f, uint64_t off, uint64_t len)/*_LF*/
{
std::lock_guard ll(log.lock);
std::lock_guard fl(f->lock);
return 0;
}
-void BlueFS::sync_metadata(bool avoid_compact)
+void BlueFS::sync_metadata(bool avoid_compact)/*_LNF_NF_LD_D*/
{
bool can_skip_flush;
{
if (cct->_conf->bluefs_compact_log_sync) {
_compact_log_sync_LNF_LD();
} else {
- _compact_log_async_LD_NF_D();
+ _compact_log_async_LD_LNF_D();
}
}
}
std::string_view dirname,
std::string_view filename,
FileWriter **h,
- bool overwrite)
+ bool overwrite)/*_N_LD*/
{
FileRef file;
bool create = false;
std::string_view dirname,
std::string_view filename,
FileReader **h,
- bool random)
+ bool random)/*_N*/
{
std::lock_guard nl(nodes.lock);
dout(10) << __func__ << " " << dirname << "/" << filename
int BlueFS::rename(
std::string_view old_dirname, std::string_view old_filename,
- std::string_view new_dirname, std::string_view new_filename)
+ std::string_view new_dirname, std::string_view new_filename)/*_LND*/
{
std::lock_guard ll(log.lock);
std::lock_guard nl(nodes.lock);
return 0;
}
-int BlueFS::mkdir(std::string_view dirname)
+int BlueFS::mkdir(std::string_view dirname)/*_LN*/
{
std::lock_guard ll(log.lock);
std::lock_guard nl(nodes.lock);
return 0;
}
-int BlueFS::rmdir(std::string_view dirname)
+int BlueFS::rmdir(std::string_view dirname)/*_LN*/
{
std::lock_guard ll(log.lock);
std::lock_guard nl(nodes.lock);
return 0;
}
-bool BlueFS::dir_exists(std::string_view dirname)
+bool BlueFS::dir_exists(std::string_view dirname)/*_N*/
{
std::lock_guard nl(nodes.lock);
map<string,DirRef>::iterator p = nodes.dir_map.find(dirname);
}
int BlueFS::stat(std::string_view dirname, std::string_view filename,
- uint64_t *size, utime_t *mtime)
+ uint64_t *size, utime_t *mtime)/*_N*/
{
std::lock_guard nl(nodes.lock);
dout(10) << __func__ << " " << dirname << "/" << filename << dendl;
}
int BlueFS::lock_file(std::string_view dirname, std::string_view filename,
- FileLock **plock)
+ FileLock **plock)/*_LN*/
{
std::lock_guard ll(log.lock);
std::lock_guard nl(nodes.lock);
return 0;
}
-int BlueFS::unlock_file(FileLock *fl)
+int BlueFS::unlock_file(FileLock *fl)/*_N*/
{
std::lock_guard nl(nodes.lock);
dout(10) << __func__ << " " << fl << " on " << fl->file->fnode << dendl;
return 0;
}
-int BlueFS::readdir(std::string_view dirname, vector<string> *ls)
+int BlueFS::readdir(std::string_view dirname, vector<string> *ls)/*_N*/
{
// dirname may contain a trailing /
if (!dirname.empty() && dirname.back() == '/') {
return 0;
}
-int BlueFS::unlink(std::string_view dirname, std::string_view filename)
+int BlueFS::unlink(std::string_view dirname, std::string_view filename)/*_LND*/
{
std::lock_guard ll(log.lock);
std::lock_guard nl(nodes.lock);
uint64_t capture_before_seq);
void _compact_log_sync_LNF_LD();
- void _compact_log_async_LD_NF_D();
+ void _compact_log_async_LD_LNF_D();
void _rewrite_log_and_layout_sync_LNF_LD(bool allocate_with_fallback,
int super_dev,
/// sync any uncommitted state to disk
void sync_metadata(bool avoid_compact);
- /// test and compact log, if necessary
- void _maybe_compact_log_LNF_NF_LD_D();
void set_volume_selector(BlueFSVolumeSelector* s) {
vselector.reset(s);
void invalidate_cache(FileRef f, uint64_t offset, uint64_t len);
int preallocate(FileRef f, uint64_t offset, uint64_t len);
int truncate(FileWriter *h, uint64_t offset);
- int _do_replay_recovery_read(FileReader *log,
- size_t log_pos,
- size_t read_offset,
- size_t read_len,
- bufferlist* bl);
size_t probe_alloc_avail(int dev, uint64_t alloc_size);
int read(uint8_t ndev, uint64_t off, uint64_t len,
ceph::buffer::list *pbl, IOContext *ioc, bool buffered);
int read_random(uint8_t ndev, uint64_t off, uint64_t len, char *buf, bool buffered);
+
+ /// test and compact log, if necessary
+ void _maybe_compact_log_LNF_NF_LD_D();
+ int _do_replay_recovery_read(FileReader *log,
+ size_t log_pos,
+ size_t read_offset,
+ size_t read_len,
+ bufferlist* bl);
};
class OriginalVolumeSelector : public BlueFSVolumeSelector {
* Vertices - Locks. Edges (directed) - locking progression.
* Edge A->B exist if last taken lock was A and next taken lock is B.
*
- * Column represents last lock taken.
- * Row represents next lock taken.
+ * Row represents last lock taken.
+ * Column represents next lock taken.
*
- * > | W | L | D | N | F
+ * > | W | L | N | D | F
* -------------|---|---|---|---|---
- * FileWriter W | | > | > | | >
+ * FileWriter W | | > | > | > | >
* log L | | > | > | >
+ * nodes N | | > | >
* dirty D | | | >
- * nodes N | | >
* File F |
*
* Claim: Deadlock is possible IFF graph contains cycles.