Whamcloud - gitweb
LU-1330 obdclass: add obd_target.h
[fs/lustre-release.git] / lustre / osd-zfs / osd_object.c
index 978aec7..37706e2 100644 (file)
@@ -28,7 +28,7 @@
  * Use is subject to license terms.
  */
 /*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  * Use is subject to license terms.
  */
 /*
@@ -49,7 +49,6 @@
 
 #include <lustre_ver.h>
 #include <libcfs/libcfs.h>
-#include <lustre_fsfilt.h>
 #include <obd_support.h>
 #include <lustre_net.h>
 #include <obd.h>
@@ -79,7 +78,7 @@ static struct lu_object_operations osd_lu_obj_ops;
 extern struct dt_body_operations osd_body_ops;
 static struct dt_object_operations osd_obj_otable_it_ops;
 
-extern cfs_mem_cache_t *osd_object_kmem;
+extern struct kmem_cache *osd_object_kmem;
 
 static void
 osd_object_sa_fini(struct osd_object *obj)
@@ -290,7 +289,7 @@ struct lu_object *osd_object_alloc(const struct lu_env *env,
 {
        struct osd_object *mo;
 
-       OBD_SLAB_ALLOC_PTR_GFP(mo, osd_object_kmem, CFS_ALLOC_IO);
+       OBD_SLAB_ALLOC_PTR_GFP(mo, osd_object_kmem, __GFP_IO);
        if (mo != NULL) {
                struct lu_object *l;
 
@@ -351,25 +350,26 @@ int osd_object_init0(const struct lu_env *env, struct osd_object *obj)
 
 static int osd_check_lma(const struct lu_env *env, struct osd_object *obj)
 {
+       struct osd_thread_info  *info = osd_oti_get(env);
        struct lu_buf           buf;
        int                     rc;
        struct lustre_mdt_attrs *lma;
        ENTRY;
 
-       lma = (struct lustre_mdt_attrs *)osd_oti_get(env)->oti_buf;
+       CLASSERT(sizeof(info->oti_buf) >= sizeof(*lma));
+       lma = (struct lustre_mdt_attrs *)info->oti_buf;
        buf.lb_buf = lma;
-       buf.lb_len = sizeof(*lma);
+       buf.lb_len = sizeof(info->oti_buf);
 
        rc = osd_xattr_get(env, &obj->oo_dt, &buf, XATTR_NAME_LMA, BYPASS_CAPA);
        if (rc > 0) {
                rc = 0;
-               if (unlikely((le32_to_cpu(lma->lma_incompat) &
-                             ~LMA_INCOMPAT_SUPP) ||
+               lustre_lma_swab(lma);
+               if (unlikely((lma->lma_incompat & ~LMA_INCOMPAT_SUPP) ||
                             CFS_FAIL_CHECK(OBD_FAIL_OSD_LMA_INCOMPAT))) {
                        CWARN("%s: unsupported incompat LMA feature(s) %#x for "
-                             DFID"\n", osd_obj2dev(obj)->od_svname,
-                             le32_to_cpu(lma->lma_incompat) &
-                             ~LMA_INCOMPAT_SUPP,
+                             "fid = "DFID"\n", osd_obj2dev(obj)->od_svname,
+                             lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
                              PFID(lu_object_fid(&obj->oo_dt.do_lu)));
                        rc = -EOPNOTSUPP;
                }