11#pragma once
22
33#include " node_cache.h"
4- #include " read_write_range_lock.h"
54
65#include < cloud/filestore/public/api/protos/data.pb.h>
76
87#include < library/cpp/threading/future/core/future.h>
98
109#include < util/generic/deque.h>
10+ #include < util/generic/set.h>
1111
1212namespace NCloud ::NFileStore::NFuse::NWriteBackCache {
1313
@@ -51,16 +51,15 @@ struct TNodeState
5151 // Tracks cached data parts
5252 TNodeCache Cache;
5353
54- // Prevent from concurrent read and write requests with overlapping ranges
55- TReadWriteRangeLock RangeLock;
56-
57- ENodeFlushStatus FlushStatus = ENodeFlushStatus::NothingToFlush;
54+ // Prevents flushed requests from being evicted from Cache
55+ TMultiSet<ui64> CachedDataPins;
5856
5957 // Flush requests are fulfilled when there are no pending or unflushed
6058 // requests with SequenceId less or equal than |TFlushRequest::SequenceId|.
6159 // Flush requests are stored in chronological order: SequenceId values are
6260 // strictly increasing so newer flush requests have larger SequenceId.
6361 TDeque<TFlushRequest> FlushRequests;
62+ ENodeFlushStatus FlushStatus = ENodeFlushStatus::NothingToFlush;
6463
6564 // Cached data extends the node size but until the data is flushed,
6665 // the changes are not visible to the tablet. FileSystem requests that
@@ -70,7 +69,7 @@ struct TNodeState
7069
7170 bool CanBeDeleted () const
7271 {
73- if (Cache.Empty () && RangeLock. Empty ()) {
72+ if (Cache.Empty () && CachedDataPins. empty ()) {
7473 Y_ABORT_UNLESS (FlushRequests.empty ());
7574 Y_ABORT_UNLESS (FlushStatus == ENodeFlushStatus::NothingToFlush);
7675 return true ;
0 commit comments