+/**
+ * Helper routine used to extract pool ID, pool type and quota type from a
+ * given FID.
+ */
+int lquota_extract_fid(struct lu_fid *fid, int *pool_id, int *pool_type,
+ int *quota_type)
+{
+ unsigned int tmp;
+ ENTRY;
+
+ if (fid->f_seq != FID_SEQ_QUOTA_GLB)
+ RETURN(-EINVAL);
+
+ if (pool_id != NULL) {
+ tmp = fid->f_oid & 0xffffU;
+ if (tmp != 0)
+ /* we only support pool ID 0 for the time being */
+ RETURN(-ENOTSUPP);
+ *pool_id = tmp;
+ }
+
+ if (pool_type != NULL) {
+ tmp = (fid->f_oid >> 16) & 0xffU;
+ if (tmp >= LQUOTA_LAST_RES)
+ RETURN(-ENOTSUPP);
+
+ *pool_type = tmp;
+ }
+
+ if (quota_type != NULL) {
+ tmp = fid->f_oid >> 24;
+ if (tmp >= LQUOTA_TYPE_MAX)
+ RETURN(-ENOTSUPP);
+
+ *quota_type = (tmp == LQUOTA_TYPE_USR) ? USRQUOTA : GRPQUOTA;
+ }
+
+ RETURN(0);
+}
+
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2,7,50,0)
+/* Index features supported by the global index objects.
+ * We actually use one dt_index_features structure for each quota combination
+ * of quota type x [inode, block] to allow the ldiskfs OSD to recognize those
+ * objects and to handle the conversion from the old administrative quota file
+ * format */
+struct dt_index_features dt_quota_iusr_features;
+EXPORT_SYMBOL(dt_quota_iusr_features);
+struct dt_index_features dt_quota_busr_features;
+EXPORT_SYMBOL(dt_quota_busr_features);
+struct dt_index_features dt_quota_igrp_features;
+EXPORT_SYMBOL(dt_quota_igrp_features);
+struct dt_index_features dt_quota_bgrp_features;
+EXPORT_SYMBOL(dt_quota_bgrp_features);
+
+/**
+ * Helper routine returning the right index feature structure to be used
+ * depending on the FID of the global index.
+ */
+const struct dt_index_features *glb_idx_feature(struct lu_fid *fid)
+{
+ int res_type, quota_type, rc;
+
+ rc = lquota_extract_fid(fid, NULL, &res_type, "a_type);