2014-11-21 10:51:34 +00:00
|
|
|
/*
|
|
|
|
* MARS Long Distance Replication Software
|
|
|
|
*
|
|
|
|
* This file is part of MARS project: http://schoebel.github.io/mars/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2014 Thomas Schoebel-Theuer
|
|
|
|
* Copyright (C) 2011-2014 1&1 Internet AG
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
#ifndef MARS_SIO_H
|
|
|
|
#define MARS_SIO_H
|
2010-06-20 18:55:34 +00:00
|
|
|
|
2015-07-14 11:53:11 +00:00
|
|
|
#include "lib_mapfree.h"
|
|
|
|
|
2011-11-14 13:12:33 +00:00
|
|
|
#define WITH_THREAD 16
|
2010-06-17 16:57:10 +00:00
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct sio_mref_aspect {
|
2010-12-15 12:13:18 +00:00
|
|
|
GENERIC_ASPECT(mref);
|
2010-08-04 17:32:04 +00:00
|
|
|
struct list_head io_head;
|
2011-11-14 13:12:33 +00:00
|
|
|
int alloc_len;
|
|
|
|
bool do_dealloc;
|
2010-07-23 11:55:18 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct sio_brick {
|
|
|
|
MARS_BRICK(sio);
|
2011-11-14 13:12:33 +00:00
|
|
|
// parameters
|
|
|
|
bool o_direct;
|
|
|
|
bool o_fdsync;
|
2010-06-15 18:31:06 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct sio_input {
|
|
|
|
MARS_INPUT(sio);
|
2010-06-15 18:31:06 +00:00
|
|
|
};
|
|
|
|
|
2010-06-18 11:44:14 +00:00
|
|
|
struct sio_threadinfo {
|
2011-03-07 10:27:38 +00:00
|
|
|
struct sio_output *output;
|
2010-08-05 15:54:48 +00:00
|
|
|
struct list_head mref_list;
|
2010-06-17 16:57:10 +00:00
|
|
|
struct task_struct *thread;
|
|
|
|
wait_queue_head_t event;
|
|
|
|
spinlock_t lock;
|
2012-02-07 11:24:49 +00:00
|
|
|
atomic_t queue_count;
|
|
|
|
atomic_t fly_count;
|
|
|
|
atomic_t total_count;
|
2010-08-03 16:03:32 +00:00
|
|
|
unsigned long last_jiffies;
|
2010-06-18 11:44:14 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct sio_output {
|
|
|
|
MARS_OUTPUT(sio);
|
2010-10-22 12:00:08 +00:00
|
|
|
// private
|
2015-07-14 11:53:11 +00:00
|
|
|
struct mapfree_info *mf;
|
2010-06-18 11:44:14 +00:00
|
|
|
struct sio_threadinfo tinfo[WITH_THREAD+1];
|
|
|
|
spinlock_t g_lock;
|
2015-07-15 06:17:31 +00:00
|
|
|
atomic_t work_count;
|
2010-06-18 11:44:14 +00:00
|
|
|
int index;
|
2020-09-30 08:34:14 +00:00
|
|
|
int error;
|
2010-06-15 18:31:06 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
MARS_TYPES(sio);
|
2010-06-20 18:55:34 +00:00
|
|
|
|
|
|
|
#endif
|