+ * This file provides code related to grant space management on Object Storage
+ * Targets (OSTs). Grant is a mechanism used by client nodes to reserve disk
+ * space on OSTs for the data writeback cache. The Lustre client is thus assured
+ * that enough space will be available when flushing dirty pages asynchronously.
+ * Each client node is granted an initial amount of reserved space at connect
+ * time and gets additional space back from OST in bulk write reply.
+ *
+ * We actually support three different cases:
+ * - The client supports the new grant parameters (i.e. OBD_CONNECT_GRANT_PARAM)
+ * which means that all grant overhead calculation happens on the client side.
+ * The server reports at connect time the backend filesystem block size, the
+ * maximum extent size as well as the extent insertion cost and it is then up
+ * to the osc layer to the track dirty extents and consume grant accordingly
+ * (see osc_cache.c). In each bulk write request, the client provides how much
+ * grant space was consumed for this RPC.
+ * - The client does not support OBD_CONNECT_GRANT_PARAM and always assumes a
+ * a backend file system block size of 4KB. We then have two cases:
+ * - If the block size is really 4KB, then the client can deal with grant
+ * allocation for partial block writes, but won't take extent insertion cost
+ * into account. For such clients, we inflate grant by 100% on the server
+ * side. It means that when 32MB of grant is hold by the client, 64MB of
+ * grant space is actually reserved on the server. All grant counters
+ * provided by such a client are inflated by 100%.
+ * - The backend filesystem block size is bigger than 4KB, which isn't
+ * supported by the client. In this case, we emulate a 4KB block size and
+ * consume one block size on the server for each 4KB of grant returned to
+ * client. With a 128KB blocksize, it means that 32MB dirty pages of 4KB
+ * on the client will actually consume 1GB of grant on the server.
+ * All grant counters provided by such a client are inflated by the block
+ * size ratio.
+ *
+ * This file handles the core logic for:
+ * - grant allocation strategy
+ * - maintaining per-client as well as global grant space accounting
+ * - processing grant information packed in incoming requests
+ * - allocating server-side grant space for synchronous write RPCs which did not
+ * consume grant on the client side (OBD_BRW_FROM_GRANT flag not set). If not
+ * enough space is available, such RPCs fail with ENOSPC
+ *
+ * Author: Johann Lombardi <johann.lombardi@intel.com>