Whamcloud - gitweb
LU-13199 lustre: remove cl_{offset,index,page_size} helpers
[fs/lustre-release.git] / lustre / osc / osc_cache.c
index 20765d7..4de0298 100644 (file)
@@ -229,8 +229,8 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
                struct ldlm_extent *extent;
 
                extent = &ext->oe_dlmlock->l_policy_data.l_extent;
-               if (!(extent->start <= cl_offset(osc2cl(obj), ext->oe_start) &&
-                     extent->end   >= cl_offset(osc2cl(obj), ext->oe_max_end)))
+               if (!(extent->start <= ext->oe_start << PAGE_SHIFT &&
+                     extent->end >= ext->oe_max_end << PAGE_SHIFT))
                        GOTO(out, rc = 100);
 
                if (!(ext->oe_dlmlock->l_granted_mode & (LCK_PW | LCK_GROUP)))
@@ -1279,10 +1279,10 @@ static int osc_refresh_count(const struct lu_env *env,
        if (result < 0)
                return result;
        kms = attr->cat_kms;
-       if (cl_offset(obj, index) >= kms)
+       if (index << PAGE_SHIFT >= kms)
                /* catch race with truncate */
                return 0;
-       else if (cl_offset(obj, index + 1) > kms)
+       else if ((index + 1) << PAGE_SHIFT > kms)
                /* catch sub-page write at end of file */
                return kms & ~PAGE_MASK;
        else
@@ -2702,8 +2702,8 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj,
        ENTRY;
 
        /* pages with index greater or equal to index will be truncated. */
-       index = cl_index(osc2cl(obj), size);
-       partial = size > cl_offset(osc2cl(obj), index);
+       index = size >> PAGE_SHIFT;
+       partial = size > (index << PAGE_SHIFT);
 
 again:
        osc_object_lock(obj);
@@ -3172,12 +3172,12 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
                                        tmp->l_policy_data.l_extent.start;
 
                                /* no lock covering this page */
-                               if (index < cl_index(osc2cl(osc), start)) {
+                               if (index < start >> PAGE_SHIFT) {
                                        /* no lock at @index,
                                         * first lock at @start
                                         */
                                        info->oti_ng_index =
-                                               cl_index(osc2cl(osc), start);
+                                               start >> PAGE_SHIFT;
                                        discard = true;
                                } else {
                                        /* Cache the first-non-overlapped
@@ -3188,7 +3188,7 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
                                         * pages.
                                         */
                                        info->oti_fn_index =
-                                               cl_index(osc2cl(osc), end + 1);
+                                               (end + 1) >> PAGE_SHIFT;
                                        if (end == OBD_OBJECT_EOF)
                                                info->oti_fn_index =
                                                        CL_PAGE_EOF;