mars/kernel/mars_bio.h

89 lines
2.2 KiB
C
Raw Normal View History

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-18 13:15:40 +00:00
#ifndef MARS_BIO_H
#define MARS_BIO_H
#define BIO_SUBMIT_MAX_LATENCY 250 // 250 us
#define BIO_IO_R_MAX_LATENCY 40000 // 40 ms
#define BIO_IO_W_MAX_LATENCY 100000 // 100 ms
extern struct threshold bio_submit_threshold;
extern struct threshold bio_io_threshold[2];
2011-03-18 13:15:40 +00:00
#include <linux/blkdev.h>
2011-03-29 14:40:40 +00:00
2011-03-18 13:15:40 +00:00
struct bio_mref_aspect {
GENERIC_ASPECT(mref);
struct list_head io_head;
struct bio *bio;
struct bio_output *output;
unsigned long long start_stamp;
2011-03-18 13:15:40 +00:00
int status_code;
2011-03-29 14:40:40 +00:00
int hash_pos;
2011-06-30 13:15:52 +00:00
int alloc_len;
2011-03-31 16:16:00 +00:00
bool do_dealloc;
2011-03-18 13:15:40 +00:00
};
struct bio_brick {
MARS_BRICK(bio);
// tunables
int ra_pages;
2012-02-25 21:22:52 +00:00
int bg_threshold;
int bg_maxfly;
2011-05-06 10:25:52 +00:00
bool do_noidle;
bool do_sync;
bool do_unplug;
2011-03-18 13:15:40 +00:00
// readonly
loff_t total_size;
2012-02-25 21:22:52 +00:00
atomic_t fly_count[MARS_PRIO_NR];
atomic_t queue_count[MARS_PRIO_NR];
2011-04-29 09:36:10 +00:00
atomic_t completed_count;
2012-02-25 21:22:52 +00:00
atomic_t total_completed_count[MARS_PRIO_NR];
2011-03-18 13:15:40 +00:00
// private
spinlock_t lock;
struct list_head queue_list[MARS_PRIO_NR];
struct list_head submitted_list[2];
2011-03-18 13:15:40 +00:00
struct list_head completed_list;
wait_queue_head_t submit_event;
wait_queue_head_t response_event;
2013-01-23 11:30:28 +00:00
struct mapfree_info *mf;
2011-03-18 13:15:40 +00:00
struct block_device *bdev;
brick_thread_t *submit_thread;
brick_thread_t *response_thread;
2011-03-18 13:15:40 +00:00
int bvec_max;
bool submitted;
2011-03-18 13:15:40 +00:00
};
struct bio_input {
MARS_INPUT(bio);
};
struct bio_output {
MARS_OUTPUT(bio);
};
MARS_TYPES(bio);
#endif