Conversation
437d54a to
746af47
Compare
turbonfs/src/fcsm.cpp
Outdated
| task ? "blocking" : "non-blocking", | ||
| commit_bytes, | ||
| fmt::ptr(task)); | ||
| assert(inode->is_flushing == true); |
There was a problem hiding this comment.
don't compare with true/false for booleans
815fc5e to
c116f4e
Compare
| * that we need to write inline, else if not under memory pressure returns | ||
| * zero. | ||
| */ | ||
| uint64_t get_inline_flush_bytes() const |
There was a problem hiding this comment.
we have do_inline_write() and get_inline_flush_bytes() bith which return "should we do inline writes" separately and may return different results, which is nto good.
we should have just one function.
There was a problem hiding this comment.
I see that we don't use it. I'll remove it.
|
|
||
| // TODO: Make it shared lock. | ||
| const std::unique_lock<std::mutex> _lock(chunkmap_lock_43); | ||
| auto it = chunkmap.lower_bound(0); |
There was a problem hiding this comment.
chunkmap.cbegin() is better
| @@ -2669,6 +2673,53 @@ std::vector<bytes_chunk> bytes_chunk_cache::get_commit_pending_bcs() const | |||
| assert(!mb->is_dirty()); | |||
There was a problem hiding this comment.
how do we prevent some write dirtying a commit pending membuf?
| inode->flush_lock(); | ||
| inode->get_fcsm()->ensure_flush(offset, length, nullptr); | ||
| inode->flush_unlock(); |
There was a problem hiding this comment.
why do we not have this inside "if (need_flush)"
| int64_t bytes = inode->get_filecache()->get_bytes_to_flush() - | ||
| inode->get_filecache()->max_dirty_extent_bytes(); |
There was a problem hiding this comment.
we need to make sure this doesn't result in small blocks being written
| if (commit_bytes == 0) { | ||
| AZLogDebug("COMMIT BYTES ZERO"); | ||
| } | ||
|
|
There was a problem hiding this comment.
if no new bytes to commit, why keep the task waiting.. and why add the commit target
|
|
||
| // Flush callback can only be called if FCSM is running. | ||
| assert(is_running()); | ||
| // assert(is_running()); |
| */ | ||
| if (inode->get_filecache()->is_flushing_in_progress()) { | ||
| if (inode->get_filecache()->is_flushing_in_progress() || | ||
| !is_running() || |
There was a problem hiding this comment.
and you have this check? I'm confused.
How can the state machine not be runnign when we are inside the callback, which state machine calls.
| if (inode->get_filecache()->is_flushing_in_progress()) { | ||
| if (inode->get_filecache()->is_flushing_in_progress() || | ||
| !is_running() || | ||
| inode->is_commit_in_progress()) { |
There was a problem hiding this comment.
also, how can commit be running while we are still inside the flush callback.
The whole point of fcsm is, that it'll serialize the flush and commit performed on a file.
| * If we flushed, we should trigger commit so that memory is released. | ||
| */ | ||
| if (!ftgtq.empty() && (ftgtq.front().flush_seq > flushing_seq_num)) { | ||
| if (!ctgtq.empty() && (ctgtq.front().commit_seq < flushed_seq_num)) { |
There was a problem hiding this comment.
shouldn't it be <=?
if commit target is asking to commit till seq 100 and we have flushed till seq 100, why should we not commit
| // commit_membufs() will update committing_seq_num() and mark fcsm running. | ||
| inode->commit_membufs(bc_vec); | ||
| assert(committing_seq_num >= bytes); | ||
| } else if ((!ftgtq.empty() && (ftgtq.front().flush_seq > flushed_seq_num)) || |
There was a problem hiding this comment.
shouldn't this check be
(ftgtq.front().flush_seq > flushing_seq_num)
since we want to flush only if it's not already flushingl
There was a problem hiding this comment.
similarly the next check should be against committing_seq_num?
In on_flush_complete() why should we check against committed_seq_num, as committed_seq_num can only change in on_commit_complete()
There was a problem hiding this comment.
infact the check should be against flushing_seq_num, since we want to check if there is a commit target asking more bytes to be committed than the flushing_seq_num, which would mean that we want to flush more.
|
|
||
| if (inode->is_stable_write()) { | ||
| // We should have all the dirty data in the chunkmap. | ||
| assert(bytes >= (ftgtq.front().flush_seq - flushed_seq_num)); |
There was a problem hiding this comment.
again, this should be flushing_seq_num
| * If commit is in progress, then we should not clear | ||
| * the running flag. Most likely it's issued from flush_cache_and_wait(). | ||
| */ | ||
| clear_running(); | ||
| if (!inode->is_commit_in_progress()) { |
There was a problem hiding this comment.
why do we need to special case flush_cache_and_wait().
can it also call ensure_flush(), maybe with a special value indicating "flush all".
That will simplify things further, since only way flush and commit could be running is from the state machine, which knows how to serialize them.
| assert(!inode->is_commit_in_progress()); | ||
| assert(committed_seq_num == committing_seq_num); | ||
| assert(flushed_seq_num == committed_seq_num); | ||
| assert(!inode->is_stable_write() || ctgtq.empty()); |
There was a problem hiding this comment.
why should we be inside on_commit_complete() for unstable writes
| /* | ||
| * It may happen flush initiated from flush_cache_and_wait(), so | ||
| * we should not clear the running flag. | ||
| */ | ||
| if(!inode->get_filecache()->is_flushing_in_progress()) { |
There was a problem hiding this comment.
again, better to update flush_cache_and_wait() to use the fscm
| #endif | ||
| if (task == nullptr && | ||
| (target_flushed_seq_num == last_flush_seq)) { | ||
| assert(is_running()); |
There was a problem hiding this comment.
we are here inside "if (is_running())", why additional check, here and at L529
ed07eba to
f024ccb
Compare
No description provided.