ewmscp  ..
Public Member Functions | List of all members
inputHandler::Gpfs::readerGpfs Class Reference

#include <inputHandlerGpfs.h>

Inheritance diagram for inputHandler::Gpfs::readerGpfs:
[legend]
Collaboration diagram for inputHandler::Gpfs::readerGpfs:
[legend]

Public Member Functions

 readerGpfs (const std::string &aPath, copyRequest::stateType &state, const genericStat &inititalStat)
 
 ~readerGpfs () override
 
bool readBlock (block &b) override
 read one block from the file More...
 
void readBlockP (block &b, size_t bytesToRead, off_t offset) override
 read one block from the file, starting at offset. More...
 
- Public Member Functions inherited from inputHandler::posixFile::readerPosixFile
 readerPosixFile (const std::string &aPath, copyRequest::stateType &state, const genericStat &inititalStat)
 
 ~readerPosixFile () override
 
bool parallelizable () const override
 tell if this handler is capable of parallel IO. Unsually not the case More...
 
bool setupSparseRegions (const std::string &sparseHandling) override
 create a region list which maps the holes in the source file More...
 
void seek (size_t pos) override
 like the standard seek, to be used only when appending new data to a file More...
 
bool readBlock (block &b) override
 read one block from the file More...
 
void readBlockP (block &b, size_t bytesToRead, off_t offset) override
 read one block from the file, starting at offset. More...
 
void checkUnchangedness () override
 check if the file is unchanged by comparing cuttent stat to initial stat More...
 
- Public Member Functions inherited from inputHandler::base::reader
virtual ~reader () noexcept(false)=default
 
- Public Member Functions inherited from ioHandle
 ioHandle ()
 
virtual ~ioHandle () noexcept(false)
 
virtual size_t getBlockSize () const
 
virtual void setBlockSize (size_t newSize)
 
- Public Member Functions inherited from posixFileIoCommon
 posixFileIoCommon (const std::string &aPath)
 
void setXattr (const std::string &name, const std::string &value) override
 
std::string getXattr (const std::string &name) override
 get one extended attribute value More...
 
void removeXattr (const std::string &name) override
 
std::unique_ptr< const genericStatgetStat () override
 
std::unique_ptr< ioHandle::attrDataTypegetAttrData (const outputHandler::base *aOutputHandler) override
 get attributes in the optimal way for setting with aOutputHandler More...
 
- Public Member Functions inherited from gpfsIoCommon
 gpfsIoCommon (const std::string &aPath)
 
 ~gpfsIoCommon () override=default
 
std::unique_ptr< ioHandle::attrDataTypegetAttrData (const outputHandler::base *aOutputHandler) override
 get attributes in the optimal way for setting with aOutputHandler More...
 
std::unique_ptr< acl::listgetAclData () override
 get acls More...
 

Additional Inherited Members

- Static Public Member Functions inherited from gpfsIoCommon
static std::unique_ptr< acl::listaclFromGpfs (const gpfs_acl_handler &acl, const std::string &aPath)
 
- Protected Member Functions inherited from inputHandler::base::reader
 reader (const genericStat &inititalStat)
 
- Protected Member Functions inherited from unwindCheck
 unwindCheck ()=default
 
 ~unwindCheck ()=default
 
bool isUnwinding () const
 
- Protected Member Functions inherited from ioHandle
 ioHandle ()
 
virtual ~ioHandle () noexcept(false)
 
virtual size_t getBlockSize () const
 
virtual void setBlockSize (size_t newSize)
 
- Protected Member Functions inherited from gpfsIoCommon
void releaseUsedBlocks (size_t aBlockSize)
 
void handleParallelUsedBlocks (size_t aBlockSize, off_t offset)
 
- Protected Attributes inherited from inputHandler::posixFile::readerPosixFile
std::deque< regionTyperegions
 
- Protected Attributes inherited from inputHandler::base::reader
const genericStatreadInitialStat
 stat at beginning, needed for unchngedness check More...
 
std::remove_const< decltype(readInitialStat.size)>::type totalBytesRead = 0
 number of bytes read so far, needed for check on growing files More...
 
- Protected Attributes inherited from ioHandle
size_t blockSize
 in bytes, block size to be used when reading or writing More...
 
- Protected Attributes inherited from posixFileIoCommon
const std::string & path
 
int fd = -1
 
- Protected Attributes inherited from gpfsIoCommon
off_t leastRecentlyAccessedBlock
 
off_t leastRecentlyReleasedBlock
 
std::bitset< 64 > usedBlockMap
 
std::bitset< 64 > nextUsedBlockMap
 
std::mutex blockBookkeepingMutex
 

Detailed Description

Definition at line 17 of file inputHandlerGpfs.h.

Constructor & Destructor Documentation

◆ readerGpfs()

inputHandler::Gpfs::readerGpfs::readerGpfs ( const std::string &  aPath,
copyRequest::stateType state,
const genericStat inititalStat 
)

Definition at line 27 of file inputHandlerGpfs.cpp.

29  :
30  posixFileIoCommon(aPath),
31  gpfsIoCommon(aPath),
32  posixFile::readerPosixFile(aPath, state, inititalStat) {
33  if (fd != -1 && useRange) { // we have an open file
34  gpfs_fcntl_handler fcntl;
35  auto& range = fcntl.buffer.add<gpfsAccessRange_t>(GPFS_ACCESS_RANGE);
36  range.start = 0;
37  range.length = inititalStat.size;
38  range.isWrite = 0;
39  timerInst(gpfsAccessRange);
40  fcntl.call(fd, path);
41  }
42  }

References gpfs_fcntl_handler::buffer, gpfs_fcntl_handler::call(), posixFileIoCommon::fd, posixFileIoCommon::path, genericStat::size, timerInst, and inputHandler::useRange.

Here is the call graph for this function:

◆ ~readerGpfs()

inputHandler::Gpfs::readerGpfs::~readerGpfs ( )
override

Definition at line 43 of file inputHandlerGpfs.cpp.

43  {
44  if (fd != -1 && doClearCache) { // we have an open file
45  gpfs_fcntl_handler fcntl;
46  fcntl.buffer.add<gpfsClearFileCache_t>(GPFS_CLEAR_FILE_CACHE);
47  timerInst(gpfsClearFileCache);
48  fcntl.call(fd, path);
49  }
50  }

References gpfs_fcntl_handler::buffer, gpfs_fcntl_handler::call(), inputHandler::doClearCache, and timerInst.

Here is the call graph for this function:

Member Function Documentation

◆ readBlock()

bool inputHandler::Gpfs::readerGpfs::readBlock ( block b)
overridevirtual

read one block from the file

Returns
true if the last block was read, false if more to follow
Exceptions
std::system_errorif read fails
delayAdvisingErrorif file changes during reading

Implements inputHandler::base::reader.

Definition at line 58 of file inputHandlerGpfs.cpp.

58  {
59  auto lastblock = readerPosixFile::readBlock(b);
60  // we read sequentially anyway so keep tracking simple
62  if (freeRange) {
64  }
65  return lastblock;
66  };

References inputHandler::freeRange, block::max_size(), block::offset(), and inputHandler::posixFile::readerPosixFile::readBlock().

Here is the call graph for this function:

◆ readBlockP()

void inputHandler::Gpfs::readerGpfs::readBlockP ( block ,
size_t  ,
off_t   
)
overridevirtual

read one block from the file, starting at offset.

meant for pparallel reading, often not implemented only for non-sparse files

Exceptions
std::system_errorif read fails
delayAdvisingErrorif file changes during reading
std::logic_errorif attempted on sparse file

Reimplemented from inputHandler::base::reader.

Definition at line 67 of file inputHandlerGpfs.cpp.

67  {
68  readerPosixFile::readBlockP(b, bytesToRead, offset);
69  if (freeRange) {
70  handleParallelUsedBlocks(b.max_size(), offset);
71  }
72  };

References inputHandler::freeRange, block::max_size(), and inputHandler::posixFile::readerPosixFile::readBlockP().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
inputHandler::posixFile::readerPosixFile::readBlock
bool readBlock(block &b) override
read one block from the file
Definition: inputHandlerPosixFile.cpp:154
gpfsIoCommon::handleParallelUsedBlocks
void handleParallelUsedBlocks(size_t aBlockSize, off_t offset)
Definition: gpfsCommon.cpp:26
inputHandler::posixFile::readerPosixFile::readBlockP
void readBlockP(block &b, size_t bytesToRead, off_t offset) override
read one block from the file, starting at offset.
Definition: inputHandlerPosixFile.cpp:226
block::max_size
size_t max_size() const
Definition: block.h:22
inputHandler::useRange
static options::single< bool > useRange('\0', "gpfsInUseRange", "use range hint in gpfs input", false)
block::offset
size_t offset() const
Definition: block.h:25
gpfsIoCommon::releaseUsedBlocks
void releaseUsedBlocks(size_t aBlockSize)
Definition: gpfsCommon.cpp:14
posixFileIoCommon::fd
int fd
Definition: posixFileCommon.h:21
gpfs_fcntl_handler
class for handling gpfs_fcnt calls with their very special parameter handling
Definition: gpfsFcntlHandler.h:6
posixFileIoCommon::gpfsIoCommon
friend class gpfsIoCommon
Definition: posixFileCommon.h:18
genericStat::size
size_t size
Definition: genericStat.h:16
gpfs_fcntl_handler::buffer
union gpfs_fcntl_handler::@2 buffer
inputHandler::freeRange
static options::single< bool > freeRange('\0', "gpfsInFreeRange", "use range free in gpfs input", false)
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
gpfs_fcntl_handler::call
void call(int fd, const std::string &path)
Definition: gpfsFcntlHandler.cpp:15
posixFileIoCommon::posixFileIoCommon
posixFileIoCommon(const std::string &aPath)
Definition: posixFileCommon.cpp:110
inputHandler::doClearCache
static options::single< bool > doClearCache('\0', "gpfsInClearCache", "clear cache in gpfs input", false)
gpfsIoCommon::leastRecentlyAccessedBlock
off_t leastRecentlyAccessedBlock
Definition: gpfsCommon.h:10
posixFileIoCommon::path
const std::string & path
Definition: posixFileCommon.h:20