dm: rename __dm_get_reserved_ios() helper to __dm_get_module_param()
__dm_get_module_param() could be useful for future DM module parameters besides those related to "reserved_ios". Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
e73f6e8a0d
commit
09c2d53101
@ -250,35 +250,35 @@ static unsigned reserved_bio_based_ios = RESERVED_BIO_BASED_IOS;
|
|||||||
*/
|
*/
|
||||||
static unsigned reserved_rq_based_ios = RESERVED_REQUEST_BASED_IOS;
|
static unsigned reserved_rq_based_ios = RESERVED_REQUEST_BASED_IOS;
|
||||||
|
|
||||||
static unsigned __dm_get_reserved_ios(unsigned *reserved_ios,
|
static unsigned __dm_get_module_param(unsigned *module_param,
|
||||||
unsigned def, unsigned max)
|
unsigned def, unsigned max)
|
||||||
{
|
{
|
||||||
unsigned ios = ACCESS_ONCE(*reserved_ios);
|
unsigned param = ACCESS_ONCE(*module_param);
|
||||||
unsigned modified_ios = 0;
|
unsigned modified_param = 0;
|
||||||
|
|
||||||
if (!ios)
|
if (!param)
|
||||||
modified_ios = def;
|
modified_param = def;
|
||||||
else if (ios > max)
|
else if (param > max)
|
||||||
modified_ios = max;
|
modified_param = max;
|
||||||
|
|
||||||
if (modified_ios) {
|
if (modified_param) {
|
||||||
(void)cmpxchg(reserved_ios, ios, modified_ios);
|
(void)cmpxchg(module_param, param, modified_param);
|
||||||
ios = modified_ios;
|
param = modified_param;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ios;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned dm_get_reserved_bio_based_ios(void)
|
unsigned dm_get_reserved_bio_based_ios(void)
|
||||||
{
|
{
|
||||||
return __dm_get_reserved_ios(&reserved_bio_based_ios,
|
return __dm_get_module_param(&reserved_bio_based_ios,
|
||||||
RESERVED_BIO_BASED_IOS, RESERVED_MAX_IOS);
|
RESERVED_BIO_BASED_IOS, RESERVED_MAX_IOS);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_get_reserved_bio_based_ios);
|
EXPORT_SYMBOL_GPL(dm_get_reserved_bio_based_ios);
|
||||||
|
|
||||||
unsigned dm_get_reserved_rq_based_ios(void)
|
unsigned dm_get_reserved_rq_based_ios(void)
|
||||||
{
|
{
|
||||||
return __dm_get_reserved_ios(&reserved_rq_based_ios,
|
return __dm_get_module_param(&reserved_rq_based_ios,
|
||||||
RESERVED_REQUEST_BASED_IOS, RESERVED_MAX_IOS);
|
RESERVED_REQUEST_BASED_IOS, RESERVED_MAX_IOS);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dm_get_reserved_rq_based_ios);
|
EXPORT_SYMBOL_GPL(dm_get_reserved_rq_based_ios);
|
||||||
|
Loading…
Reference in New Issue
Block a user