Whamcloud - gitweb
CLIO uses lock weighting policy to keep locks over mmapped regions in
authornikita <nikita>
Sat, 18 Oct 2008 15:45:07 +0000 (15:45 +0000)
committernikita <nikita>
Sat, 18 Oct 2008 15:45:07 +0000 (15:45 +0000)
memory---a requirement implemented through ->o_join_lru() obd method in
HEAD. Remove this method and its users.
b=16450

12 files changed:
lustre/ChangeLog
lustre/include/lustre_dlm.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/llite/file.c
lustre/llite/llite_mmap.c
lustre/lov/lov_obd.c
lustre/obdclass/lprocfs_status.c
lustre/osc/osc_request.c

index 46d8691..d1c47dc 100644 (file)
@@ -1513,6 +1513,13 @@ Description: Use struct ldlm_callback_suite in ldlm_lock_create().
 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>
index 468e0c3..487f690 100644 (file)
@@ -1027,8 +1027,6 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
                                     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,
index 74c79c9..55f1d26 100644 (file)
@@ -1350,8 +1350,6 @@ struct obd_ops {
                         __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 *,
index 45e544e..1b9535f 100644 (file)
@@ -1610,19 +1610,6 @@ static inline int obd_cancel_unused(struct obd_export *exp,
         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)
index 63d331c..9d93d1d 100644 (file)
@@ -656,7 +656,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)
                         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. */
index 348fd7b..41553e3 100644 (file)
@@ -2394,7 +2394,6 @@ EXPORT_SYMBOL(ldlm_cli_cancel);
 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);
index 9c50907..6dfeac7 100644 (file)
@@ -1805,56 +1805,6 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
         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,
index 9da786f..75bf059 100644 (file)
@@ -1182,10 +1182,6 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode,
         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))
index f8c030b..f17a90d 100644 (file)
@@ -395,7 +395,7 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
 
         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);
 
@@ -491,21 +491,7 @@ static void ll_vm_open(struct vm_area_struct * vma)
         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)
@@ -520,20 +506,7 @@ 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
index c77ad29..c9240d1 100644 (file)
@@ -2298,48 +2298,6 @@ static int lov_cancel_unused(struct obd_export *exp,
         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)
 {
@@ -3368,7 +3326,6 @@ struct obd_ops lov_obd_ops = {
         .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,
index 250227a..bd990c7 100644 (file)
@@ -1202,7 +1202,6 @@ void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
         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);
index 9dbd29d..33d31e5 100644 (file)
@@ -3044,7 +3044,6 @@ static void osc_set_data_with_check(struct lustre_handle *lockh, void *data,
         }
 #endif
         lock->l_ast_data = data;
-        lock->l_flags |= (flags & LDLM_FL_NO_LRU);
         unlock_res_and_lock(lock);
         LDLM_LOCK_PUT(lock);
 }
@@ -3319,21 +3318,8 @@ static int osc_cancel_unused(struct obd_export *exp,
         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;
@@ -4223,7 +4209,6 @@ struct obd_ops osc_obd_ops = {
         .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,