Whamcloud - gitweb
LU-4423 lnet: use 64-bit time for selftest
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
index 57b7733..8f9d5a4 100644 (file)
@@ -102,7 +102,9 @@ static int osd_acct_index_lookup(const struct lu_env *env,
                                 const struct dt_key *dtkey)
 {
        struct osd_thread_info  *info = osd_oti_get(env);
-#ifdef HAVE_DQUOT_FS_DISK_QUOTA
+#if defined(HAVE_DQUOT_QC_DQBLK)
+       struct qc_dqblk         *dqblk = &info->oti_qdq;
+#elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
        struct fs_disk_quota    *dqblk = &info->oti_fdq;
 #else
        struct if_dqblk         *dqblk = &info->oti_dqblk;
@@ -126,7 +128,10 @@ static int osd_acct_index_lookup(const struct lu_env *env,
 #endif
        if (rc)
                RETURN(rc);
-#ifdef HAVE_DQUOT_FS_DISK_QUOTA
+#if defined(HAVE_DQUOT_QC_DQBLK)
+       rec->bspace = dqblk->d_space;
+       rec->ispace = dqblk->d_ino_count;
+#elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
        rec->bspace = dqblk->d_bcount;
        rec->ispace = dqblk->d_icount;
 #else
@@ -505,8 +510,8 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
                    struct lquota_id_info *qi, struct osd_object *obj,
                    bool enforce, int *flags)
 {
-       struct osd_device       *dev = osd_dt_dev(oh->ot_super.th_dev);
-       struct qsd_instance     *qsd = dev->od_quota_slave;
+       struct osd_device       *dev;
+       struct qsd_instance     *qsd;
        struct inode            *inode = NULL;
        int                      i, rc = 0, crd;
        bool                     found = false;
@@ -516,6 +521,11 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
        LASSERTF(oh->ot_id_cnt <= OSD_MAX_UGID_CNT, "count=%d\n",
                 oh->ot_id_cnt);
 
+       dev = osd_dt_dev(oh->ot_super.th_dev);
+       LASSERT(dev != NULL);
+
+       qsd = dev->od_quota_slave;
+
        for (i = 0; i < oh->ot_id_cnt; i++) {
                if (oh->ot_id_array[i] == qi->lqi_id.qid_uid &&
                    osd_qid_type(oh, i) == qi->lqi_type) {