Whamcloud - gitweb
b=22074 block if grant is available or maybe available soon
[fs/lustre-release.git] / lustre / osc / osc_request.c
index 94998c0..074308e 100644 (file)
@@ -1477,24 +1477,31 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
         __u32 client_cksum = 0;
         ENTRY;
 
-        if (rc < 0 && rc != -EDQUOT)
+        if (rc < 0 && rc != -EDQUOT) {
+                DEBUG_REQ(D_INFO, req, "Failed request with rc = %d\n", rc);
                 RETURN(rc);
+        }
 
         LASSERTF(req->rq_repmsg != NULL, "rc = %d\n", rc);
         body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
         if (body == NULL) {
-                CDEBUG(D_INFO, "Can't unpack body\n");
+                DEBUG_REQ(D_INFO, req, "Can't unpack body\n");
                 RETURN(-EPROTO);
         }
 
+#ifdef HAVE_QUOTA_SUPPORT
         /* set/clear over quota flag for a uid/gid */
         if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE &&
             body->oa.o_valid & (OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA)) {
                 unsigned int qid[MAXQUOTAS] = { body->oa.o_uid, body->oa.o_gid };
 
+                CDEBUG(D_QUOTA, "setdq for [%u %u] with valid %llx, flags %x\n",
+                       body->oa.o_uid, body->oa.o_gid, body->oa.o_valid,
+                       body->oa.o_flags);
                 lquota_setdq(quota_interface, cli, qid, body->oa.o_valid,
                              body->oa.o_flags);
         }
+#endif
 
         if (rc < 0)
                 RETURN(rc);
@@ -2811,10 +2818,14 @@ static int osc_enter_cache(const struct lu_env *env,
             osc_enter_cache_try(env, cli, loi, oap, 0))
                 RETURN(0);
 
-        /* Make sure that there are write rpcs in flight to wait for.  This
-         * is a little silly as this object may not have any pending but
-         * other objects sure might. */
-        if (cli->cl_w_in_flight) {
+        /* It is safe to block as a cache waiter as long as there is grant
+         * space available or the hope of additional grant being returned
+         * when an in flight write completes.  Using the write back cache
+         * if possible is preferable to sending the data synchronously
+         * because write pages can then be merged in to large requests.
+         * The addition of this cache waiter will causing pending write
+         * pages to be sent immediately. */
+        if (cli->cl_w_in_flight || cli->cl_avail_grant >= CFS_PAGE_SIZE) {
                 cfs_list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters);
                 cfs_waitq_init(&ocw.ocw_waitq);
                 ocw.ocw_oap = oap;