Blame source/vdo/base/flush.h

Packit Service 310c69
/*
Packit Service 310c69
 * Copyright (c) 2020 Red Hat, Inc.
Packit Service 310c69
 *
Packit Service 310c69
 * This program is free software; you can redistribute it and/or
Packit Service 310c69
 * modify it under the terms of the GNU General Public License
Packit Service 310c69
 * as published by the Free Software Foundation; either version 2
Packit Service 310c69
 * of the License, or (at your option) any later version.
Packit Service 310c69
 * 
Packit Service 310c69
 * This program is distributed in the hope that it will be useful,
Packit Service 310c69
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 310c69
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 310c69
 * GNU General Public License for more details.
Packit Service 310c69
 * 
Packit Service 310c69
 * You should have received a copy of the GNU General Public License
Packit Service 310c69
 * along with this program; if not, write to the Free Software
Packit Service 310c69
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit Service 310c69
 * 02110-1301, USA. 
Packit Service 310c69
 *
Packit Service 310c69
 * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/flush.h#1 $
Packit Service 310c69
 */
Packit Service 310c69
Packit Service 310c69
#ifndef FLUSH_H
Packit Service 310c69
#define FLUSH_H
Packit Service 310c69
Packit Service 310c69
#include "types.h"
Packit Service 310c69
#include "waitQueue.h"
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * A marker for tracking which journal entries are affected by a flush request.
Packit Service 310c69
 **/
Packit Service 310c69
struct vdoFlush {
Packit Service 310c69
  /** The wait queue entry for this flush */
Packit Service 310c69
  Waiter         waiter;
Packit Service 310c69
  /** Which flush this struct represents */
Packit Service 310c69
  SequenceNumber flushGeneration;
Packit Service 310c69
};
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Make a flusher for a VDO.
Packit Service 310c69
 *
Packit Service 310c69
 * @param vdo  The VDO which owns the flusher
Packit Service 310c69
 *
Packit Service 310c69
 * @return VDO_SUCCESS or an error
Packit Service 310c69
 **/
Packit Service 310c69
int makeFlusher(VDO *vdo)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Free a flusher and null out the reference to it.
Packit Service 310c69
 *
Packit Service 310c69
 * @param flusherPtr  A pointer to the flusher to free
Packit Service 310c69
 **/
Packit Service 310c69
void freeFlusher(Flusher **flusherPtr);
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Get the ID of the thread on which flusher functions should be called.
Packit Service 310c69
 *
Packit Service 310c69
 * @param flusher  The flusher to query
Packit Service 310c69
 *
Packit Service 310c69
 * @return The ID of the thread which handles the flusher
Packit Service 310c69
 **/
Packit Service 310c69
ThreadID getFlusherThreadID(Flusher *flusher)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Handle empty flush requests.
Packit Service 310c69
 *
Packit Service 310c69
 * @param vdo       The VDO
Packit Service 310c69
 * @param vdoFlush  The opaque flush request
Packit Service 310c69
 **/
Packit Service 310c69
void flush(VDO *vdo, VDOFlush *vdoFlush);
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Attempt to complete any flushes which might have finished.
Packit Service 310c69
 *
Packit Service 310c69
 * @param flusher  The flusher
Packit Service 310c69
 **/
Packit Service 310c69
void completeFlushes(Flusher *flusher);
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Dump the flusher, in a thread-unsafe fashion.
Packit Service 310c69
 *
Packit Service 310c69
 * @param flusher  The flusher
Packit Service 310c69
 **/
Packit Service 310c69
void dumpFlusher(const Flusher *flusher);
Packit Service 310c69
Packit Service 310c69
#endif /* FLUSH_H */