Skip to content

Commit

Permalink
Revert "Determine inode during create/open when basepath is known for…
Browse files Browse the repository at this point in the history
… use in fgetattr"

This reverts commit 3867cfb.
  • Loading branch information
PhracturedBlue committed Apr 2, 2024
1 parent 3867cfb commit 51b891c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/fileinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ class FileInfo : public FH
public:
FileInfo(int const fd_,
char const *fusepath_,
uint64_t inode_,
bool const direct_io_)
: FH(fusepath_),
fd(fd_),
inode(inode_),
direct_io(direct_io_)
{
}

public:
int fd;
uint64_t inode;
uint32_t direct_io:1;
std::mutex mutex;
};
7 changes: 1 addition & 6 deletions src/fuse_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "fileinfo.hpp"
#include "fs_acl.hpp"
#include "fs_clonepath.hpp"
#include "fs_fstat.hpp"
#include "fs_inode.hpp"
#include "fs_open.hpp"
#include "fs_path.hpp"
#include "procfs_get_name.hpp"
Expand Down Expand Up @@ -158,17 +156,14 @@ namespace l
int rv;
FileInfo *fi;
std::string fullpath;
struct stat st;

fullpath = fs::path::make(createpath_,fusepath_);

rv = l::create_core(fullpath,mode_,umask_,ffi_->flags);
if(rv == -1)
return -errno;

fs::fstat(rv, &st);
fs::inode::calc(createpath_,fusepath_,&st);
fi = new FileInfo(rv,fusepath_,st.st_ino,ffi_->direct_io);
fi = new FileInfo(rv,fusepath_,ffi_->direct_io);

ffi_->fh = reinterpret_cast<uint64_t>(fi);

Expand Down
5 changes: 2 additions & 3 deletions src/fuse_fgetattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace l
int
fgetattr(const int fd_,
const std::string &fusepath_,
uint64_t inode_,
struct stat *st_)
{
int rv;
Expand All @@ -38,7 +37,7 @@ namespace l
if(rv == -1)
return -errno;

st_->st_ino = inode_;
fs::inode::calc("",fusepath_,st_);

return 0;
}
Expand All @@ -55,7 +54,7 @@ namespace FUSE
Config::Read cfg;
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);

rv = l::fgetattr(fi->fd,fi->fusepath,fi->inode,st_);
rv = l::fgetattr(fi->fd,fi->fusepath,st_);

timeout_->entry = ((rv >= 0) ?
cfg->cache_entry :
Expand Down
7 changes: 1 addition & 6 deletions src/fuse_open.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "fileinfo.hpp"
#include "fs_cow.hpp"
#include "fs_fchmod.hpp"
#include "fs_fstat.hpp"
#include "fs_inode.hpp"
#include "fs_lchmod.hpp"
#include "fs_open.hpp"
#include "fs_path.hpp"
Expand Down Expand Up @@ -201,7 +199,6 @@ namespace l
int fd;
FileInfo *fi;
std::string fullpath;
struct stat st;

fullpath = fs::path::make(basepath_,fusepath_);

Expand All @@ -214,9 +211,7 @@ namespace l
if(fd == -1)
return -errno;

fs::fstat(fd, &st);
fs::inode::calc(basepath_,fusepath_,&st);
fi = new FileInfo(fd,fusepath_,st.st_ino,ffi_->direct_io);
fi = new FileInfo(fd,fusepath_,ffi_->direct_io);

ffi_->fh = reinterpret_cast<uint64_t>(fi);

Expand Down

0 comments on commit 51b891c

Please sign in to comment.