CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
TStorageFactoryFile Class Reference

#include <TStorageFactoryFile.h>

Inheritance diagram for TStorageFactoryFile:

Public Member Functions

 ClassDefOverride (TStorageFactoryFile, 0)
 
Bool_t ReadBuffer (char *buf, Int_t len) override
 
Bool_t ReadBuffer (char *buf, Long64_t pos, Int_t len) override
 
Bool_t ReadBufferAsync (Long64_t off, Int_t len) override
 
Bool_t ReadBuffers (char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) override
 
void ResetErrno (void) const override
 
 TStorageFactoryFile (const char *name, Option_t *option, const char *ftitle, Int_t compress, Int_t netopt, Bool_t parallelopen=kFALSE)
 
 TStorageFactoryFile (const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1)
 
Bool_t WriteBuffer (const char *buf, Int_t len) override
 
 ~TStorageFactoryFile (void) override
 

Protected Member Functions

Int_t SysClose (Int_t fd) override
 
Int_t SysOpen (const char *pathname, Int_t flags, UInt_t mode) override
 
Long64_t SysSeek (Int_t fd, Long64_t offset, Int_t whence) override
 
Int_t SysStat (Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime) override
 
Int_t SysSync (Int_t fd) override
 

Private Member Functions

void Initialize (const char *name, Option_t *option="")
 
Bool_t ReadBuffersSync (char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
 
void releaseStorage ()
 
 TStorageFactoryFile (void)
 

Private Attributes

edm::propagate_const< std::unique_ptr< Storage > > storage_
 

Detailed Description

TFile wrapper around StorageFactory and Storage.

Definition at line 15 of file TStorageFactoryFile.h.

Constructor & Destructor Documentation

TStorageFactoryFile::TStorageFactoryFile ( const char *  name,
Option_t *  option,
const char *  ftitle,
Int_t  compress,
Int_t  netopt,
Bool_t  parallelopen = kFALSE 
)

Definition at line 105 of file TStorageFactoryFile.cc.

References Initialize(), and edm::threadLocalException::setException().

111  : TFile(path, "NET", ftitle, compress), // Pass "NET" to prevent local access in base class
112  storage_() {
113  try {
115  } catch (...) {
116  edm::threadLocalException::setException(std::current_exception()); // capture
117  }
118 }
edm::propagate_const< std::unique_ptr< Storage > > storage_
void setException(std::exception_ptr e)
void Initialize(const char *name, Option_t *option="")
TStorageFactoryFile::TStorageFactoryFile ( const char *  name,
Option_t *  option = "",
const char *  ftitle = "",
Int_t  compress = 1 
)

Definition at line 120 of file TStorageFactoryFile.cc.

References Initialize(), and edm::threadLocalException::setException().

124  : TFile(path, "NET", ftitle, compress), // Pass "NET" to prevent local access in base class
125  storage_() {
126  try {
128  } catch (...) {
129  edm::threadLocalException::setException(std::current_exception()); // capture
130  }
131 }
edm::propagate_const< std::unique_ptr< Storage > > storage_
void setException(std::exception_ptr e)
void Initialize(const char *name, Option_t *option="")
TStorageFactoryFile::~TStorageFactoryFile ( void  )
override

Definition at line 215 of file TStorageFactoryFile.cc.

215 { Close(); }
TStorageFactoryFile::TStorageFactoryFile ( void  )
private

Definition at line 96 of file TStorageFactoryFile.cc.

References StorageAccount::construct, storageCounter(), and StorageAccount::Stamp::tick().

Referenced by releaseStorage().

96  : storage_() {
98  stats.tick(0);
99 }
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsCtor

Member Function Documentation

TStorageFactoryFile::ClassDefOverride ( TStorageFactoryFile  ,
 
)
void TStorageFactoryFile::Initialize ( const char *  name,
Option_t *  option = "" 
)
private

Definition at line 133 of file TStorageFactoryFile.cc.

References edm::Exception::categoryCode(), StorageAccount::construct, beamerCreator::create(), MillePedeFileConverter_cfg::e, Exception, StorageFactory::get(), edm::Service< T >::isAvailable(), edm::errors::NotFound, IOFlags::OpenCreate, IOFlags::OpenRead, IOFlags::OpenWrap, IOFlags::OpenWrite, TSGForRoadSearch_cfi::option, callgraph::path, edm::storage::StatisticsSenderService::setSize(), storage_, storageCounter(), StorageAccount::Stamp::tick(), and update.

Referenced by TStorageFactoryFile().

133  {
135 
136  // Enable AsyncReading.
137  // This was the default for 5.27, but turned off by default for 5.32.
138  // In our testing, AsyncReading is the fastest mechanism available.
139  // In 5.32, the AsyncPrefetching mechanism is preferred, but has been a
140  // performance hit in our "average case" tests.
141  gEnv->SetValue("TFile.AsyncReading", 1);
142 
143  // Parse options; at the moment we only accept read!
144  fOption = option;
145  fOption.ToUpper();
146 
147  if (fOption == "NEW")
148  fOption = "CREATE";
149 
150  Bool_t create = (fOption == "CREATE");
151  Bool_t recreate = (fOption == "RECREATE");
152  Bool_t update = (fOption == "UPDATE");
153  Bool_t read = (fOption == "READ") || (fOption == "READWRAP");
154  Bool_t readwrap = (fOption == "READWRAP");
155 
156  if (!create && !recreate && !update && !read) {
157  read = true;
158  fOption = "READ";
159  }
160 
161  if (recreate) {
162  if (!gSystem->AccessPathName(path, kFileExists))
163  gSystem->Unlink(path);
164 
165  recreate = false;
166  create = true;
167  fOption = "CREATE";
168  }
169  assert(!recreate);
170 
171  if (update && gSystem->AccessPathName(path, kFileExists)) {
172  update = kFALSE;
173  create = kTRUE;
174  }
175 
176  assert(read || update || create);
177 
178  int openFlags = IOFlags::OpenRead;
179  if (!read)
180  openFlags |= IOFlags::OpenWrite;
181  if (create)
182  openFlags |= IOFlags::OpenCreate;
183  //if (recreate) openFlags |= IOFlags::OpenCreate | IOFlags::OpenTruncate;
184  if (readwrap)
185  openFlags |= IOFlags::OpenWrap;
186 
187  // Open storage
188  if (!(storage_ = StorageFactory::get()->open(path, openFlags))) {
189  MakeZombie();
190  gDirectory = gROOT;
191  throw cms::Exception("TStorageFactoryFile::TStorageFactoryFile()") << "Cannot open file '" << path << "'";
192  }
193 
194  // Record the statistics.
195  try {
197  if (statsService.isAvailable()) {
198  statsService->setSize(storage_->size());
199  }
200  } catch (edm::Exception const &e) {
201  if (e.categoryCode() != edm::errors::NotFound) {
202  throw;
203  }
204  }
205 
206  fRealName = path;
207  fD = 0; // sorry, meaningless
208  fWritable = read ? kFALSE : kTRUE;
209 
210  Init(create);
211 
212  stats.tick(0);
213 }
Code categoryCode() const
Definition: EDMException.h:96
def create(alignables, pedeDump, additionalData, outputFile, config)
edm::propagate_const< std::unique_ptr< Storage > > storage_
static const StorageFactory * get(void)
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsCtor
bool isAvailable() const
Definition: Service.h:40
#define update(a, b)
Bool_t TStorageFactoryFile::ReadBuffer ( char *  buf,
Int_t  len 
)
override

Definition at line 228 of file TStorageFactoryFile.cc.

References EnergyCorrector::c, gen::n, StorageAccount::read, StorageAccount::readActual, StorageAccount::readPrefetchToCache, StorageAccount::readViaCache, storage_, storageCounter(), and StorageAccount::Stamp::tick().

Referenced by ReadBuffer().

228  {
229  // Check that it's valid to access this file.
230  if (IsZombie()) {
231  Error("ReadBuffer", "Cannot read from a zombie file");
232  return kTRUE;
233  }
234 
235  if (!IsOpen()) {
236  Error("ReadBuffer", "Cannot read from a file that is not open");
237  return kTRUE;
238  }
239 
240  // Read specified byte range from the storage. Returns kTRUE in
241  // case of error. Note that ROOT uses this function recursively
242  // to fill the cache; we use a flag to make sure our accounting
243  // is reflected in a comprehensible manner. The "read" counter
244  // will include both, "readc" indicates how much read from the
245  // cache, "readu" indicates how much we failed to read from the
246  // cache (excluding those recursive reads), and "readx" counts
247  // the amount actually passed to read from the storage object.
249 
250  // If we have a cache, read from there first. This returns 0
251  // if the block hasn't been prefetched, 1 if it was in cache,
252  // and 2 if there was an error.
253  if (TFileCacheRead *c = GetCacheRead()) {
254  Long64_t here = GetRelOffset();
255  Bool_t async = c->IsAsyncReading();
256 
257  StorageAccount::Stamp cstats(async
260 
261  Int_t st = ReadBufferViaCache(async ? nullptr : buf, len);
262 
263  if (st == 2) {
264  Error("ReadBuffer",
265  "ReadBufferViaCache failed. Asked to read nBytes: %d from offset: %lld with file size: %lld",
266  len,
267  here,
268  GetSize());
269  return kTRUE;
270  }
271 
272  if (st == 1) {
273  if (async) {
274  cstats.tick(len);
275  Seek(here);
276  } else {
277  cstats.tick(len);
278  stats.tick(len);
279  return kFALSE;
280  }
281  }
282  }
283 
284  // FIXME: Re-enable read-ahead if the data wasn't in cache.
285  // if (! st) storage_->caching(true, -1, s_readahead);
286 
287  // A real read
289  IOSize n = storage_->xread(buf, len);
290  xstats.tick(n);
291  stats.tick(n);
292  if (n < static_cast<IOSize>(len)) {
293  Error("ReadBuffer",
294  "read from Storage::xread returned %ld. Asked to read n bytes: %d from offset: %lld with file size: %lld",
295  n,
296  len,
297  GetRelOffset(),
298  GetSize());
299  }
300  return n ? kFALSE : kTRUE;
301 }
edm::ErrorSummaryEntry Error
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsRead
static StorageAccount::Counter * s_statsXRead
size_t IOSize
Definition: IOTypes.h:14
static StorageAccount::Counter * s_statsCPrefetch
static StorageAccount::Counter * s_statsCRead
Bool_t TStorageFactoryFile::ReadBuffer ( char *  buf,
Long64_t  pos,
Int_t  len 
)
override

Definition at line 221 of file TStorageFactoryFile.cc.

References ReadBuffer().

221  {
222  // This function needs to be optimized to minimize seeks.
223  // See TFile::ReadBuffer(char *buf, Long64_t pos, Int_t len) in ROOT 5.27.06.
224  Seek(pos);
225  return ReadBuffer(buf, len);
226 }
Bool_t ReadBuffer(char *buf, Int_t len) override
Bool_t TStorageFactoryFile::ReadBufferAsync ( Long64_t  off,
Int_t  len 
)
override

Definition at line 303 of file TStorageFactoryFile.cc.

References StorageFactory::CACHE_HINT_APPLICATION, StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, StorageFactory::get(), PREFETCH_PROBE_LENGTH, StorageAccount::readAsync, storage_, storageCounter(), and StorageAccount::Stamp::tick().

303  {
304  // Check that it's valid to access this file.
305  if (IsZombie()) {
306  Error("ReadBufferAsync", "Cannot read from a zombie file");
307  return kTRUE;
308  }
309 
310  if (!IsOpen()) {
311  Error("ReadBufferAsync", "Cannot read from a file that is not open");
312  return kTRUE;
313  }
314 
316 
317  // If asynchronous reading is disabled, bail out now, regardless
318  // whether the underlying storage supports prefetching. If it is
319  // forced on, pretend it's on, even if the storage doesn't support
320  // it, as this turns off the caching in ROOT's side.
322 
323  // Verify that we never using async reads in app-only mode
325  return kTRUE;
326 
327  // Let the I/O method indicate if it can do client-side prefetch.
328  // If it does, then for example TTreeCache will drop its own cache
329  // and will use the client-side cache of the actual I/O layer.
330  // If len is zero ROOT is probing for prefetch support.
331  if (len) {
332  // FIXME: Synchronise caching.
333  // storage_->caching(true, -1, 0);
334  ;
335  }
336 
337  IOPosBuffer iov(off, (void *)nullptr, len ? len : PREFETCH_PROBE_LENGTH);
338  if (storage_->prefetch(&iov, 1)) {
339  stats.tick(len);
340  return kFALSE;
341  }
342 
343  // Always ask ROOT to use async reads in storage-only mode,
344  // regardless of whether the storage system supports it.
346  return kFALSE;
347 
348  // Prefetching not available right now.
349  return kTRUE;
350 }
edm::ErrorSummaryEntry Error
CacheHint cacheHint(void) const
#define PREFETCH_PROBE_LENGTH
Definition: Storage.h:18
edm::propagate_const< std::unique_ptr< Storage > > storage_
static const StorageFactory * get(void)
static StorageAccount::Counter * s_statsARead
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
double f[11][100]
Bool_t TStorageFactoryFile::ReadBuffers ( char *  buf,
Long64_t *  pos,
Int_t *  len,
Int_t  nbuf 
)
override

Definition at line 419 of file TStorageFactoryFile.cc.

References mps_fire::i, StorageAccount::readAsync, ReadBuffersSync(), storage_, storageCounter(), summarizeEdmComparisonLogfiles::success, StorageAccount::Stamp::tick(), and pileupDistInMC::total.

419  {
420  // Check that it's valid to access this file.
421  if (IsZombie()) {
422  Error("ReadBuffers", "Cannot read from a zombie file");
423  return kTRUE;
424  }
425 
426  if (!IsOpen()) {
427  Error("ReadBuffers", "Cannot read from a file that is not open");
428  return kTRUE;
429  }
430 
431  // For synchronous reads, we have special logic to optimize the I/O requests
432  // from ROOT before handing it to the storage.
433  if (buf) {
434  return ReadBuffersSync(buf, pos, len, nbuf);
435  }
436  // For an async read, we assume the storage system is smart enough to do the
437  // optimization itself.
438 
439  // Read from underlying storage.
440  void *const nobuf = nullptr;
441  Int_t total = 0;
442  std::vector<IOPosBuffer> iov;
443  iov.reserve(nbuf);
444  for (Int_t i = 0; i < nbuf; ++i) {
445  iov.push_back(IOPosBuffer(pos[i], nobuf, len[i]));
446  total += len[i];
447  }
448 
449  // Null buffer means asynchronous reads into I/O system's cache.
450  bool success;
452  // Synchronise low-level cache with the supposed cache in TFile.
453  // storage_->caching(true, -1, 0);
454  success = storage_->prefetch(&iov[0], nbuf);
455  astats.tick(total);
456 
457  // If it didn't suceeed, pass down to the base class.
458  if (not success) {
459  if (TFile::ReadBuffers(buf, pos, len, nbuf)) {
460  Error("ReadBuffers", "call to TFile::ReadBuffers failed after prefetch already failed.");
461  return kTRUE;
462  }
463  }
464  return kFALSE;
465 }
edm::ErrorSummaryEntry Error
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter * s_statsARead
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
Bool_t ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Bool_t TStorageFactoryFile::ReadBuffersSync ( char *  buf,
Long64_t *  pos,
Int_t *  len,
Int_t  nbuf 
)
private

Most storage systems are not prepared for the onslaught of small reads that ROOT will perform, even if they implement a vectored read interface.

Typically, on the server side, the loop is unrolled and the reads are issued sequentially - giving the OS no hint that you're about to read a very close-by byte in the near future. Normally, OS read-ahead takes care of such situations; because the storage server has so many clients, and ROOT reads look random to the OS, the read-ahead becomes disabled.

Hence, this function will repack the application-layer request into an optimized storage-layer request. The resulting request to the storage layer typically has a slightly larger number of bytes, but far less individual reads.

On average, the server's disks see a smaller number of overall reads, the number of bytes transferred over the network increases modestly (around 10%), and the single application request becomes one-to-two I/O transactions. A clear win for all cases except high-latency WAN.

Definition at line 352 of file TStorageFactoryFile.cc.

References ReadRepacker::bufferUsed(), mps_fire::i, ReadRepacker::iov(), ReadRepacker::pack(), StorageAccount::readActual, ReadRepacker::realBytesProcessed(), mps_fire::result, storage_, storageCounter(), StorageAccount::Stamp::tick(), and ReadRepacker::unpack().

Referenced by ReadBuffers().

352  {
373  Int_t remaining = nbuf; // Number of read requests left to process.
374  Int_t pack_count; // Number of read requests processed by this iteration.
375 
376  IOSize remaining_buffer_size = 0;
377  // Calculate the remaining buffer size for the ROOT-owned buffer by adding
378  // the size of the various requests.
379  for (Int_t i = 0; i < nbuf; i++)
380  remaining_buffer_size += len[i];
381 
382  char *current_buffer = buf;
383  Long64_t *current_pos = pos;
384  Int_t *current_len = len;
385 
386  ReadRepacker repacker;
387 
388  while (remaining > 0) {
389  pack_count = repacker.pack(
390  static_cast<long long int *>(current_pos), current_len, remaining, current_buffer, remaining_buffer_size);
391 
392  int real_bytes_processed = repacker.realBytesProcessed();
393  IOSize io_buffer_used = repacker.bufferUsed();
394 
395  // Issue readv, then unpack buffers.
397  std::vector<IOPosBuffer> &iov = repacker.iov();
398  IOSize result = storage_->readv(&iov[0], iov.size());
399  if (result != io_buffer_used) {
400  Error(
401  "ReadBuffersSync", "Storage::readv returned different size result=%ld expected=%ld", result, io_buffer_used);
402  return kTRUE;
403  }
404  xstats.tick(io_buffer_used);
405  repacker.unpack(current_buffer);
406 
407  // Update the location of the unused part of the input buffer.
408  remaining_buffer_size -= real_bytes_processed;
409  current_buffer += real_bytes_processed;
410 
411  current_pos += pack_count;
412  current_len += pack_count;
413  remaining -= pack_count;
414  }
415  assert(remaining_buffer_size == 0);
416  return kFALSE;
417 }
edm::ErrorSummaryEntry Error
edm::propagate_const< std::unique_ptr< Storage > > storage_
IOSize realBytesProcessed() const
Definition: ReadRepacker.h:52
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
int pack(long long int *pos, int *len, int nbuf, char *buf, IOSize buffer_size)
Definition: ReadRepacker.cc:21
void unpack(char *buf)
static StorageAccount::Counter * s_statsXRead
IOSize bufferUsed() const
Definition: ReadRepacker.h:47
std::vector< IOPosBuffer > & iov()
Definition: ReadRepacker.h:45
size_t IOSize
Definition: IOTypes.h:14
void TStorageFactoryFile::releaseStorage ( )
inlineprivate

Definition at line 56 of file TStorageFactoryFile.h.

References edm::get_underlying_safe(), storage_, and TStorageFactoryFile().

Referenced by SysClose().

56 { get_underlying_safe(storage_).release(); }
edm::propagate_const< std::unique_ptr< Storage > > storage_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void TStorageFactoryFile::ResetErrno ( void  ) const
override

Definition at line 596 of file TStorageFactoryFile.cc.

596 { TSystem::ResetErrno(); }
Int_t TStorageFactoryFile::SysClose ( Int_t  fd)
overrideprotected

Definition at line 557 of file TStorageFactoryFile.cc.

References StorageAccount::close, releaseStorage(), storage_, storageCounter(), and StorageAccount::Stamp::tick().

557  {
559 
560  if (storage_) {
561  storage_->close();
562  releaseStorage();
563  }
564 
565  stats.tick();
566  return 0;
567 }
static StorageAccount::Counter * s_statsClose
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
Int_t TStorageFactoryFile::SysOpen ( const char *  pathname,
Int_t  flags,
UInt_t  mode 
)
overrideprotected

Definition at line 524 of file TStorageFactoryFile.cc.

References Exception, StorageFactory::get(), O_NONBLOCK, StorageAccount::open, IOFlags::OpenAppend, IOFlags::OpenCreate, IOFlags::OpenExclusive, IOFlags::OpenNonBlock, IOFlags::OpenRead, IOFlags::OpenTruncate, IOFlags::OpenWrite, storage_, storageCounter(), and StorageAccount::Stamp::tick().

524  {
526 
527  if (storage_) {
528  storage_->close();
529  }
530 
531  int openFlags = IOFlags::OpenRead;
532  if (flags & O_WRONLY)
533  openFlags = IOFlags::OpenWrite;
534  else if (flags & O_RDWR)
535  openFlags |= IOFlags::OpenWrite;
536  if (flags & O_CREAT)
537  openFlags |= IOFlags::OpenCreate;
538  if (flags & O_APPEND)
539  openFlags |= IOFlags::OpenAppend;
540  if (flags & O_EXCL)
541  openFlags |= IOFlags::OpenExclusive;
542  if (flags & O_TRUNC)
543  openFlags |= IOFlags::OpenTruncate;
544  if (flags & O_NONBLOCK)
545  openFlags |= IOFlags::OpenNonBlock;
546 
547  if (!(storage_ = StorageFactory::get()->open(pathname, openFlags))) {
548  MakeZombie();
549  gDirectory = gROOT;
550  throw cms::Exception("TStorageFactoryFile::SysOpen()") << "Cannot open file '" << pathname << "'";
551  }
552 
553  stats.tick();
554  return 0;
555 }
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
edm::propagate_const< std::unique_ptr< Storage > > storage_
static const StorageFactory * get(void)
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
#define O_NONBLOCK
Definition: SysFile.h:21
static StorageAccount::Counter * s_statsOpen
Long64_t TStorageFactoryFile::SysSeek ( Int_t  fd,
Long64_t  offset,
Int_t  whence 
)
overrideprotected

Definition at line 569 of file TStorageFactoryFile.cc.

References Storage::CURRENT, Storage::END, PFRecoTauDiscriminationByIsolation_cfi::offset, RefreshWebPage::rel, StorageAccount::seek, Storage::SET, storage_, storageCounter(), and StorageAccount::Stamp::tick().

569  {
571  Storage::Relative rel = (whence == SEEK_SET ? Storage::SET : whence == SEEK_CUR ? Storage::CURRENT : Storage::END);
572 
573  offset = storage_->position(offset, rel);
574  stats.tick();
575  return offset;
576 }
edm::propagate_const< std::unique_ptr< Storage > > storage_
Relative
Definition: Storage.h:23
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsSeek
Int_t TStorageFactoryFile::SysStat ( Int_t  fd,
Long_t *  id,
Long64_t *  size,
Long_t *  flags,
Long_t *  modtime 
)
overrideprotected

Definition at line 585 of file TStorageFactoryFile.cc.

References StorageAccount::stat, storage_, storageCounter(), and StorageAccount::Stamp::tick().

585  {
587  // FIXME: Most of this is unsupported or makes no sense with Storage
588  *id = ::Hash(fRealName);
589  *size = storage_->size();
590  *flags = 0;
591  *modtime = 0;
592  stats.tick();
593  return 0;
594 }
size
Write out results.
static StorageAccount::Counter * s_statsStat
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
std::string Hash
Definition: Types.h:45
Int_t TStorageFactoryFile::SysSync ( Int_t  fd)
overrideprotected

Definition at line 578 of file TStorageFactoryFile.cc.

References StorageAccount::flush, storage_, storageCounter(), and StorageAccount::Stamp::tick().

578  {
580  storage_->flush();
581  stats.tick();
582  return 0;
583 }
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsFlush
Bool_t TStorageFactoryFile::WriteBuffer ( const char *  buf,
Int_t  len 
)
override

Definition at line 467 of file TStorageFactoryFile.cc.

References gen::n, storage_, storageCounter(), StorageAccount::Stamp::tick(), StorageAccount::write, StorageAccount::writeActual, and StorageAccount::writeViaCache.

467  {
468  // Check that it's valid to access this file.
469  if (IsZombie()) {
470  Error("WriteBuffer", "Cannot write to a zombie file");
471  return kTRUE;
472  }
473 
474  if (!IsOpen()) {
475  Error("WriteBuffer", "Cannot write to a file that is not open");
476  return kTRUE;
477  }
478 
479  if (!fWritable) {
480  Error("WriteBuffer", "File is not writable");
481  return kTRUE;
482  }
483 
486 
487  // Try first writing via a cache, and if that's not possible, directly.
488  Int_t st;
489  switch ((st = WriteBufferViaCache(buf, len))) {
490  case 0:
491  // Actual write.
492  {
494  IOSize n = storage_->xwrite(buf, len);
495  xstats.tick(n);
496  stats.tick(n);
497 
498  // FIXME: What if it's a short write?
499  return n > 0 ? kFALSE : kTRUE;
500  }
501 
502  case 1:
503  cstats.tick(len);
504  stats.tick(len);
505  return kFALSE;
506 
507  case 2:
508  default:
509  Error("WriteBuffer", "Error writing to cache");
510  return kTRUE;
511  }
512 }
edm::ErrorSummaryEntry Error
static StorageAccount::Counter * s_statsWrite
static StorageAccount::Counter * s_statsXWrite
edm::propagate_const< std::unique_ptr< Storage > > storage_
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, StorageAccount::Operation operation)
static StorageAccount::Counter * s_statsCWrite
size_t IOSize
Definition: IOTypes.h:14

Member Data Documentation

edm::propagate_const<std::unique_ptr<Storage> > TStorageFactoryFile::storage_
private