Whamcloud - gitweb
LU-9341 lod: Add special O_APPEND striping
[fs/lustre-release.git] / lustre / include / lustre_nrs_crr.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) 2014, Intel Corporation.
23  *
24  * Copyright 2012 Xyratex Technology Limited
25  */
26 /*
27  *
28  * Network Request Scheduler (NRS) Client Round Robin over NIDs (CRR-N) policy
29  *
30  */
31
32 #ifndef _LUSTRE_NRS_CRR_H
33 #define _LUSTRE_NRS_CRR_H
34
35 /**
36  * \name CRR-N
37  *
38  * CRR-N, Client Round Robin over NIDs
39  * @{
40  */
41 #include <libcfs/linux/linux-hash.h>
42
43 /**
44  * private data structure for CRR-N NRS
45  */
46 struct nrs_crrn_net {
47         struct ptlrpc_nrs_resource      cn_res;
48         struct cfs_binheap             *cn_binheap;
49         /* CRR-N NRS - NID hash body */
50         struct rhashtable               cn_cli_hash;
51         /**
52          * Used when a new scheduling round commences, in order to synchronize
53          * all clients with the new round number.
54          */
55         __u64                           cn_round;
56         /**
57          * Determines the relevant ordering amongst request batches within a
58          * scheduling round.
59          */
60         __u64                           cn_sequence;
61         /**
62          * Round Robin quantum; the maximum number of RPCs that each request
63          * batch for each client can have in a scheduling round.
64          */
65         __u16                           cn_quantum;
66 };
67
68 /**
69  * Object representing a client in CRR-N, as identified by its NID
70  */
71 struct nrs_crrn_client {
72         struct ptlrpc_nrs_resource      cc_res;
73         struct rhash_head               cc_rhead;
74         lnet_nid_t                      cc_nid;
75         /**
76          * The round number against which this client is currently scheduling
77          * requests.
78          */
79         __u64                           cc_round;
80         /**
81          * The sequence number used for requests scheduled by this client during
82          * the current round number.
83          */
84         __u64                           cc_sequence;
85         atomic_t                        cc_ref;
86         /**
87          * Round Robin quantum; the maximum number of RPCs the client is allowed
88          * to schedule in a single batch of each round.
89          */
90         __u16                           cc_quantum;
91         /**
92          * # of pending requests for this client, on all existing rounds
93          */
94         __u16                           cc_active;
95 };
96
97 /**
98  * CRR-N NRS request definition
99  */
100 struct nrs_crrn_req {
101         /**
102          * Round number for this request; shared with all other requests in the
103          * same batch.
104          */
105         __u64                   cr_round;
106         /**
107          * Sequence number for this request; shared with all other requests in
108          * the same batch.
109          */
110         __u64                   cr_sequence;
111 };
112
113 /**
114  * CRR-N policy operations.
115  */
116 enum nrs_ctl_crr {
117         /**
118          * Read the RR quantum size of a CRR-N policy.
119          */
120         NRS_CTL_CRRN_RD_QUANTUM = PTLRPC_NRS_CTL_1ST_POL_SPEC,
121         /**
122          * Write the RR quantum size of a CRR-N policy.
123          */
124         NRS_CTL_CRRN_WR_QUANTUM,
125 };
126
127 /** @} CRR-N */
128 #endif