Whamcloud - gitweb
LU-13135 quota: improve checks in OSDs to ignore quota 32/37232/16
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 14 Jan 2020 19:38:51 +0000 (22:38 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 8 Nov 2022 08:51:03 +0000 (08:51 +0000)
for root-owned files.

sanity/60a:
  zfs before 80s, after 66s
  ldiskfs before 65s, after 38s

ave.write declaration in sanity/60a:
  zfs before 3.21 usec, after 1.16 usec
  ldiskfs before 4.06 usec, after 0.66 usec

Change-Id: Ib9ba50d260eac408f1f5e43c4d722ff5024135cf
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/37232
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wangshilong1991@gmail.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_quota.c
lustre/osd-zfs/osd_quota.c
lustre/quota/qsd_handler.c

index 661690a..dd7dcf9 100644 (file)
@@ -1932,6 +1932,12 @@ static int osd_trans_start(const struct lu_env *env, struct dt_device *d,
        if (OBD_FAIL_CHECK(OBD_FAIL_OSD_TXN_START))
                GOTO(out, rc = -EIO);
 
+        /*
+         * we ignore quota checks for system-owned files, but still
+         * need to count blocks for uid/gid/projid
+         */
+       osd_trans_declare_op(env, oh, OSD_OT_QUOTA, 3);
+
        /*
         * XXX temporary stuff. Some abstraction layer should
         * be used.
index c69cfcd..b28338c 100644 (file)
@@ -654,6 +654,10 @@ int osd_declare_inode_qid(const struct lu_env *env, qid_t uid, qid_t gid,
                        th->th_ignore_quota;
        ENTRY;
 
+       /* very fast path for special files like llog */
+       if (uid == 0 && gid == 0 && projid == 0)
+               return 0;
+
        /* let's start with user quota */
        qi->lqi_id.qid_uid = uid;
        qi->lqi_type = USRQUOTA;
index 2e75b8c..7296f3e 100644 (file)
@@ -529,6 +529,10 @@ int osd_declare_quota(const struct lu_env *env, struct osd_device *osd,
                        th->th_ignore_quota;
        ENTRY;
 
+       /* very fast path for special files like llog */
+       if (uid == 0 && gid == 0 && projid == 0)
+               return 0;
+
        if (osd_qid_declare_flags & OSD_QID_INODE)
                qsd = osd->od_quota_slave_md;
        else if (osd_qid_declare_flags & OSD_QID_BLK)
index 0c34e6c..01433b6 100644 (file)
@@ -857,6 +857,10 @@ int qsd_op_begin(const struct lu_env *env, struct qsd_instance *qsd,
        bool    found = false;
        ENTRY;
 
+       /* fast path, ignore quota enforcement request for root owned files */
+       if (qi->lqi_id.qid_uid == 0)
+               return 0;
+
        if (unlikely(qsd == NULL))
                RETURN(0);
 
@@ -880,7 +884,7 @@ int qsd_op_begin(const struct lu_env *env, struct qsd_instance *qsd,
         *    - quota isn't enforced for this quota type
         * or - the user/group is root
         * or - quota accounting isn't enabled */
-       if (!qsd_type_enabled(qsd, qi->lqi_type) || qi->lqi_id.qid_uid == 0 ||
+       if (!qsd_type_enabled(qsd, qi->lqi_type) ||
            (qsd->qsd_type_array[qi->lqi_type])->qqi_acct_failed)
                RETURN(0);