How does something enter the CLEAN2 state?

16 views
Skip to first unread message

Stephen R. van den Berg

unread,
Jun 15, 2020, 10:55:52 AM6/15/20
to s3backer-devel
While browsing the code, I was trying to figure out when something enters the CLEAN2 state.
Maybe I'm not looking right, but I can't seem to find it.
Any pointers?

Archie Cobbs

unread,
Jun 15, 2020, 11:10:38 AM6/15/20
to s3backer-devel
The states are not stored explicitly with the cache entries; instead they are "inferred" based on other bits in the structure.

This is how:

#define ENTRY_GET_STATE(entry)  (ENTRY_IN_LIST(entry) ?                             \
                                   ((entry)->dirty ? DIRTY :                        \
                                      ((entry)->verify ? CLEAN2 : CLEAN)) :         \
                                    ((entry)->timeout == READING_TIMEOUT ?          \
                                      ((entry)->verify ? READING2 : READING) :      \
                                      (entry)->dirty ? WRITING2 : WRITING))

So you can see that a cache entry is in state CLEAN2 when it is in the clean list and entry->verify is true. This happens on line 398 of block_cache.c.

-Archie
Reply all
Reply to author
Forward
0 new messages