Whamcloud - gitweb
LU-10048 ofd: take local locks within transaction
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
index 6a0dd48..03552be 100644 (file)
@@ -580,31 +580,20 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
                if (obj != NULL)
                        inode = obj->oo_inode;
 
-               /* root ID entry should be always present in the quota file */
                if (qi->lqi_id.qid_uid == 0) {
+                       /* root ID should be always present in the quota file */
                        crd = 1;
                } else {
-                       /*
-                        * used space for this ID could be dropped to zero,
+                       /* can't rely on the current state as it can change
+                        * by the execution.
+                        * if used space for this ID could be dropped to zero,
                         * reserve extra credits for removing ID entry from
                         * the quota file
                         */
                        if (qi->lqi_space < 0)
                                crd = LDISKFS_QUOTA_DEL_BLOCKS(osd_sb(dev));
-                       /*
-                        * reserve credits for adding ID entry to the quota
-                        * file if the i_dquot isn't initialized yet.
-                        */
-                       else if (inode == NULL ||
-#ifdef HAVE_EXT4_INFO_DQUOT
-                                LDISKFS_I(inode)->i_dquot[qi->lqi_type] ==
-                                       NULL)
-#else
-                                inode->i_dquot[qi->lqi_type] == NULL)
-#endif
-                               crd = LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev));
                        else
-                               crd = 1;
+                               crd = LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev));
                }
 
                osd_trans_declare_op(env, oh, OSD_OT_QUOTA, crd);