Whamcloud - gitweb
Branch b1_6
authorvitaly <vitaly>
Mon, 18 Feb 2008 12:43:20 +0000 (12:43 +0000)
committervitaly <vitaly>
Mon, 18 Feb 2008 12:43:20 +0000 (12:43 +0000)
b=14379
i=green
i=tappro

increase the amount of buffers for ELC RPCs when there is no conflicting
locks but we cancel locks from lru.

lustre/ldlm/ldlm_request.c
lustre/mdc/mdc_reint.c
lustre/osc/osc_request.c

index eb5fcc6..3ee57d1 100644 (file)
@@ -511,18 +511,14 @@ cleanup:
  * a single page on the send/receive side. XXX: 512 should be changed
  * to more adequate value. */
 static inline int ldlm_req_handles_avail(struct obd_export *exp,
-                                         int *size, int bufcount,
-                                         int bufoff, int off)
+                                         int *size, int bufcount, int off)
 {
         int avail = min_t(int, LDLM_MAXREQSIZE, PAGE_SIZE - 512);
-        int old_size = size[bufoff];
 
-        size[bufoff] = sizeof(struct ldlm_request);
         avail -= lustre_msg_size(class_exp2cliimp(exp)->imp_msg_magic,
                                  bufcount, size);
         avail /= sizeof(struct lustre_handle);
         avail += LDLM_LOCKREQ_HANDLES - off;
-        size[bufoff] = old_size;
 
         return avail;
 }
@@ -531,7 +527,7 @@ static inline int ldlm_cancel_handles_avail(struct obd_export *exp)
 {
         int size[2] = { sizeof(struct ptlrpc_body),
                         sizeof(struct ldlm_request) };
-        return ldlm_req_handles_avail(exp, size, 2, DLM_LOCKREQ_OFF, 0);
+        return ldlm_req_handles_avail(exp, size, 2, 0);
 }
 
 /* Cancel lru locks and pack them into the enqueue request. Pack there the given
@@ -552,8 +548,9 @@ struct ptlrpc_request *ldlm_prep_elc_req(struct obd_export *exp, int version,
                 cancels = &head;
         if (exp_connect_cancelset(exp)) {
                 /* Estimate the amount of free space in the request. */
-                avail = ldlm_req_handles_avail(exp, size, bufcount,
-                                               bufoff, canceloff);
+                LASSERT(bufoff < bufcount);
+
+                avail = ldlm_req_handles_avail(exp, size, bufcount, canceloff);
                 flags = ns_connect_lru_resize(ns) ? 
                         LDLM_CANCEL_LRUR : LDLM_CANCEL_AGED;
                 to_free = !ns_connect_lru_resize(ns) &&
@@ -942,7 +939,7 @@ int ldlm_cli_cancel_req(struct obd_export *exp,
         if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_RACE))
                 RETURN(count);
 
-        free = ldlm_req_handles_avail(exp, size, 2, DLM_LOCKREQ_OFF, 0);
+        free = ldlm_req_handles_avail(exp, size, 2, 0);
         if (count > free)
                 count = free;
 
index 0b39336..2e663f9 100644 (file)
@@ -111,7 +111,8 @@ int mdc_setattr(struct obd_export *exp, struct mdc_op_data *op_data,
         struct mdc_rpc_lock *rpc_lock;
         struct obd_device *obd = exp->exp_obd;
         int size[5] = { sizeof(struct ptlrpc_body),
-                        sizeof(*rec), ealen, ea2len, 0 };
+                        sizeof(*rec), ealen, ea2len,
+                        sizeof(struct ldlm_request) };
         int count, bufcount = 2, rc;
         __u64 bits;
         ENTRY;
@@ -129,7 +130,7 @@ int mdc_setattr(struct obd_export *exp, struct mdc_op_data *op_data,
                 bits |= MDS_INODELOCK_LOOKUP;
         count = mdc_resource_get_unused(exp, &op_data->fid1,
                                         &cancels, LCK_EX, bits);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 5;
         req = mdc_prep_elc_req(exp, bufcount, size,
                                REQ_REC_OFF + 3, &cancels, count);
@@ -171,7 +172,7 @@ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
         int level, bufcount = 3, rc;
         int size[5] = { sizeof(struct ptlrpc_body),
                         sizeof(struct mds_rec_create),
-                        op_data->namelen + 1, 0, 0 };
+                        op_data->namelen + 1, 0, sizeof(struct ldlm_request) };
         int count;
         ENTRY;
 
@@ -182,7 +183,7 @@ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
 
         count = mdc_resource_get_unused(exp, &op_data->fid1, &cancels,
                                         LCK_EX, MDS_INODELOCK_UPDATE);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 5;
         req = mdc_prep_elc_req(exp, bufcount, size,
                                REQ_REC_OFF + 3, &cancels, count);
@@ -221,7 +222,7 @@ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *op_data,
         struct ptlrpc_request *req = *request;
         int size[4] = { sizeof(struct ptlrpc_body),
                         sizeof(struct mds_rec_unlink),
-                        op_data->namelen + 1, 0 };
+                        op_data->namelen + 1, sizeof(struct ldlm_request) };
         int count, rc, bufcount = 3;
         ENTRY;
 
@@ -231,7 +232,7 @@ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *op_data,
         if (op_data->fid3.id)
                 count += mdc_resource_get_unused(exp, &op_data->fid3, &cancels,
                                                  LCK_EX, MDS_INODELOCK_FULL);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 4;
         req = mdc_prep_elc_req(exp, bufcount, size,
                                REQ_REC_OFF + 2, &cancels, count);
@@ -260,7 +261,7 @@ int mdc_link(struct obd_export *exp, struct mdc_op_data *op_data,
         struct ptlrpc_request *req;
         int size[4] = { sizeof(struct ptlrpc_body),
                         sizeof(struct mds_rec_link),
-                        op_data->namelen + 1, 0 };
+                        op_data->namelen + 1, sizeof(struct ldlm_request) };
         int count, rc, bufcount = 3;
         ENTRY;
 
@@ -268,7 +269,7 @@ int mdc_link(struct obd_export *exp, struct mdc_op_data *op_data,
                                         LCK_EX, MDS_INODELOCK_UPDATE);
         count += mdc_resource_get_unused(exp, &op_data->fid2, &cancels,
                                          LCK_EX, MDS_INODELOCK_UPDATE);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 4;
         req = mdc_prep_elc_req(exp, bufcount, size,
                                REQ_REC_OFF + 2, &cancels, count);
@@ -297,7 +298,7 @@ int mdc_rename(struct obd_export *exp, struct mdc_op_data *op_data,
         struct ptlrpc_request *req;
         int size[5] = { sizeof(struct ptlrpc_body),
                         sizeof(struct mds_rec_rename),
-                        oldlen + 1, newlen + 1, 0 };
+                        oldlen + 1, newlen + 1, sizeof(struct ldlm_request) };
         int count, rc, bufcount = 4;
         ENTRY;
 
@@ -311,7 +312,7 @@ int mdc_rename(struct obd_export *exp, struct mdc_op_data *op_data,
         if (op_data->fid4.id)
                 count += mdc_resource_get_unused(exp, &op_data->fid4, &cancels,
                                                  LCK_EX, MDS_INODELOCK_FULL);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 5;
         req = mdc_prep_elc_req(exp, bufcount, size,
                                REQ_REC_OFF + 3, &cancels, count);
index 50c25fe..5839884 100644 (file)
@@ -615,7 +615,8 @@ static int osc_destroy(struct obd_export *exp, struct obdo *oa,
         CFS_LIST_HEAD(cancels);
         struct ptlrpc_request *req;
         struct ost_body *body;
-        int size[3] = { sizeof(struct ptlrpc_body), sizeof(*body), 0 };
+        int size[3] = { sizeof(struct ptlrpc_body), sizeof(*body),
+                        sizeof(struct ldlm_request) };
         int count, bufcount = 2;
         struct client_obd *cli = &exp->exp_obd->u.cli;
         ENTRY;
@@ -627,7 +628,7 @@ static int osc_destroy(struct obd_export *exp, struct obdo *oa,
 
         count = osc_resource_get_unused(exp, oa->o_id, &cancels, LCK_PW,
                                         LDLM_FL_DISCARD_DATA);
-        if (exp_connect_cancelset(exp) && count)
+        if (exp_connect_cancelset(exp))
                 bufcount = 3;
         req = ldlm_prep_elc_req(exp, LUSTRE_OST_VERSION, OST_DESTROY, bufcount,
                                 size, REQ_REC_OFF + 1, 0, &cancels, count);