ShingledFS 2.0
SMR-AwareFUSE-basedFileSystem

bc_file Struct Reference

Defines a Cached File record. More...

#include <buffercache.h>


Detailed Description

Defines a Cached File record.

Todo:
Hide any items that do not need to be exposed to FUSE. Currently, the only thing that FUSE needs is the file descriptor and the dirty flag. However, its better to store a pointer to this struct in FUSE for constant- order searching of the record for a file. So, move all other fields into another struct and save a void pointer to that struct within this struct. This way only the Buffer Cache code can access the internal fields, whereas FUSE can use the values that it is concerned with.

A thread will lock the structure by using the built-in mutex, increment the ref-count on open() or decrement it on close(), and pass the record to a worker thread to load/unload the file data from/to the EDI.

Should the file be in a loading state, a thread can increment/decrement the ref-count as applicable, and wait on the condition variable for the worker thread to wake it up once the transfer is complete.

Worker threads will load/save the file from/to the EDI, lock the mutex, and check the ref-count. If the ref-count is greater than 0, then the worker will broadcast on the condition variable to awaken any threads waiting for the transfer to finish.

Parameters:
pathThe path to the open file
inodeThe inode number of the file
statsThe attributes of the file, cached in memory for fast access
fdThe file descriptor assigned to the open file
ref_countThe reference count for the open file
dirtyFlag describing whether the file was written to since the load
stateCurrent state of the file
mutexThe mutex protecting the open_file record
cond_varThe condition variable used to wait on the open_file record
prevPointer to the previous open file node
nextPointer to the next open file node

Definition at line 77 of file buffercache.h.