2018-11-28 03:09:12 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_FS_AIO_H
|
|
|
|
|
2018-11-28 04:54:24 +01:00
|
|
|
// Public and unconditional interface for AIO. This file is part of the
|
|
|
|
// standard include stack and available whether or not this platform is Linux
|
|
|
|
// with AIO, and whether or not it's enabled, etc. If it is not most of this
|
|
|
|
// stuff does nothing and will have null values.
|
|
|
|
|
|
|
|
/// Asynchronous filesystem Input/Output
|
|
|
|
///
|
2018-11-28 03:09:12 +01:00
|
|
|
namespace ircd::fs::aio
|
|
|
|
{
|
|
|
|
struct init;
|
2018-11-28 04:54:24 +01:00
|
|
|
struct stats;
|
2018-11-28 03:09:12 +01:00
|
|
|
struct kernel;
|
|
|
|
struct request;
|
|
|
|
|
2018-12-21 21:58:53 +01:00
|
|
|
extern const bool SUPPORT;
|
|
|
|
extern const bool SUPPORT_FSYNC;
|
|
|
|
extern const bool SUPPORT_FDSYNC;
|
|
|
|
extern const size_t MAX_EVENTS;
|
|
|
|
extern const size_t MAX_REQPRIO;
|
2018-12-02 01:06:33 +01:00
|
|
|
|
2018-12-09 00:17:13 +01:00
|
|
|
extern conf::item<bool> enable;
|
2018-12-21 21:58:53 +01:00
|
|
|
extern conf::item<size_t> max_events;
|
|
|
|
extern conf::item<size_t> max_submit;
|
2018-12-21 21:09:44 +01:00
|
|
|
|
|
|
|
extern struct stats stats;
|
|
|
|
extern kernel *context;
|
2018-11-28 03:09:12 +01:00
|
|
|
}
|
|
|
|
|
2018-11-28 04:54:24 +01:00
|
|
|
/// Statistics structure.
|
|
|
|
///
|
|
|
|
/// Subtract complete from requests to get the count of requests pending
|
|
|
|
/// "in flight." Subtract errors from complete to only get the count of
|
|
|
|
/// fully successful operations. complete will always eventually match
|
|
|
|
/// up with requests.
|
|
|
|
///
|
|
|
|
/// Subtract complete_bytes from requests_bytes to get the total bytes
|
|
|
|
/// currently pending "in flight." Subtract errors_bytes from response_bytes
|
|
|
|
/// to only get bytes successfully read or written. complete_bytes will
|
|
|
|
/// always eventually match up with requests_bytes.
|
|
|
|
///
|
|
|
|
struct ircd::fs::aio::stats
|
|
|
|
{
|
2018-11-29 20:04:10 +01:00
|
|
|
uint32_t requests {0}; ///< count of requests created
|
|
|
|
uint32_t complete {0}; ///< count of requests completed
|
2018-12-21 19:30:04 +01:00
|
|
|
uint32_t submits {0}; ///< count of io_submit calls
|
2018-11-29 20:04:10 +01:00
|
|
|
uint32_t handles {0}; ///< count of event_fd callbacks
|
|
|
|
uint32_t events {0}; ///< count of events from io_getevents
|
|
|
|
uint32_t cancel {0}; ///< count of requests canceled
|
|
|
|
uint32_t errors {0}; ///< count of response errcodes
|
|
|
|
uint32_t reads {0}; ///< count of read complete
|
|
|
|
uint32_t writes {0}; ///< count of write complete
|
2018-11-28 04:54:24 +01:00
|
|
|
|
2018-11-29 20:04:10 +01:00
|
|
|
uint64_t bytes_requests {0}; ///< total bytes for requests created
|
|
|
|
uint64_t bytes_complete {0}; ///< total bytes for requests completed
|
|
|
|
uint64_t bytes_errors {0}; ///< total bytes for completed w/ errc
|
|
|
|
uint64_t bytes_cancel {0}; ///< total bytes for cancels
|
|
|
|
uint64_t bytes_read {0}; ///< total bytes for read completed
|
|
|
|
uint64_t bytes_write {0}; ///< total bytes for write completed
|
2018-11-29 00:01:00 +01:00
|
|
|
|
2018-11-29 20:04:10 +01:00
|
|
|
uint32_t cur_reads {0}; ///< pending reads
|
|
|
|
uint32_t cur_writes {0}; ///< pending write
|
|
|
|
uint32_t cur_bytes_write {0}; ///< pending write bytes
|
|
|
|
|
|
|
|
uint32_t max_requests {0}; ///< maximum observed pending requests
|
|
|
|
uint32_t max_reads {0}; ///< maximum observed pending reads
|
|
|
|
uint32_t max_writes {0}; ///< maximum observed pending write
|
2018-12-21 19:30:04 +01:00
|
|
|
|
|
|
|
uint32_t maxed_submits {0}; ///< number of submits at threshold
|
2018-11-28 04:54:24 +01:00
|
|
|
};
|
|
|
|
|
2018-11-28 03:09:12 +01:00
|
|
|
struct ircd::fs::aio::init
|
|
|
|
{
|
|
|
|
init();
|
|
|
|
~init() noexcept;
|
|
|
|
};
|