Commit Graph

11 Commits

Author SHA1 Message Date
Chad Austin
0c8f577cd8 close FileInode file handle when there are no open file handles
Summary:
In some workloads we're seeing folks run out of file descriptors.
We forgot that we'd taken out the code that closes the underlying fds.
This diff takes a run at adding a simple counter of the open file handle
objects that is incremented when they are constructed and decremented
when they are destroyed.

When the count falls to zero we release the file handle.

Note that we unconditionally open files when we first load the inodes
from the overlay.  I tried to defer that open attempt and it broke
the timestamp overlay test.  I think we can revisit that aspect in
a follow on diff; for now we should be more resilient to transiently
opened files from things like ripgrep or similar.

Reviewed By: simpkins

Differential Revision: D6097090

fbshipit-source-id: 9a48220002e760fb1ffb8d7e2a68fa7036558b78
2017-11-21 09:21:29 -08:00
Chad Austin
8b9261f2a1 run clang-format across all C++ files
Summary:
Per discussion with bolinfest, this brings Eden in line with clang-format.

This diff was generated with `find . \( -iname '*.cpp' -o -iname '*.h' \) -exec bash -c "yes | arc lint {}" \;`

Reviewed By: bolinfest

Differential Revision: D6232695

fbshipit-source-id: d54942bf1c69b5b0dcd4df629f1f2d5538c9e28c
2017-11-03 16:02:03 -07:00
Wez Furlong
9f07485239 add code to serialize FileHandleMap
Summary:
The serialized data for each file handle needs to be enough
to re-construct the handle when we load it into a new process later
on.  We need the inode number, the file handle number that we communicated
to the kernel and a flag to let us know whether it is a file or a dir.

Note that the file handle allocation strategy already accomodates the
idea of migrating to a new process; we don't need to serialize anything
like a next file handle id number.

This doesn't implement instantiating the handles from the loaded state,
it is just the plumbing for saving and loading that state information.

Reviewed By: bolinfest

Differential Revision: D5733079

fbshipit-source-id: 8fb8afb8ae9694d013ce7a4a82c31bc876ed33c9
2017-08-30 19:20:23 -07:00
Wez Furlong
a32c744daf remove FileHandle::openFlags_
Summary:
We're not doing anything with this today.  It's not
clear whether we should be doing sanity checks (eg: block attempts
to write to a handle that was opened only for reading) or whether
the kernel is going to do that for us, so I've broken this out
as a separate diff from the removal of FileData.

Reviewed By: bolinfest

Differential Revision: D5723064

fbshipit-source-id: b73452dfb4edf88b57fef1ad604bb2bde93bacc1
2017-08-30 19:20:23 -07:00
Wez Furlong
bdecf8b1f3 remove dead FileData references
Summary: These don't exist any more, so remove them

Reviewed By: bolinfest

Differential Revision: D5722861

fbshipit-source-id: 7db112dfab1dfdcf517452b314bd912ec8760bd1
2017-08-30 19:20:23 -07:00
Jyothsna Konisa
20cd12b31a Moving FileData methods to FileInode
Summary:
Moved all the member functions from `FileData` class to `FileInode` class
and made `FileInode` methods independent of shared `FileData` object.
Removed `FileData.h` and `FileData.cpp` files as they are not needed anymore.

Modified functions `FileInode::getSHA1()` and `FileInode::isSameAsFast` and
modified few testcases which are currently using `FileData` class and made
sure that all the test cases are passing.

Reviewed By: bolinfest

Differential Revision: D5430128

fbshipit-source-id: 3e8e6c490e92e4e602355e4ce39b67c450ec53f8
2017-07-26 23:39:35 -07:00
Victor Gao
f5c853a552 apply clang-tidy modernize-use-override
Summary:
This is generated by applying clang-tidy `-checks=modernize-use-override` to all the c++ code in project eden.
It enforces the use of the keywords `virtual`, `verride` and `final` in a way compliant to the style guide.

Reviewed By: igorsugak

Differential Revision: D5108807

fbshipit-source-id: 596f2d73f1137de350114416edb1c37da5423ed5
2017-05-23 16:10:26 -07:00
Adam Simpkins
a6ae3edab9 move eden/utils and eden/fuse into eden/fs
Summary:
This change makes it so that all of the C++ code related to the edenfs daemon
is now contained in the eden/fs subdirectory.

Reviewed By: bolinfest, wez

Differential Revision: D4889053

fbshipit-source-id: d0bd4774cc0bdb5d1d6b6f47d716ecae52391f37
2017-04-14 11:39:02 -07:00
Adam Simpkins
251da81f36 update all copyright statements to "2016-present"
Summary:
Update copyright statements to "2016-present".  This makes our updated lint
rules happy and complies with the recommended license header statement.

Reviewed By: wez, bolinfest

Differential Revision: D4433594

fbshipit-source-id: e9ecb1c1fc66e4ec49c1f046c6a98d425b13bc27
2017-01-20 22:03:02 -08:00
Adam Simpkins
89fb0f811b add InodePtr, TreeInodePtr, and FileInodePtr type names
Summary:
Define InodePtr, TreeInodePtr, and FileInodePtr as aliases for std::shared_ptr
of the underlying inode type.  This also updates all of the code to use these
new type names.

This will make it easier swap out std::shared_ptr with a custom pointer type in
the future.  (I believe we will need a custom type in the future so that we
can have more precise control of the reference counting so we can load and
unload Inode objects on demand.  std::shared_ptr::unique() doesn't quite
provide the flexibility we need, and is also being deprecated in C++17.)

Reviewed By: bolinfest

Differential Revision: D4297791

fbshipit-source-id: 1080945649290e676f62689592159f1166159b20
2016-12-12 17:50:35 -08:00
Adam Simpkins
0e613bd96b rename TreeEntryFileInode to FileInode
Summary:
Rename TreeEntryFileInode to FileInode, and TreeEntryFileHandle to FileHandle.
These class names were long and awkward.

It's slightly unfortunate that we now have classes named both
eden::fuse::FileInode and eden::fuse::fusell::FileInode, but I don't believe
this should cause any major problems.  If we want to eliminate these name
collisions in the future I would advocate for renaming the fusell versions to
something like "FileInodeIface".

Reviewed By: bolinfest

Differential Revision: D4217909

fbshipit-source-id: 899672a318d7ae39595f2c18e171f8fd6cebedc6
2016-11-30 15:49:13 -08:00