mirror of
https://github.com/schoebel/mars
synced 2025-04-17 20:55:38 +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
|
#define MARS_HAS_NEW_GENERIC_BLK_ACCOUNTING
|
||||||
#endif
|
#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 */
|
/* vfs stuff */
|
||||||
|
|
||||||
/* Adapt to
|
/* Adapt to
|
||||||
|
@ -102,7 +102,43 @@ static int device_minor = 0;
|
|||||||
|
|
||||||
///////////////////////// linux operations ////////////////////////
|
///////////////////////// 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 */
|
/* Disbaled by default, for saving overhead */
|
||||||
int mars_io_acct = 0;
|
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);
|
biow->start_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* To disappear in the long term */
|
||||||
#elif defined(MARS_HAS_OLD_BLK_ACCOUNTING)
|
#elif defined(MARS_HAS_OLD_BLK_ACCOUNTING)
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -126,4 +126,8 @@ struct if_brick {
|
|||||||
|
|
||||||
MARS_TYPES(if);
|
MARS_TYPES(if);
|
||||||
|
|
||||||
|
///////////////////////// statistics ////////////////////////
|
||||||
|
|
||||||
|
extern int mars_io_acct;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -538,6 +538,9 @@ struct ctl_table io_tuning_table[] = {
|
|||||||
THRESHOLD_ENTRIES(&aio_io_threshold[1], "aio_io_w"),
|
THRESHOLD_ENTRIES(&aio_io_threshold[1], "aio_io_w"),
|
||||||
THRESHOLD_ENTRIES(&aio_sync_threshold, "aio_sync"),
|
THRESHOLD_ENTRIES(&aio_sync_threshold, "aio_sync"),
|
||||||
INT_ENTRY("if_nr_requests", if_nr_requests, 0600),
|
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