* @objid. Found locks are added into @cancel list. Returns the amount of
* locks added to @cancels list. */
static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa,
- cfs_list_t *cancels,
- ldlm_mode_t mode, int lock_flags)
+ cfs_list_t *cancels,
+ ldlm_mode_t mode, __u64 lock_flags)
{
struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
struct ldlm_res_id res_id;
CERROR("dirty %lu - %lu > dirty_max %lu\n",
cli->cl_dirty, cli->cl_dirty_transit, cli->cl_dirty_max);
oa->o_undirty = 0;
- } else if (unlikely(cfs_atomic_read(&obd_dirty_pages) -
+ } else if (unlikely(cfs_atomic_read(&obd_unstable_pages) +
+ cfs_atomic_read(&obd_dirty_pages) -
cfs_atomic_read(&obd_dirty_transit_pages) >
(long)(obd_max_dirty_pages + 1))) {
/* The cfs_atomic_read() allowing the cfs_atomic_inc() are
* not covered by a lock thus they may safely race and trip
* this CERROR() unless we add in a small fudge factor (+1). */
- CERROR("dirty %d - %d > system dirty_max %d\n",
+ CERROR("%s: dirty %d + %d - %d > system dirty_max %d\n",
+ cli->cl_import->imp_obd->obd_name,
+ cfs_atomic_read(&obd_unstable_pages),
cfs_atomic_read(&obd_dirty_pages),
cfs_atomic_read(&obd_dirty_transit_pages),
obd_max_dirty_pages);
aa->aa_resends++;
new_req->rq_interpret_reply = request->rq_interpret_reply;
new_req->rq_async_args = request->rq_async_args;
+ new_req->rq_commit_cb = request->rq_commit_cb;
/* cap resend delay to the current request timeout, this is similar to
* what ptlrpc does (see after_reply()) */
if (aa->aa_resends > new_req->rq_timeout)
RETURN(rc);
}
+static void brw_commit(struct ptlrpc_request *req)
+{
+ spin_lock(&req->rq_lock);
+ /* If osc_inc_unstable_pages (via osc_extent_finish) races with
+ * this called via the rq_commit_cb, I need to ensure
+ * osc_dec_unstable_pages is still called. Otherwise unstable
+ * pages may be leaked. */
+ if (req->rq_unstable) {
+ spin_unlock(&req->rq_lock);
+ osc_dec_unstable_pages(req);
+ spin_lock(&req->rq_lock);
+ } else {
+ req->rq_committed = 1;
+ }
+ spin_unlock(&req->rq_lock);
+}
+
/**
* Build an RPC by the list of extent @ext_list. The caller must ensure
* that the total pages in this list are NOT over max pages per RPC.
GOTO(out, rc);
}
+ req->rq_commit_cb = brw_commit;
req->rq_interpret_reply = brw_interpret;
+
if (mem_tight != 0)
req->rq_memalloc = 1;
}
void osc_update_enqueue(struct lustre_handle *lov_lockhp,
- struct lov_oinfo *loi, int flags,
- struct ost_lvb *lvb, __u32 mode, int rc)
+ struct lov_oinfo *loi, __u64 flags,
+ struct ost_lvb *lvb, __u32 mode, int rc)
{
struct ldlm_lock *lock = ldlm_handle2lock(lov_lockhp);
* release locks just after they are obtained. */
int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
__u64 *flags, ldlm_policy_data_t *policy,
- struct ost_lvb *lvb, int kms_valid,
- obd_enqueue_update_f upcall, void *cookie,
- struct ldlm_enqueue_info *einfo,
- struct lustre_handle *lockh,
- struct ptlrpc_request_set *rqset, int async, int agl)
-{
- struct obd_device *obd = exp->exp_obd;
- struct ptlrpc_request *req = NULL;
- int intent = *flags & LDLM_FL_HAS_INTENT;
- int match_lvb = (agl != 0 ? 0 : LDLM_FL_LVB_READY);
- ldlm_mode_t mode;
- int rc;
- ENTRY;
+ struct ost_lvb *lvb, int kms_valid,
+ obd_enqueue_update_f upcall, void *cookie,
+ struct ldlm_enqueue_info *einfo,
+ struct lustre_handle *lockh,
+ struct ptlrpc_request_set *rqset, int async, int agl)
+{
+ struct obd_device *obd = exp->exp_obd;
+ struct ptlrpc_request *req = NULL;
+ int intent = *flags & LDLM_FL_HAS_INTENT;
+ __u64 match_lvb = (agl != 0 ? 0 : LDLM_FL_LVB_READY);
+ ldlm_mode_t mode;
+ int rc;
+ ENTRY;
/* Filesystem lock extents are extended to page boundaries so that
* dealing with the page cache is a little smoother. */
if (mode) {
struct ldlm_lock *matched = ldlm_handle2lock(lockh);
- if ((agl != 0) && !(matched->l_flags & LDLM_FL_LVB_READY)) {
+ if ((agl != 0) && !ldlm_is_lvb_ready(matched)) {
/* For AGL, if enqueue RPC is sent but the lock is not
* granted, then skip to process this strpe.
* Return -ECANCELED to tell the caller. */
}
int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id,
- __u32 type, ldlm_policy_data_t *policy, __u32 mode,
- int *flags, void *data, struct lustre_handle *lockh,
- int unref)
+ __u32 type, ldlm_policy_data_t *policy, __u32 mode,
+ __u64 *flags, void *data, struct lustre_handle *lockh,
+ int unref)
{
- struct obd_device *obd = exp->exp_obd;
- int lflags = *flags;
- ldlm_mode_t rc;
- ENTRY;
+ struct obd_device *obd = exp->exp_obd;
+ __u64 lflags = *flags;
+ ldlm_mode_t rc;
+ ENTRY;
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_MATCH))
RETURN(-EIO);