Details : Instead of specifying each ldlm_lock call-back through separate
parameter, wrap them into struct ldlm_callback_suite.
+Severity : normal
+Bugzilla : 16450
+Description: Kill join_lru obd method and its callers.
+Details : CLIO uses lock weighting policy to keep locks over mmapped regions
+ in memory---a requirement implemented through ->o_join_lru() obd
+ method in HEAD. Remove this method and its users.
+
--------------------------------------------------------------------------------
2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com>
ldlm_mode_t mode, int flags, void *opaque);
int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *head,
int count, int flags);
-int ldlm_cli_join_lru(struct ldlm_namespace *,
- const struct ldlm_res_id *, int join);
int ldlm_cancel_resource_local(struct ldlm_resource *res,
struct list_head *cancels,
ldlm_policy_data_t *policy,
__u32 mode, struct lustre_handle *);
int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
int flags, void *opaque);
- int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *,
- int join);
int (*o_init_export)(struct obd_export *exp);
int (*o_destroy_export)(struct obd_export *exp);
int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *,
RETURN(rc);
}
-static inline int obd_join_lru(struct obd_export *exp,
- struct lov_stripe_md *ea, int join)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, join_lru);
- EXP_COUNTER_INCREMENT(exp, join_lru);
-
- rc = OBP(exp->exp_obd, join_lru)(exp, ea, join);
- RETURN(rc);
-}
-
static inline int obd_pin(struct obd_export *exp, const struct lu_fid *fid,
struct obd_capa *oc, struct obd_client_handle *handle,
int flag)
ldlm_handle_bl_callback(ns, NULL, lock);
} else if (ns_is_client(ns) &&
!lock->l_readers && !lock->l_writers &&
- !(lock->l_flags & LDLM_FL_NO_LRU) &&
!(lock->l_flags & LDLM_FL_BL_AST)) {
/* If this is a client-side namespace and this was the last
* reference, put it on the LRU. */
EXPORT_SYMBOL(ldlm_cli_cancel_unused);
EXPORT_SYMBOL(ldlm_cli_cancel_unused_resource);
EXPORT_SYMBOL(ldlm_cli_cancel_req);
-EXPORT_SYMBOL(ldlm_cli_join_lru);
EXPORT_SYMBOL(ldlm_replay_locks);
EXPORT_SYMBOL(ldlm_resource_foreach);
EXPORT_SYMBOL(ldlm_namespace_foreach);
RETURN(ELDLM_OK);
}
-/* join/split resource locks to/from lru list */
-int ldlm_cli_join_lru(struct ldlm_namespace *ns,
- const struct ldlm_res_id *res_id, int join)
-{
- struct ldlm_resource *res;
- struct ldlm_lock *lock, *n;
- int count = 0;
- ENTRY;
-
- LASSERT(ns_is_client(ns));
-
- res = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
- if (res == NULL)
- RETURN(count);
- LASSERT(res->lr_type == LDLM_EXTENT);
-
- lock_res(res);
- if (!join)
- goto split;
-
- list_for_each_entry_safe (lock, n, &res->lr_granted, l_res_link) {
- if (list_empty(&lock->l_lru) &&
- !lock->l_readers && !lock->l_writers &&
- !(lock->l_flags & LDLM_FL_LOCAL) &&
- !(lock->l_flags & LDLM_FL_CBPENDING) &&
- !(lock->l_flags & LDLM_FL_BL_AST)) {
- ldlm_lock_add_to_lru(lock);
- lock->l_flags &= ~LDLM_FL_NO_LRU;
- LDLM_DEBUG(lock, "join lock to lru");
- count++;
- }
- }
- goto unlock;
-split:
- spin_lock(&ns->ns_unused_lock);
- list_for_each_entry_safe (lock, n, &ns->ns_unused_list, l_lru) {
- if (lock->l_resource == res) {
- ldlm_lock_remove_from_lru_nolock(lock);
- lock->l_flags |= LDLM_FL_NO_LRU;
- LDLM_DEBUG(lock, "split lock from lru");
- count++;
- }
- }
- spin_unlock(&ns->ns_unused_lock);
-unlock:
- unlock_res(res);
- ldlm_resource_putref(res);
- RETURN(count);
-}
-
/* Lock iterators. */
int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter,
LASSERT(!lustre_handle_is_used(lockh));
LASSERT(lsm != NULL);
- /* don't drop the mmapped file to LRU */
- if (mapping_mapped(inode->i_mapping))
- ast_flags |= LDLM_FL_NO_LRU;
-
/* XXX phil: can we do this? won't it screw the file size up? */
if ((fd && (fd->fd_flags & LL_FILE_IGNORE_LOCK)) ||
(sbi->ll_flags & LL_SBI_NOLCK))
lsm = lli->lli_smd;
rc = ll_extent_lock(fd, inode, lsm, mode, &policy,
- &lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU);
+ &lockh, LDLM_FL_CBPENDING);
if (rc != 0)
RETURN(NULL);
LASSERT(atomic_read(&lli->lli_mmap_cnt) >= 0);
atomic_inc(&lli->lli_mmap_cnt);
- if (atomic_read(&lli->lli_mmap_cnt) == 1) {
- struct lov_stripe_md *lsm = lli->lli_smd;
- struct ll_sb_info *sbi = ll_i2sbi(inode);
- int count;
-
- spin_unlock(&lli->lli_lock);
-
- if (!lsm)
- return;
- count = obd_join_lru(sbi->ll_dt_exp, lsm, 0);
- VMA_DEBUG(vma, "split %d unused locks from lru\n", count);
- } else {
spin_unlock(&lli->lli_lock);
- }
-
}
static void ll_vm_close(struct vm_area_struct *vma)
LASSERT(atomic_read(&lli->lli_mmap_cnt) > 0);
atomic_dec(&lli->lli_mmap_cnt);
- if (atomic_read(&lli->lli_mmap_cnt) == 0) {
- struct lov_stripe_md *lsm = lli->lli_smd;
- struct ll_sb_info *sbi = ll_i2sbi(inode);
- int count;
-
spin_unlock(&lli->lli_lock);
-
- if (!lsm)
- return;
- count = obd_join_lru(sbi->ll_dt_exp, lsm, 1);
- VMA_DEBUG(vma, "join %d unused locks to lru\n", count);
- } else {
- spin_unlock(&lli->lli_lock);
- }
}
#ifndef HAVE_FILEMAP_POPULATE
RETURN(rc);
}
-static int lov_join_lru(struct obd_export *exp,
- struct lov_stripe_md *lsm, int join)
-{
- struct lov_obd *lov;
- int i, count = 0;
- ENTRY;
-
- ASSERT_LSM_MAGIC(lsm);
- if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
-
- lov = &exp->exp_obd->u.lov;
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- struct lov_stripe_md submd;
- struct lov_oinfo *loi = lsm->lsm_oinfo[i];
- int rc = 0;
-
- if (!lov->lov_tgts[loi->loi_ost_idx]) {
- CDEBUG(D_HA, "lov idx %d NULL\n", loi->loi_ost_idx);
- continue;
- }
-
- if (!lov->lov_tgts[loi->loi_ost_idx]->ltd_active)
- CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
-
- submd.lsm_object_id = loi->loi_id;
- submd.lsm_object_gr = lsm->lsm_object_gr;
- submd.lsm_stripe_count = 0;
- rc = obd_join_lru(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp,
- &submd, join);
- if (rc < 0) {
- CERROR("join lru failed. objid: "LPX64" subobj: "LPX64
- " ostidx: %d rc: %d\n", lsm->lsm_object_id,
- loi->loi_id, loi->loi_ost_idx, rc);
- return rc;
- } else {
- count += rc;
- }
- }
- RETURN(count);
-}
-
static int lov_statfs_interpret(struct ptlrpc_request_set *rqset,
void *data, int rc)
{
.o_change_cbdata = lov_change_cbdata,
.o_cancel = lov_cancel,
.o_cancel_unused = lov_cancel_unused,
- .o_join_lru = lov_join_lru,
.o_iocontrol = lov_iocontrol,
.o_get_info = lov_get_info,
.o_set_info_async = lov_set_info_async,
LPROCFS_OBD_OP_INIT(num_private_stats, stats, change_cbdata);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, cancel);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, cancel_unused);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, join_lru);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, extent_calc);
}
#endif
lock->l_ast_data = data;
- lock->l_flags |= (flags & LDLM_FL_NO_LRU);
unlock_res_and_lock(lock);
LDLM_LOCK_PUT(lock);
}
return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags, opaque);
}
-static int osc_join_lru(struct obd_export *exp,
- struct lov_stripe_md *lsm, int join)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct ldlm_res_id res_id, *resp = NULL;
-
- if (lsm != NULL) {
- resp = osc_build_res_name(lsm->lsm_object_id,
- lsm->lsm_object_gr, &res_id);
- }
-
- return ldlm_cli_join_lru(obd->obd_namespace, resp, join);
-}
-
-static int osc_statfs_interpret(struct ptlrpc_request *req,
+static int osc_statfs_interpret(const struct lu_env *env,
+ struct ptlrpc_request *req,
struct osc_async_args *aa, int rc)
{
struct obd_statfs *msfs;
.o_change_cbdata = osc_change_cbdata,
.o_cancel = osc_cancel,
.o_cancel_unused = osc_cancel_unused,
- .o_join_lru = osc_join_lru,
.o_iocontrol = osc_iocontrol,
.o_get_info = osc_get_info,
.o_set_info_async = osc_set_info_async,