Whamcloud - gitweb
b=23500 Send quota broadcast requests in parallel
authorLanden <landen@sun.com>
Mon, 23 Aug 2010 14:48:13 +0000 (18:48 +0400)
committerMikhail Pershin <tappro@sun.com>
Sun, 29 Aug 2010 19:45:16 +0000 (23:45 +0400)
Quota broadcast requests are sent sequentially, while it would be
more efficient to send all the requests simultaneously.

i=johann
i=panda

lustre/include/lustre_quota.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/ost/ost_handler.c
lustre/quota/quota_adjust_qunit.c
lustre/quota/quota_internal.h
lustre/quota/quota_master.c

index 82071a3..6da7ce8 100644 (file)
@@ -559,7 +559,8 @@ typedef struct {
          */
         int (*quota_adjust_qunit) (struct obd_export *exp,
                                    struct quota_adjust_qunit *oqaq,
-                                   struct lustre_quota_ctxt *qctxt);
+                                   struct lustre_quota_ctxt *qctxt,
+                                   struct ptlrpc_request_set *rqset);
 
 } quota_interface_t;
 
index e9a70be..deadc7b 100644 (file)
@@ -1389,7 +1389,8 @@ struct obd_ops {
                           struct obd_quotactl *);
         int (*o_quota_adjust_qunit)(struct obd_export *exp,
                                     struct quota_adjust_qunit *oqaq,
-                                    struct lustre_quota_ctxt *qctxt);
+                                    struct lustre_quota_ctxt *qctxt,
+                                    struct ptlrpc_request_set *rqset);
 
 
         int (*o_ping)(struct obd_export *exp);
index 22fda83..f211b1d 100644 (file)
@@ -1626,7 +1626,8 @@ static inline int obd_quotactl(struct obd_export *exp,
 
 static inline int obd_quota_adjust_qunit(struct obd_export *exp,
                                          struct quota_adjust_qunit *oqaq,
-                                         struct lustre_quota_ctxt *qctxt)
+                                         struct lustre_quota_ctxt *qctxt,
+                                         struct ptlrpc_request_set *set)
 {
 #if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
         struct timeval work_start;
@@ -1643,7 +1644,7 @@ static inline int obd_quota_adjust_qunit(struct obd_export *exp,
         EXP_CHECK_DT_OP(exp, quota_adjust_qunit);
         EXP_COUNTER_INCREMENT(exp, quota_adjust_qunit);
 
-        rc = OBP(exp->exp_obd, quota_adjust_qunit)(exp, oqaq, qctxt);
+        rc = OBP(exp->exp_obd, quota_adjust_qunit)(exp, oqaq, qctxt, set);
 
 #if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
         if (qctxt) {
index 36319d8..69157b1 100644 (file)
@@ -1528,7 +1528,7 @@ static int ost_handle_quota_adjust_qunit(struct ptlrpc_request *req)
                 GOTO(out, rc);
 
         repoqa = req_capsule_server_get(&req->rq_pill, &RMF_QUOTA_ADJUST_QUNIT);
-        req->rq_status = obd_quota_adjust_qunit(req->rq_export, oqaq, qctxt);
+        req->rq_status = obd_quota_adjust_qunit(req->rq_export, oqaq, qctxt, NULL);
         *repoqa = *oqaq;
 
  out:
index 6b1f5ca..8f01e0d 100644 (file)
@@ -265,7 +265,8 @@ int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq,
 
 int filter_quota_adjust_qunit(struct obd_export *exp,
                               struct quota_adjust_qunit *oqaq,
-                              struct lustre_quota_ctxt *qctxt)
+                              struct lustre_quota_ctxt *qctxt,
+                              struct ptlrpc_request_set *rqset)
 {
         struct obd_device *obd = exp->exp_obd;
         unsigned int id[MAXQUOTAS] = { 0, 0 };
@@ -301,7 +302,8 @@ int filter_quota_adjust_qunit(struct obd_export *exp,
 
 int client_quota_adjust_qunit(struct obd_export *exp,
                               struct quota_adjust_qunit *oqaq,
-                              struct lustre_quota_ctxt *qctxt)
+                              struct lustre_quota_ctxt *qctxt,
+                              struct ptlrpc_request_set *rqset)
 {
         struct ptlrpc_request *req;
         struct quota_adjust_qunit *oqa;
@@ -317,6 +319,8 @@ int client_quota_adjust_qunit(struct obd_export *exp,
         if (strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_OSC_NAME))
                 RETURN(-EINVAL);
 
+        LASSERT(rqset);
+
         req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
                                         &RQF_OST_QUOTA_ADJUST_QUNIT,
                                         LUSTRE_OST_VERSION,
@@ -329,21 +333,19 @@ int client_quota_adjust_qunit(struct obd_export *exp,
 
         ptlrpc_request_set_replen(req);
 
-        rc = ptlrpc_queue_wait(req);
-        if (rc)
-                CERROR("%s: %s failed: rc = %d\n", exp->exp_obd->obd_name,
-                       __FUNCTION__, rc);
-        ptlrpc_req_finished(req);
+        ptlrpc_set_add_req(rqset, req);
         RETURN (rc);
 }
 
 int lov_quota_adjust_qunit(struct obd_export *exp,
                            struct quota_adjust_qunit *oqaq,
-                           struct lustre_quota_ctxt *qctxt)
+                           struct lustre_quota_ctxt *qctxt,
+                           struct ptlrpc_request_set *rqset)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct lov_obd *lov = &obd->u.lov;
-        int i, rc = 0;
+        int i, err, rc = 0;
+        unsigned no_set = 0;
         ENTRY;
 
         if (!QAQ_IS_ADJBLK(oqaq)) {
@@ -351,9 +353,16 @@ int lov_quota_adjust_qunit(struct obd_export *exp,
                 RETURN(-EFAULT);
         }
 
+
+        if (rqset == NULL) {
+                rqset = ptlrpc_prep_set();
+                if (!rqset)
+                        RETURN(-ENOMEM);
+                no_set = 1;
+        }
+
         obd_getref(obd);
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
-                int err;
 
                 if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) {
                         CDEBUG(D_HA, "ost %d is inactive\n", i);
@@ -361,13 +370,22 @@ int lov_quota_adjust_qunit(struct obd_export *exp,
                 }
 
                 err = obd_quota_adjust_qunit(lov->lov_tgts[i]->ltd_exp, oqaq,
-                                             NULL);
+                                             NULL, rqset);
                 if (err) {
                         if (lov->lov_tgts[i]->ltd_active && !rc)
                                 rc = err;
                         continue;
                 }
         }
+
+        err = ptlrpc_set_wait(rqset);
+        if (!rc)
+                rc = err;
+
+        /* Destroy the set if none was provided by the caller */
+        if (no_set)
+                ptlrpc_set_destroy(rqset);
+
         obd_putref(obd);
         RETURN(rc);
 }
index 563c1e7..042bbe2 100644 (file)
@@ -176,7 +176,8 @@ extern int quote_copy_qdata(struct ptlrpc_request *req, struct qunit_data *qdata
                             int is_req, int is_exp);
 int filter_quota_adjust_qunit(struct obd_export *exp,
                               struct quota_adjust_qunit *oqaq,
-                              struct lustre_quota_ctxt *qctxt);
+                              struct lustre_quota_ctxt *qctxt,
+                              struct ptlrpc_request_set *rqset);
 int lquota_proc_setup(struct obd_device *obd, int is_master);
 int lquota_proc_cleanup(struct lustre_quota_ctxt *qctxt);
 void build_lqs(struct obd_device *obd);
@@ -195,10 +196,13 @@ extern cfs_proc_dir_entry_t *lquota_type_proc_dir;
 #endif
 int client_quota_adjust_qunit(struct obd_export *exp,
                               struct quota_adjust_qunit *oqaq,
-                              struct lustre_quota_ctxt *qctxt);
+                              struct lustre_quota_ctxt *qctxt,
+                              struct ptlrpc_request_set *set);
+
 int lov_quota_adjust_qunit(struct obd_export *exp,
                            struct quota_adjust_qunit *oqaq,
-                           struct lustre_quota_ctxt *qctxt);
+                           struct lustre_quota_ctxt *qctxt,
+                           struct ptlrpc_request_set *rqset);
 int client_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                      struct obd_quotactl *oqctl);
 int lmv_quota_ctl(struct obd_device *unused, struct obd_export *exp,
index 0af7afd..7a3ec0e 100644 (file)
@@ -324,7 +324,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
 
         /* only when block qunit is reduced, boardcast to osts */
         if ((adjust_res & LQS_BLK_DECREASE) && QAQ_IS_ADJBLK(oqaq))
-                rc = obd_quota_adjust_qunit(mds->mds_lov_exp, oqaq, qctxt);
+                rc = obd_quota_adjust_qunit(mds->mds_lov_exp, oqaq, qctxt, NULL);
 
 out:
         lustre_dqput(dquot);
@@ -1254,7 +1254,7 @@ static void adjust_lqs(struct obd_device *obd, struct quota_adjust_qunit *qaq)
 
         /* adjust remote lqs */
         if (QAQ_IS_ADJBLK(qaq)) {
-                rc = obd_quota_adjust_qunit(obd->u.mds.mds_lov_exp, qaq, qctxt);
+                rc = obd_quota_adjust_qunit(obd->u.mds.mds_lov_exp, qaq, qctxt, NULL);
                 if (rc < 0)
                         CERROR("adjust slaves' qunit size failed!(rc=%d)\n", rc);