ewmscp  ..
Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
outputHandler::Gpfs::writerGpfs Class Reference

#include <outputHandlerGpfs.h>

Inheritance diagram for outputHandler::Gpfs::writerGpfs:
[legend]
Collaboration diagram for outputHandler::Gpfs::writerGpfs:
[legend]

Public Member Functions

 writerGpfs (const std::string &aPath, bool mightAppend, size_t sourceSize, size_t readBlockSize, copyRequest::stateType &state, bool noWrite, std::unique_ptr< ioHandle::attrDataType > attrData, std::unique_ptr< acl::list > aAclData)
 
 writerGpfs (std::string &aPath, size_t sourceSize, bool noWrite, std::unique_ptr< ioHandle::attrDataType > aAttrData, std::unique_ptr< acl::list > aAclData, base &handler)
 
 ~writerGpfs () noexcept(false) override
 
void writeBlock (const block &b) override
 
void writeBlockP (const block &b) override
 
- 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...
 
- 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 ioHandle
 ioHandle ()
 
virtual ~ioHandle () noexcept(false)
 
virtual bool parallelizable () const
 tell if this handler is capable of parallel IO. Unsually not the case More...
 
virtual size_t getBlockSize () const
 
virtual void setBlockSize (size_t newSize)
 

Private Member Functions

void doSpecialFdHandling (size_t sourceSize)
 
void setAclData ()
 

Static Private Attributes

static options::single< bool > usePreallocate
 

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 gpfsIoCommon
void releaseUsedBlocks (size_t aBlockSize)
 
void handleParallelUsedBlocks (size_t aBlockSize, off_t offset)
 
- Protected Attributes inherited from gpfsIoCommon
off_t leastRecentlyAccessedBlock
 
off_t leastRecentlyReleasedBlock
 
std::bitset< 64 > usedBlockMap
 
std::bitset< 64 > nextUsedBlockMap
 
std::mutex blockBookkeepingMutex
 
- Protected Attributes inherited from posixFileIoCommon
const std::string & path
 
int fd = -1
 
- Protected Attributes inherited from ioHandle
size_t blockSize
 in bytes, block size to be used when reading or writing More...
 

Detailed Description

Definition at line 12 of file outputHandlerGpfs.h.

Constructor & Destructor Documentation

◆ writerGpfs() [1/2]

outputHandler::Gpfs::writerGpfs::writerGpfs ( const std::string &  aPath,
bool  mightAppend,
size_t  sourceSize,
size_t  readBlockSize,
copyRequest::stateType state,
bool  noWrite,
std::unique_ptr< ioHandle::attrDataType attrData,
std::unique_ptr< acl::list aAclData 
)

Definition at line 74 of file outputHandlerGpfs.cpp.

81  :
82  posixFileIoCommon(aPath),
83  gpfsIoCommon(aPath),
84  writerPosixFile(aPath, mightAppend, sourceSize, readBlockSize, state, noWrite,
85  std::move(aAttrData),
86  std::move(aAclData)) {
87  doSpecialFdHandling(sourceSize);
88  };

References doSpecialFdHandling().

Here is the call graph for this function:

◆ writerGpfs() [2/2]

outputHandler::Gpfs::writerGpfs::writerGpfs ( std::string &  aPath,
size_t  sourceSize,
bool  noWrite,
std::unique_ptr< ioHandle::attrDataType aAttrData,
std::unique_ptr< acl::list aAclData,
base handler 
)

Definition at line 90 of file outputHandlerGpfs.cpp.

95  :
96  posixFileIoCommon(aPath),
97  gpfsIoCommon(aPath),
98  writerPosixFile(aPath, noWrite, std::move(aAttrData), std::move(aAclData),handler) {
99  doSpecialFdHandling(sourceSize);
100  };

References doSpecialFdHandling().

Here is the call graph for this function:

◆ ~writerGpfs()

outputHandler::Gpfs::writerGpfs::~writerGpfs ( )
overridenoexcept

Definition at line 102 of file outputHandlerGpfs.cpp.

102  {
103  if (isUnwinding()) {
104  return;
105  }
106  if (fd != -1) {
107  if (aclData) {
108  setAclData();
109  }
110  if (doClearCache) {
111  gpfs_fcntl_handler fcntl;
112  fcntl.buffer.add<gpfsClearFileCache_t>(GPFS_CLEAR_FILE_CACHE);
113  timerInst(gpfsClearFileCache);
114  fcntl.call(fd, path);
115  }
116  }
117  }

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

Here is the call graph for this function:

Member Function Documentation

◆ doSpecialFdHandling()

void outputHandler::Gpfs::writerGpfs::doSpecialFdHandling ( size_t  sourceSize)
private

Definition at line 51 of file outputHandlerGpfs.cpp.

51  {
52  if (fd != -1) {
53  if (usePreallocate) {
54  //calculate size which uses entire blocks
55  auto truncatedSize = (sourceSize / getBlockSize()) * getBlockSize();
56  if (truncatedSize > 0) {
57  timerInst(gpfs_prealloc);
58  throwcall::good0(gpfs_prealloc(fd, 0, truncatedSize),
59  "can't gpfs_prealloc ", truncatedSize, " bytes for ", path);
60  }
61  }
62  if (useRange) {
63  gpfs_fcntl_handler fcntl;
64  auto& range = fcntl.buffer.add<gpfsAccessRange_t>(GPFS_ACCESS_RANGE);
65  range.start = 0;
66  range.length = sourceSize;
67  range.isWrite = 1;
68  timerInst(gpfsAccessRange);
69  fcntl.call(fd, path);
70  }
71  }
72  }

References gpfs_fcntl_handler::buffer, gpfs_fcntl_handler::call(), posixFileIoCommon::fd, ioHandle::getBlockSize(), throwcall::good0(), posixFileIoCommon::path, timerInst, usePreallocate, and outputHandler::useRange.

Referenced by writerGpfs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAclData()

void outputHandler::Gpfs::writerGpfs::setAclData ( )
private

Definition at line 134 of file outputHandlerGpfs.cpp.

134  {
135  gpfs_acl_handler aclHandler(aclData->entries.size());
136 
137  auto gpfs_ace = aclHandler.begin();
138  for (const auto& rich_ace : aclData->entries) {
139  gpfs_ace->aceType = rich_ace.isAllowedType() ? ACE4_TYPE_ALLOW : ACE4_TYPE_DENY;
140  gpfs_ace->aceFlags = rich_ace.getFlagBits() & (ACE4_FLAG_FILE_INHERIT |
141  ACE4_FLAG_DIR_INHERIT |
142  ACE4_FLAG_NO_PROPAGATE |
143  ACE4_FLAG_INHERIT_ONLY |
144  ACE4_FLAG_GROUP_ID |
145  ACE4_FLAG_INHERITED);
146  gpfs_ace->aceIFlags = 0;
147  gpfs_ace->aceMask = rich_ace.getMaskBits();
148  if (rich_ace.isFlagSet(acl::list::entryType::flagsType::special_who)) {
149  gpfs_ace->aceIFlags = ACE4_IFLAG_SPECIAL_ID;
150  switch (rich_ace.e_id) {
151  case acl::list::entryType::specialIdType::owner_special_id:
152  gpfs_ace->aceWho = ACE4_SPECIAL_OWNER;
153  break;
154  case acl::list::entryType::specialIdType::group_special_id:
155  gpfs_ace->aceWho = ACE4_SPECIAL_GROUP;
156  break;
157  case acl::list::entryType::specialIdType::everyone_special_id:
158  gpfs_ace->aceWho = ACE4_SPECIAL_EVERYONE;
159  break;
160  default:
161  throw std::runtime_error("illegal special id");
162  }
163  } else {
164  gpfs_ace->aceWho = rich_ace.e_id;
165  }
166  gpfs_ace++;
167  }
168  aclHandler.set(fd, path);
169  }

References gpfs_acl_handler::begin(), gpfs_acl_handler::set(), and acl::list::entryType::special_who.

Here is the call graph for this function:

◆ writeBlock()

void outputHandler::Gpfs::writerGpfs::writeBlock ( const block b)
override

Definition at line 119 of file outputHandlerGpfs.cpp.

119  {
122  if (freeRange) {
124  }
125  }

References outputHandler::freeRange, block::max_size(), block::offset(), and outputHandler::posixFile::writerPosixFile::writeBlock().

Here is the call graph for this function:

◆ writeBlockP()

void outputHandler::Gpfs::writerGpfs::writeBlockP ( const block b)
override

Definition at line 127 of file outputHandlerGpfs.cpp.

127  {
129  if (freeRange) {
131  }
132  }

References outputHandler::freeRange, block::max_size(), block::offset(), and outputHandler::posixFile::writerPosixFile::writeBlockP().

Here is the call graph for this function:

Member Data Documentation

◆ usePreallocate

options::single<bool> outputHandler::Gpfs::writerGpfs::usePreallocate
staticprivate

Definition at line 13 of file outputHandlerGpfs.h.

Referenced by doSpecialFdHandling().


The documentation for this class was generated from the following files:
gpfsIoCommon::handleParallelUsedBlocks
void handleParallelUsedBlocks(size_t aBlockSize, off_t offset)
Definition: gpfsCommon.cpp:26
block::max_size
size_t max_size() const
Definition: block.h:22
outputHandler::doClearCache
static options::single< bool > doClearCache('\0', "gpfsOutClearCache", "clear cache in gpfs output", false)
block::offset
size_t offset() const
Definition: block.h:25
outputHandler::Gpfs::writerGpfs::usePreallocate
static options::single< bool > usePreallocate
Definition: outputHandlerGpfs.h:13
outputHandler::posixFile::writerPosixFile::writeBlockP
void writeBlockP(const block &b) override
Definition: outputHandlerPosixFile.cpp:394
gpfsIoCommon::releaseUsedBlocks
void releaseUsedBlocks(size_t aBlockSize)
Definition: gpfsCommon.cpp:14
acl::list::entryType::flagsType::special_who
@ special_who
posixFileIoCommon::fd
int fd
Definition: posixFileCommon.h:21
gpfs_acl_handler
class for handling non-opaque gpfs acls
Definition: gpfsFcntlHandler.h:33
ioHandle::getBlockSize
virtual size_t getBlockSize() const
Definition: ioHandle.h:58
outputHandler::useRange
static options::single< bool > useRange('\0', "gpfsOutUseRange", "use range hint in gpfs output", false)
gpfs_fcntl_handler
class for handling gpfs_fcnt calls with their very special parameter handling
Definition: gpfsFcntlHandler.h:6
outputHandler::posixFile::writerPosixFile::writeBlock
void writeBlock(const block &b) override
Definition: outputHandlerPosixFile.cpp:358
posixFileIoCommon::gpfsIoCommon
friend class gpfsIoCommon
Definition: posixFileCommon.h:18
outputHandler::freeRange
static options::single< bool > freeRange('\0', "gpfsOutFreeRange", "use range free in gpfs output", false)
gpfs_fcntl_handler::buffer
union gpfs_fcntl_handler::@2 buffer
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
gpfs_fcntl_handler::call
void call(int fd, const std::string &path)
Definition: gpfsFcntlHandler.cpp:15
outputHandler::Gpfs::writerGpfs::doSpecialFdHandling
void doSpecialFdHandling(size_t sourceSize)
Definition: outputHandlerGpfs.cpp:51
throwcall::good0
void good0(T call, const Args &... args)
template function to wrap system calls that return 0 on success
Definition: throwcall.h:40
outputHandler::Gpfs::writerGpfs::setAclData
void setAclData()
Definition: outputHandlerGpfs.cpp:134
posixFileIoCommon::posixFileIoCommon
posixFileIoCommon(const std::string &aPath)
Definition: posixFileCommon.cpp:110
gpfsIoCommon::leastRecentlyAccessedBlock
off_t leastRecentlyAccessedBlock
Definition: gpfsCommon.h:10
posixFileIoCommon::path
const std::string & path
Definition: posixFileCommon.h:20