cas_cache: IO classification based on PID.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-07-17 09:11:27 -04:00
parent 7c4114b7bd
commit c2eef6fe64

View File

@ -487,6 +487,18 @@ static cas_cls_eval_t _cas_cls_lba_test(
return _cas_cls_numeric_test_u(c, lba); return _cas_cls_numeric_test_u(c, lba);
} }
/* PID test function */
static cas_cls_eval_t _cas_cls_pid_test(
struct cas_classifier *cls, struct cas_cls_condition *c,
struct cas_cls_io *io, ocf_part_id_t part_id)
{
/* 'current' is kernel macro that allows to access control block of
currently executing task */
struct task_struct *ti = current;
return _cas_cls_numeric_test_u(c, ti->pid);
}
/* Array of condition handlers */ /* Array of condition handlers */
static struct cas_cls_condition_handler _handlers[] = { static struct cas_cls_condition_handler _handlers[] = {
{ "done", _cas_cls_done_test, _cas_cls_generic_ctr }, { "done", _cas_cls_done_test, _cas_cls_generic_ctr },
@ -501,6 +513,7 @@ static struct cas_cls_condition_handler _handlers[] = {
{ "extension", _cas_cls_extension_test, _cas_cls_string_ctr, { "extension", _cas_cls_extension_test, _cas_cls_string_ctr,
_cas_cls_generic_dtr }, _cas_cls_generic_dtr },
{ "lba", _cas_cls_lba_test, _cas_cls_numeric_ctr, _cas_cls_generic_dtr }, { "lba", _cas_cls_lba_test, _cas_cls_numeric_ctr, _cas_cls_generic_dtr },
{ "pid", _cas_cls_pid_test, _cas_cls_numeric_ctr, _cas_cls_generic_dtr },
#ifdef CAS_WLTH_SUPPORT #ifdef CAS_WLTH_SUPPORT
{ "wlth", _cas_cls_wlth_test, _cas_cls_numeric_ctr, { "wlth", _cas_cls_wlth_test, _cas_cls_numeric_ctr,
_cas_cls_generic_dtr}, _cas_cls_generic_dtr},