Whamcloud - gitweb
LU-15880 quota: fix issues in reserving quota
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_handler.c
index c0f3da9..ab7facf 100644 (file)
@@ -2541,23 +2541,20 @@ const int osd_dto_credits_noquota[DTO_NR] = {
 /* reserve or free quota for some operation */
 static int osd_reserve_or_free_quota(const struct lu_env *env,
                                     struct dt_device *dev,
-                                    enum quota_type type, __u64 uid,
-                                    __u64 gid, __s64 count, bool is_md)
+                                    struct lquota_id_info *qi)
 {
-       int rc;
        struct osd_device       *osd = osd_dt_dev(dev);
-       struct osd_thread_info  *info = osd_oti_get(env);
-       struct lquota_id_info   *qi = &info->oti_qi;
        struct qsd_instance     *qsd = NULL;
+       int rc;
 
        ENTRY;
 
-       if (is_md)
-               qsd = osd->od_quota_slave_md;
-       else
+       if (qi->lqi_is_blk)
                qsd = osd->od_quota_slave_dt;
+       else
+               qsd = osd->od_quota_slave_md;
 
-       rc = quota_reserve_or_free(env, qsd, qi, type, uid, gid, count, is_md);
+       rc = qsd_reserve_or_free_quota(env, qsd, qi);
        RETURN(rc);
 }
 
@@ -3428,7 +3425,6 @@ static void osd_ah_init(const struct lu_env *env, struct dt_allocation_hint *ah,
        LASSERT(ah);
 
        ah->dah_parent = parent;
-       ah->dah_mode = child_mode;
 
        if (parent != NULL && !dt_object_remote(parent)) {
                /* will help to find FID->ino at dt_insert("..") */
@@ -4269,7 +4265,7 @@ static int osd_ref_add(const struct lu_env *env, struct dt_object *dt,
                /* inc_nlink from 0 may cause WARN_ON */
                set_nlink(inode, 1);
        else {
-               ldiskfs_inc_count(oh->ot_handle, inode);
+               osd_ldiskfs_inc_count(oh->ot_handle, inode);
                if (!S_ISDIR(inode->i_mode))
                        LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX);
        }
@@ -4348,7 +4344,7 @@ static int osd_ref_del(const struct lu_env *env, struct dt_object *dt,
        CDEBUG(D_INODE, DFID" decrease nlink %d\n",
               PFID(lu_object_fid(&dt->do_lu)), inode->i_nlink);
 
-       ldiskfs_dec_count(oh->ot_handle, inode);
+       osd_ldiskfs_dec_count(oh->ot_handle, inode);
        spin_unlock(&obj->oo_guard);
 
        osd_dirty_inode(inode, I_DIRTY_DATASYNC);
@@ -7763,6 +7759,8 @@ static void osd_key_exit(const struct lu_context *ctx,
        LASSERT(info->oti_r_locks == 0);
        LASSERT(info->oti_w_locks == 0);
        LASSERT(info->oti_txns    == 0);
+       LASSERTF(info->oti_dio_pages_used == 0, "%d\n",
+                info->oti_dio_pages_used);
 }
 
 /* type constructor/destructor: osd_type_init, osd_type_fini */