* 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;
}
{
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
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) &&
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;
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;
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);
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;
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);
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;
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);
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;
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);
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;
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);