Whamcloud - gitweb
LU-6283 ptlrpc: Implement NRS Delay Policy
[fs/lustre-release.git] / lustre / include / lustre_nrs_delay.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License version 2 for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * version 2 along with this program; If not, see
17  * http://www.gnu.org/licenses/gpl-2.0.html
18  *
19  * GPL HEADER END
20  */
21 /*
22  * Copyright (c) 2015, Cray Inc. All Rights Reserved.
23  *
24  * Copyright (c) 2015, Intel Corporation.
25  */
26 /*
27  *
28  * Network Request Scheduler (NRS) Delay policy
29  *
30  */
31
32 #ifndef _LUSTRE_NRS_DELAY_H
33 #define _LUSTRE_NRS_DELAY_H
34
35 /* \name delay
36  *
37  * Delay policy
38  * @{
39  */
40
41 /**
42  * Private data structure for the delay policy
43  */
44 struct nrs_delay_data {
45         struct ptlrpc_nrs_resource       delay_res;
46
47         /**
48          * Delayed requests are stored in this binheap until they are
49          * removed for handling.
50          */
51         struct cfs_binheap              *delay_binheap;
52
53         /**
54          * Minimum service time
55          */
56         __u32                            min_delay;
57
58         /**
59          * Maximum service time
60          */
61         __u32                            max_delay;
62
63         /**
64          * We'll delay this percent of requests
65          */
66         __u32                            delay_pct;
67 };
68
69 struct nrs_delay_req {
70         /**
71          * This is the time at which a request becomes eligible for handling
72          */
73         time64_t        req_start_time;
74 };
75
76 enum nrs_ctl_delay {
77         NRS_CTL_DELAY_RD_MIN = PTLRPC_NRS_CTL_1ST_POL_SPEC,
78         NRS_CTL_DELAY_WR_MIN,
79         NRS_CTL_DELAY_RD_MAX,
80         NRS_CTL_DELAY_WR_MAX,
81         NRS_CTL_DELAY_RD_PCT,
82         NRS_CTL_DELAY_WR_PCT,
83 };
84
85 /** @} delay */
86
87 #endif