Skip to content

Commit

Permalink
[Server] Implement the Flush() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 authored and simonmichal committed Oct 16, 2019
1 parent 4429090 commit 635d2da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/XrdOss/XrdOssApi.cc
Expand Up @@ -1028,6 +1028,28 @@ int XrdOssFile::Fchmod(mode_t Mode)
return (fchmod(fd, Mode) ? -errno : XrdOssOK);
}

/******************************************************************************/
/* F l u s h */
/******************************************************************************/

/*
Function: Flush file pages from the filesyste cacheÂ.
Output: Returns XrdOssOK upon success and -errno upon failure.
*/

void XrdOssFile::Flush()
{
// This actually only works in Linux so we punt otherwise
//
#if defined(__linux__)
if (fd>= 0)
{fdatasync(fd);
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
}
#endif
}

/******************************************************************************/
/* F s t a t */
/******************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions src/XrdOss/XrdOssApi.hh
Expand Up @@ -92,6 +92,7 @@ virtual int Close(long long *retsz=0);
virtual int Open(const char *, int, mode_t, XrdOucEnv &);

int Fchmod(mode_t mode);
void Flush();
int Fstat(struct stat *);
int Fsync();
int Fsync(XrdSfsAio *aiop);
Expand Down

0 comments on commit 635d2da

Please sign in to comment.