Skip to content

Personal/nitinsingla/fscm changes#36

Open
nitin-deamon wants to merge 8 commits intomainfrom
personal/nitinsingla/fscm-changes
Open

Personal/nitinsingla/fscm changes#36
nitin-deamon wants to merge 8 commits intomainfrom
personal/nitinsingla/fscm-changes

Conversation

@nitin-deamon
Copy link
Collaborator

No description provided.

@nitin-deamon nitin-deamon force-pushed the personal/nitinsingla/fscm-changes branch 3 times, most recently from 437d54a to 746af47 Compare February 6, 2025 18:04
task ? "blocking" : "non-blocking",
commit_bytes,
fmt::ptr(task));
assert(inode->is_flushing == true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't compare with true/false for booleans

@nitin-deamon nitin-deamon force-pushed the personal/nitinsingla/fscm-changes branch from 815fc5e to c116f4e Compare February 8, 2025 12:01
* that we need to write inline, else if not under memory pressure returns
* zero.
*/
uint64_t get_inline_flush_bytes() const
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Owner

@linuxsmiths linuxsmiths Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chunkmap.cbegin() is better

@@ -2669,6 +2673,53 @@ std::vector<bytes_chunk> bytes_chunk_cache::get_commit_pending_bcs() const
assert(!mb->is_dirty());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we prevent some write dirtying a commit pending membuf?

Comment on lines +258 to +260
inode->flush_lock();
inode->get_fcsm()->ensure_flush(offset, length, nullptr);
inode->flush_unlock();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we not have this inside "if (need_flush)"

Comment on lines +330 to +331
int64_t bytes = inode->get_filecache()->get_bytes_to_flush() -
inode->get_filecache()->max_dirty_extent_bytes();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to make sure this doesn't result in small blocks being written

Comment on lines +337 to +340
if (commit_bytes == 0) {
AZLogDebug("COMMIT BYTES ZERO");
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you comment this?

*/
if (inode->get_filecache()->is_flushing_in_progress()) {
if (inode->get_filecache()->is_flushing_in_progress() ||
!is_running() ||
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) ||
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this check be
(ftgtq.front().flush_seq > flushing_seq_num)

since we want to flush only if it's not already flushingl

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, this should be flushing_seq_num

Comment on lines +911 to +914
* 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()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we be inside on_commit_complete() for unstable writes

Comment on lines +711 to +715
/*
* 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()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are here inside "if (is_running())", why additional check, here and at L529

@linuxsmiths linuxsmiths force-pushed the main branch 5 times, most recently from ed07eba to f024ccb Compare February 19, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants