Skip to content

Commit

Permalink
ADDED COMMENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
vadlakondaswetha committed Dec 23, 2024
1 parent 8feaafc commit 30e1844
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ func (fs *fileSystem) CreateFile(
handleID := fs.nextHandleID
fs.nextHandleID++

// Creating new file is always a write operation, hence passing readOnly as false.
fs.handles[handleID] = handle.NewFileHandle(child.(*inode.FileInode), fs.fileCacheHandler, fs.cacheFileForRangeRead, fs.metricHandle, false)
op.Handle = handleID

Expand Down
12 changes: 10 additions & 2 deletions internal/fs/inode/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,16 @@ type FileInode struct {
// Represents if local file has been unlinked.
unlinked bool

bwh *bufferedwrites.BufferedWriteHandler
config *cfg.Config
bwh *bufferedwrites.BufferedWriteHandler
config *cfg.Config

// Once write is started on the file i.e, bwh is initialized, any fileHandles
// opened in write mode before or after this and not yet closed are considered
// as writing to the file even though they are not writing.
// In case of successful flush, we will set bwh to nil. But in case of error,
// we will keep returning that error to all the fileHandles open during that time
// and set bwh to nil after all fileHandlers are closed.
// writeHandleCount tracks the count of open fileHandles in write mode.
writeHandleCount int32
}

Expand Down

0 comments on commit 30e1844

Please sign in to comment.