+/* clear lge_qunit/edquot_nu flags -
+ * slave recieved new qunit and edquot.
+ *
+ * \retval true if revoke is needed - qunit
+ * for this slave reaches least_qunit
+ */
+static bool qmt_clear_lgeg_arr_nu(struct lquota_entry *lqe, int stype, int idx)
+{
+ unsigned long least_qunit = lqe2qpi(lqe)->qpi_least_qunit;
+ struct lqe_glbl_data *lgd = lqe->lqe_glbl_data;
+
+ /* There is no array to store lge for the case of DOM.
+ * Ignore it until MDT pools will be ready. */
+ if (!(lqe_rtype(lqe) == LQUOTA_RES_DT && stype == QMT_STYPE_MDT)) {
+ lqe->lqe_glbl_data->lqeg_arr[idx].lge_qunit_nu = 0;
+ lqe->lqe_glbl_data->lqeg_arr[idx].lge_edquot_nu = 0;
+
+ /* We shouldn't call revoke for DOM case, it will be updated
+ * at qmt_id_lock_glimpse. */
+ return (lgd->lqeg_arr[idx].lge_qunit == least_qunit);
+ }
+
+ return false;
+}
+
+static void qmt_set_revoke(struct lu_env *env, struct lquota_entry *lqe,
+ int stype, int idx)
+{
+ unsigned long least_qunit = lqe2qpi(lqe)->qpi_least_qunit;
+ struct lqe_glbl_data *lgd = lqe->lqe_glbl_data;
+
+ if (lgd->lqeg_arr[idx].lge_qunit == least_qunit) {
+ int i;
+
+ qti_lqes_write_lock(env);
+ for (i = 0; i < qti_lqes_cnt(env); i++) {
+ LQUOTA_DEBUG(qti_lqes(env)[i],
+ "idx %d lge_qunit %llu least_qunit %lu\n",
+ idx, lgd->lqeg_arr[idx].lge_qunit,
+ least_qunit);
+ if (qti_lqes(env)[i]->lqe_qunit == least_qunit) {
+ qti_lqes(env)[i]->lqe_revoke_time =
+ ktime_get_seconds();
+ qmt_adjust_edquot(qti_lqes(env)[i],
+ ktime_get_real_seconds());
+ }
+ }
+ qti_lqes_write_unlock(env);
+ }
+}
+