Whamcloud - gitweb
LU-8347 ldlm: granting conflicting locks
[fs/lustre-release.git] / lustre / lov / lov_page.c
index e5b3221..8521225 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
  *
  */
 
-static int lov_page_print(const struct lu_env *env,
-                          const struct cl_page_slice *slice,
-                          void *cookie, lu_printer_t printer)
+static int lov_raid0_page_print(const struct lu_env *env,
+                               const struct cl_page_slice *slice,
+                               void *cookie, lu_printer_t printer)
 {
-        struct lov_page *lp = cl2lov_page(slice);
+       struct lov_page *lp = cl2lov_page(slice);
 
-        return (*printer)(env, cookie, LUSTRE_LOV_NAME"-page@%p\n", lp);
+       return (*printer)(env, cookie, LUSTRE_LOV_NAME"-page@%p, raid0\n", lp);
 }
 
-static const struct cl_page_operations lov_page_ops = {
-       .cpo_print = lov_page_print
+static const struct cl_page_operations lov_raid0_page_ops = {
+       .cpo_print = lov_raid0_page_print
 };
 
 int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
@@ -77,7 +73,7 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
        struct lov_io_sub *sub;
        struct lov_page   *lpg = cl_object_page_slice(obj, page);
        loff_t             offset;
-       obd_off            suboff;
+       loff_t                   suboff;
        int                stripe;
        int                rc;
        ENTRY;
@@ -89,15 +85,16 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
                               &suboff);
        LASSERT(rc == 0);
 
-       cl_page_slice_add(page, &lpg->lps_cl, obj, &lov_page_ops);
+       lpg->lps_stripe = stripe;
+       cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_raid0_page_ops);
 
        sub = lov_sub_get(env, lio, stripe);
        if (IS_ERR(sub))
                RETURN(PTR_ERR(sub));
 
        subobj = lovsub2cl(r0->lo_sub[stripe]);
-       cfs_list_for_each_entry(o, &subobj->co_lu.lo_header->loh_layers,
-                               co_lu.lo_linkage) {
+       list_for_each_entry(o, &subobj->co_lu.lo_header->loh_layers,
+                           co_lu.lo_linkage) {
                if (o->co_ops->coo_page_init != NULL) {
                        rc = o->co_ops->coo_page_init(sub->sub_env, o, page,
                                                      cl_index(subobj, suboff));
@@ -105,11 +102,11 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
                                break;
                }
        }
-       lov_sub_put(sub);
+
        RETURN(rc);
 }
 
-static int lov_page_empty_print(const struct lu_env *env,
+static int lov_empty_page_print(const struct lu_env *env,
                                const struct cl_page_slice *slice,
                                void *cookie, lu_printer_t printer)
 {
@@ -119,7 +116,7 @@ static int lov_page_empty_print(const struct lu_env *env,
 }
 
 static const struct cl_page_operations lov_empty_page_ops = {
-       .cpo_print = lov_page_empty_print
+       .cpo_print = lov_empty_page_print
 };
 
 int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
@@ -129,7 +126,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
        void *addr;
        ENTRY;
 
-       cl_page_slice_add(page, &lpg->lps_cl, obj, &lov_empty_page_ops);
+       cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_empty_page_ops);
        addr = kmap(page->cp_vmpage);
        memset(addr, 0, cl_page_size(obj));
        kunmap(page->cp_vmpage);