#include <lustre/lustre_idl.h>
#include <lustre_dlm.h>
#include <lustre_quota.h>
+#include <lustre_nodemap.h>
#include "ofd_internal.h"
strcat(flags, "A");
lustre_cfg_bufs_set_string(&bufs, 1, flags);
lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
- if (!lcfg) {
- CERROR("Cannot alloc lcfg!\n");
+ if (lcfg == NULL)
RETURN_EXIT;
- }
LASSERT(top);
top->ld_ops->ldo_process_config(env, top, lcfg);
return (*p)(env, cookie, LUSTRE_OST_NAME"-object@%p", o);
}
-struct lu_object_operations ofd_obj_ops = {
+static struct lu_object_operations ofd_obj_ops = {
.loo_object_init = ofd_object_init,
.loo_object_free = ofd_object_free,
.loo_object_print = ofd_object_print
* \retval 0 if successful
* \retval negative value on error
*/
-int ofd_set_info_hdl(struct tgt_session_info *tsi)
+static int ofd_set_info_hdl(struct tgt_session_info *tsi)
{
struct ptlrpc_request *req = tgt_ses_req(tsi);
struct ost_body *body = NULL, *repbody;
* \retval 0 if successful
* \retval negative value on error
*/
-int ofd_get_info_hdl(struct tgt_session_info *tsi)
+static int ofd_get_info_hdl(struct tgt_session_info *tsi)
{
struct obd_export *exp = tsi->tsi_exp;
struct ofd_device *ofd = ofd_exp(exp);
CDEBUG(D_HA, "ofd_last_id() = "LPU64" -> diff = %d\n",
ofd_seq_last_oid(oseq), diff);
if (-diff > OST_MAX_PRECREATE) {
- /* FIXME: should reset precreate_next_id on MDS */
+ /* Let MDS know that we are so far ahead. */
+ ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq) + 1);
rc = 0;
} else if (diff < 0) {
rc = ofd_orphans_destroy(tsi->tsi_env, exp,
dlm = req_capsule_client_get(tsi->tsi_pill, &RMF_DLM_REQ);
if (dlm == NULL)
RETURN(-EFAULT);
- ldlm_request_cancel(tgt_ses_req(tsi), dlm, 0);
+ ldlm_request_cancel(tgt_ses_req(tsi), dlm, 0, LATF_SKIP);
}
*fid = body->oa.o_oi.oi_fid;
static int ofd_quotactl(struct tgt_session_info *tsi)
{
struct obd_quotactl *oqctl, *repoqc;
+ struct lu_nodemap *nodemap =
+ tsi->tsi_exp->exp_target_data.ted_nodemap;
+ int id;
int rc;
ENTRY;
RETURN(0);
*repoqc = *oqctl;
+
+ id = repoqc->qc_id;
+ if (oqctl->qc_type == USRQUOTA)
+ id = nodemap_map_id(nodemap, NODEMAP_UID,
+ NODEMAP_CLIENT_TO_FS,
+ repoqc->qc_id);
+ else if (oqctl->qc_type == GRPQUOTA)
+ id = nodemap_map_id(nodemap, NODEMAP_GID,
+ NODEMAP_CLIENT_TO_FS,
+ repoqc->qc_id);
+
+ if (repoqc->qc_id != id)
+ swap(repoqc->qc_id, id);
+
rc = lquotactl_slv(tsi->tsi_env, tsi->tsi_tgt->lut_bottom, repoqc);
ofd_counter_incr(tsi->tsi_exp, LPROC_OFD_STATS_QUOTACTL,
tsi->tsi_jobid, 1);
+ if (repoqc->qc_id != id)
+ swap(repoqc->qc_id, id);
+
RETURN(rc);
}
*
* \retval amount of time to extend the timeout with
*/
-static inline int prolong_timeout(struct ptlrpc_request *req)
+static inline int prolong_timeout(struct ptlrpc_request *req,
+ struct ldlm_lock *lock)
{
struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
if (AT_OFF)
return obd_timeout / 2;
- return max(at_est2timeout(at_get(&svcpt->scp_at_estimate)),
- ldlm_timeout);
+ /* We are in the middle of the process - BL AST is sent, CANCEL
+ is ahead. Take half of AT + IO process time. */
+ return at_est2timeout(at_get(&svcpt->scp_at_estimate)) +
+ (ldlm_bl_timeout(lock) >> 1);
}
/**
*/
static int ofd_prolong_one_lock(struct tgt_session_info *tsi,
struct ldlm_lock *lock,
- struct ldlm_extent *extent, int timeout)
+ struct ldlm_extent *extent)
{
+ int timeout = prolong_timeout(tgt_ses_req(tsi), lock);
if (lock->l_flags & LDLM_FL_DESTROYED) /* lock already cancelled */
return 0;
.end = end
};
struct ldlm_lock *lock;
- int timeout = prolong_timeout(tgt_ses_req(tsi));
int lock_count = 0;
ENTRY;
/* bingo */
LASSERT(lock->l_export == exp);
lock_count = ofd_prolong_one_lock(tsi, lock,
- &extent, timeout);
+ &extent);
LDLM_LOCK_PUT(lock);
RETURN(lock_count);
}
&extent))
continue;
- lock_count += ofd_prolong_one_lock(tsi, lock, &extent, timeout);
+ lock_count += ofd_prolong_one_lock(tsi, lock, &extent);
}
spin_unlock_bh(&exp->exp_bl_list_lock);
ofd_punch_hpreq_check(req);
}
-struct ptlrpc_hpreq_ops ofd_hpreq_rw = {
+static struct ptlrpc_hpreq_ops ofd_hpreq_rw = {
.hpreq_lock_match = ofd_rw_hpreq_lock_match,
.hpreq_check = ofd_rw_hpreq_check,
.hpreq_fini = ofd_rw_hpreq_fini
};
-struct ptlrpc_hpreq_ops ofd_hpreq_punch = {
+static struct ptlrpc_hpreq_ops ofd_hpreq_punch = {
.hpreq_lock_match = ofd_punch_hpreq_lock_match,
.hpreq_check = ofd_punch_hpreq_check,
.hpreq_fini = ofd_punch_hpreq_fini
* \retval 0 if successful
* \retval negative value on error
*/
-int __init ofd_init(void)
+static int __init ofd_init(void)
{
int rc;
* This function is called upon OFD module unloading.
* It frees all related structures and unregisters OFD device type.
*/
-void __exit ofd_exit(void)
+static void __exit ofd_exit(void)
{
ofd_fmd_exit();
lu_kmem_fini(ofd_caches);