class LockedPage
Defined at line 202 of file ../../src/storage/f2fs/file_cache.h
LockedPage is a wrapper class for f2fs::Page lock management.
When LockedPage holds "fbl::RefPtr<Page> page" and the page is not nullptr, it guarantees that
the page is locked.
The syntax looks something like...
fbl::RefPtr
<Page
> unlocked_page;
{
LockedPage locked_page(unlocked_page);
do something requiring page lock...
}
When Page is used as a function parameter, you should use `LockedPage
&
` type for locked page.
Public Methods
void LockedPage ()
Defined at line 204 of file ../../src/storage/f2fs/file_cache.h
void LockedPage (const LockedPage & )
Defined at line 206 of file ../../src/storage/f2fs/file_cache.h
LockedPage & operator= (const LockedPage & )
Defined at line 207 of file ../../src/storage/f2fs/file_cache.h
zx::result<> SetVmoDirty ()
It works only for paged vmo. When f2fs needs to update the contents of a page without
triggering Vnode::VmoDirty(), it calls this method before the modification. If its page is
present, kernel pre-dirties the page. If not, it returns zx::error(ZX_ERR_NOT_FOUND), and the
caller have to supply a vmo.
Defined at line 215 of file ../../src/storage/f2fs/file_cache.cc
bool ClearDirtyForIo ()
Defined at line 67 of file ../../src/storage/f2fs/file_cache.cc
bool SetDirty ()
Defined at line 37 of file ../../src/storage/f2fs/file_cache.cc
void Zero (size_t start, size_t end)
Defined at line 209 of file ../../src/storage/f2fs/file_cache.cc
void Invalidate ()
It invalidates |this| for truncate and punch-a-hole operations. A caller should call
WaitOnWriteback() before it.
Defined at line 99 of file ../../src/storage/f2fs/file_cache.cc
void WaitOnWriteback ()
It waits for the writeback flag of |page_| to be cleared. So, it should not be called with
FileCache::page_lock_ acquired. It acquires LockedPage::lock_ during waiting.
TODO(b/293975446): Consider releasing |lock_| during waiting.
Defined at line 121 of file ../../src/storage/f2fs/file_cache.cc
bool SetWriteback (block_t addr)
Defined at line 128 of file ../../src/storage/f2fs/file_cache.cc
void LockedPage (LockedPage && p)
Defined at line 209 of file ../../src/storage/f2fs/file_cache.h
LockedPage & operator= (LockedPage && p)
Defined at line 215 of file ../../src/storage/f2fs/file_cache.h
void LockedPage (fbl::RefPtr<Page> page, std::try_to_lock_t t)
If it fails to acquire |page->mutex_|, it doesn't own |page|, and LockedPage::bool returns
false.
Defined at line 225 of file ../../src/storage/f2fs/file_cache.h
void LockedPage (fbl::RefPtr<Page> page)
Defined at line 232 of file ../../src/storage/f2fs/file_cache.h
void ~LockedPage ()
Defined at line 237 of file ../../src/storage/f2fs/file_cache.h
void reset ()
Defined at line 239 of file ../../src/storage/f2fs/file_cache.h
fbl::RefPtr<Page> release ()
It returns the ownership of unlocked |page_|.
Defined at line 266 of file ../../src/storage/f2fs/file_cache.h
fbl::RefPtr<Page> CopyRefPtr ()
CopyRefPtr() returns a RefPtr of locked |page_|.
Defined at line 275 of file ../../src/storage/f2fs/file_cache.h
template <typename T = Page>
T & GetPage ()
Defined at line 278 of file ../../src/storage/f2fs/file_cache.h
Page * get ()
Defined at line 282 of file ../../src/storage/f2fs/file_cache.h
Page & operator* ()
Defined at line 283 of file ../../src/storage/f2fs/file_cache.h
Page * operator-> ()
Defined at line 284 of file ../../src/storage/f2fs/file_cache.h
bool operator bool ()
Defined at line 285 of file ../../src/storage/f2fs/file_cache.h
bool operator== (decltype(nullptr) )
Comparison against nullptr operators (of the form, myptr == nullptr).
Defined at line 288 of file ../../src/storage/f2fs/file_cache.h
bool operator!= (decltype(nullptr) )
Defined at line 289 of file ../../src/storage/f2fs/file_cache.h