+/**
+ * OFD request handler for OST_QUOTACTL RPC.
+ *
+ * This is part of request processing to validate incoming request fields,
+ * get the requested data from OSD and pack reply.
+ *
+ * \param[in] tsi target session environment for this request
+ *
+ * \retval 0 if successful
+ * \retval negative value on error
+ */
+static int ofd_quotactl(struct tgt_session_info *tsi)
+{
+ struct obd_quotactl *oqctl, *repoqc;
+ struct lu_nodemap *nodemap;
+ int id;
+ int rc;
+
+ ENTRY;
+
+ oqctl = req_capsule_client_get(tsi->tsi_pill, &RMF_OBD_QUOTACTL);
+ if (oqctl == NULL)
+ RETURN(err_serious(-EPROTO));
+
+ repoqc = req_capsule_server_get(tsi->tsi_pill, &RMF_OBD_QUOTACTL);
+ if (repoqc == NULL)
+ RETURN(err_serious(-ENOMEM));
+
+ *repoqc = *oqctl;
+
+ nodemap = nodemap_get_from_exp(tsi->tsi_exp);
+ if (IS_ERR(nodemap))
+ RETURN(PTR_ERR(nodemap));
+
+ id = repoqc->qc_id;
+ if (oqctl->qc_type == USRQUOTA)
+ id = nodemap_map_id(nodemap, NODEMAP_UID,
+ NODEMAP_CLIENT_TO_FS,
+ repoqc->qc_id);
+ else if (oqctl->qc_type == GRPQUOTA)
+ id = nodemap_map_id(nodemap, NODEMAP_GID,
+ NODEMAP_CLIENT_TO_FS,
+ repoqc->qc_id);
+
+ nodemap_putref(nodemap);
+
+ if (repoqc->qc_id != id)
+ swap(repoqc->qc_id, id);
+
+ rc = lquotactl_slv(tsi->tsi_env, tsi->tsi_tgt->lut_bottom, repoqc);
+
+ ofd_counter_incr(tsi->tsi_exp, LPROC_OFD_STATS_QUOTACTL,
+ tsi->tsi_jobid, 1);
+
+ if (repoqc->qc_id != id)
+ swap(repoqc->qc_id, id);
+
+ RETURN(rc);
+}
+
+/**
+ * Calculate the amount of time for lock prolongation.
+ *
+ * This is helper for ofd_prolong_extent_locks() function to get
+ * the timeout extra time.
+ *
+ * \param[in] req current request
+ *
+ * \retval amount of time to extend the timeout with
+ */
+static inline int prolong_timeout(struct ptlrpc_request *req)
+{
+ struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
+ time_t req_timeout;
+
+ if (AT_OFF)
+ return obd_timeout / 2;
+
+ req_timeout = req->rq_deadline - req->rq_arrival_time.tv_sec;
+ return max_t(time_t, at_est2timeout(at_get(&svcpt->scp_at_estimate)),
+ req_timeout);
+}
+
+/**
+ * Prolong lock timeout for the given extent.
+ *
+ * This function finds all locks related with incoming request and
+ * prolongs their timeout.
+ *
+ * If a client is holding a lock for a long time while it sends
+ * read or write RPCs to the OST for the object under this lock,
+ * then we don't want the OST to evict the client. Otherwise,
+ * if the network or disk is very busy then the client may not
+ * be able to make any progress to clear out dirty pages under
+ * the lock and the application will fail.
+ *
+ * Every time a Bulk Read/Write (BRW) request arrives for the object
+ * covered by the lock, extend the timeout on that lock. The RPC should
+ * contain a lock handle for the lock it is using, but this
+ * isn't handled correctly by all client versions, and the
+ * request may cover multiple locks.
+ *
+ * \param[in] tsi target session environment for this request
+ * \param[in] data struct of data to prolong locks
+ *
+ */
+static void ofd_prolong_extent_locks(struct tgt_session_info *tsi,
+ struct ldlm_prolong_args *data)