Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate remove call from Posix to Cache layer #191

Merged
merged 2 commits into from
Jan 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/XrdOuc/XrdOucCache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,23 @@ Debug = 0x0003; // Produce some debug messages (levels 0, 1, 2, or 3)
virtual
XrdOucCache *Create(Parms &Params, XrdOucCacheIO::aprParms *aprP=0) = 0;


// Propagate Unlink client request from posix layer to cache.
virtual
int Unlink(const char* /*path*/) { return 0; }

// Propagate Rmdir client request from posix layer to cache.
virtual
int Rmdir(const char* /*path*/) { return 0; }

// Propagate Rename client request from posix layer to cache.
virtual
int Rename(const char* /*path*/, const char* /*newPath*/) { return 0; }

// Propagate Truncate client request from posix layer to cache.
virtual
int Truncate(const char* /*path*/, off_t /*size*/) { return 0; }

/* The following holds statistics for the cache itself. It is updated as
associated cacheIO objects are deleted and their statistics are added.
*/
Expand Down
33 changes: 27 additions & 6 deletions src/XrdPosix/XrdPosixXrootd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,13 @@ int XrdPosixXrootd::Rename(const char *oldpath, const char *newpath)

// Issue the rename
//
return XrdPosixMap::Result(admin.Xrd.Mv(admin.Url.GetPathWithParams(),
newUrl.GetPathWithParams()));
std::string urlp = admin.Url.GetPathWithParams();
std::string nurlp = newUrl.GetPathWithParams();
int res = XrdPosixMap::Result(admin.Xrd.Mv(urlp, nurlp));
if (!res && myCache)
myCache->Rename(urlp.c_str(), nurlp.c_str());

return res;
}

/******************************************************************************/
Expand Down Expand Up @@ -780,7 +785,12 @@ int XrdPosixXrootd::Rmdir(const char *path)

// Issue the rmdir
//
return XrdPosixMap::Result(admin.Xrd.RmDir(admin.Url.GetPathWithParams()));
std::string urlp = admin.Url.GetPathWithParams();
int res = XrdPosixMap::Result(admin.Xrd.RmDir(urlp));
if (!res && myCache)
myCache->Rmdir(urlp.c_str());

return res;
}

/******************************************************************************/
Expand Down Expand Up @@ -974,8 +984,14 @@ int XrdPosixXrootd::Truncate(const char *path, off_t Size)

// Issue the truncate
//
return XrdPosixMap::Result(admin.Xrd.Truncate(admin.Url.GetPathWithParams(),
tSize));
std::string urlp = admin.Url.GetPathWithParams();
int res = XrdPosixMap::Result(admin.Xrd.Truncate(urlp,tSize));

if (!res && myCache) {
myCache->Truncate(urlp.c_str(), tSize);
}

return res;
}

/******************************************************************************/
Expand All @@ -992,7 +1008,12 @@ int XrdPosixXrootd::Unlink(const char *path)

// Issue the UnLink
//
return XrdPosixMap::Result(admin.Xrd.Rm(admin.Url.GetPathWithParams()));
std::string urlp = admin.Url.GetPathWithParams();
int res = XrdPosixMap::Result(admin.Xrd.Rm(urlp));
if (!res && myCache)
myCache->Unlink(urlp.c_str());

return res;
}

/******************************************************************************/
Expand Down