mirror of
https://github.com/schoebel/mars
synced 2024-12-18 12:45:08 +00:00
compat 5.8: use bio_{start,end}_io_acct where it may work
This commit is contained in:
parent
923be2e4a2
commit
35001fddb7
@ -240,6 +240,19 @@ extern int __oldcompat_unlink(
|
||||
#define MARS_HAS_NEW_GENERIC_BLK_ACCOUNTING
|
||||
#endif
|
||||
|
||||
/* Adapt to e722fff238bbfe6308d7778a8c2163c181bf998a
|
||||
* after 956d510ee78caebc83c0eaeb892db5b239a36a06
|
||||
* detected via 0512a75b98f847c2e9a4b664013424e603e202f7
|
||||
* (see also 24d69293d9a561645e0b4d78c2fb179827e35f53)
|
||||
* and disable the old methods.
|
||||
*/
|
||||
#ifdef BLK_STS_ZONE_RESOURCE
|
||||
#define MARS_HAS_BIO_IO_ACCT
|
||||
#undef MARS_HAS_GENERIC_BLK_ACCOUNTING
|
||||
#undef MARS_HAS_OLD_BLK_ACCOUNTING
|
||||
#undef MARS_HAS_NEW_GENERIC_BLK_ACCOUNTING
|
||||
#endif
|
||||
|
||||
/* vfs stuff */
|
||||
|
||||
/* Adapt to
|
||||
|
@ -102,7 +102,43 @@ static int device_minor = 0;
|
||||
|
||||
///////////////////////// linux operations ////////////////////////
|
||||
|
||||
#ifdef MARS_HAS_GENERIC_BLK_ACCOUNTING
|
||||
#ifdef MARS_HAS_BIO_IO_ACCT
|
||||
/* Now IO accounting is enabled by default.
|
||||
* Thanks to Christoph Hellwig who simplified the upstream a lot.
|
||||
*/
|
||||
int mars_io_acct = 1;
|
||||
|
||||
static inline
|
||||
void _if_start_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
{
|
||||
struct bio *bio;
|
||||
|
||||
if (!mars_io_acct)
|
||||
return;
|
||||
|
||||
bio = biow->bio;
|
||||
/* We cannot account at certain kernels when bi_disk is unknown.
|
||||
*/
|
||||
if (!bio || !bio->bi_disk)
|
||||
return;
|
||||
|
||||
biow->start_time = bio_start_io_acct(bio);
|
||||
}
|
||||
|
||||
static inline
|
||||
void _if_end_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
{
|
||||
struct bio *bio;
|
||||
|
||||
if (!biow->start_time)
|
||||
return;
|
||||
|
||||
bio = biow->bio;
|
||||
bio_end_io_acct(bio, biow->start_time);
|
||||
}
|
||||
|
||||
/* Check whether some old IO accounting methods are usable */
|
||||
#elif defined(MARS_HAS_GENERIC_BLK_ACCOUNTING)
|
||||
|
||||
/* Disbaled by default, for saving overhead */
|
||||
int mars_io_acct = 0;
|
||||
@ -144,6 +180,7 @@ void _if_end_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
biow->start_time);
|
||||
}
|
||||
|
||||
/* To disappear in the long term */
|
||||
#elif defined(MARS_HAS_OLD_BLK_ACCOUNTING)
|
||||
|
||||
static
|
||||
|
@ -126,4 +126,8 @@ struct if_brick {
|
||||
|
||||
MARS_TYPES(if);
|
||||
|
||||
///////////////////////// statistics ////////////////////////
|
||||
|
||||
extern int mars_io_acct;
|
||||
|
||||
#endif
|
||||
|
@ -538,6 +538,9 @@ struct ctl_table io_tuning_table[] = {
|
||||
THRESHOLD_ENTRIES(&aio_io_threshold[1], "aio_io_w"),
|
||||
THRESHOLD_ENTRIES(&aio_sync_threshold, "aio_sync"),
|
||||
INT_ENTRY("if_nr_requests", if_nr_requests, 0600),
|
||||
#if defined(MARS_HAS_BIO_IO_ACCT) || defined(MARS_HAS_GENERIC_BLK_ACCOUNTING)
|
||||
INT_ENTRY("if_io_acct", mars_io_acct, 0600),
|
||||
#endif
|
||||
{}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user