Whamcloud - gitweb
- cleanups about lmv_obd_create().
[fs/lustre-release.git] / lustre / include / linux / obd_class.h
index 726c4bd..c4c0a19 100644 (file)
@@ -1515,8 +1515,8 @@ static inline struct obdo *obdo_alloc(void)
 {
         struct obdo *oa;
 
-        OBD_SLAB_ALLOC(oa, obdo_cachep, GFP_KERNEL, sizeof(*oa));
-
+        OBD_SLAB_ALLOC(oa, obdo_cachep, GFP_KERNEL,
+                       sizeof(*oa));
         return oa;
 }
 
@@ -1527,6 +1527,26 @@ static inline void obdo_free(struct obdo *oa)
         OBD_SLAB_FREE(oa, obdo_cachep, sizeof(*oa));
 }
 
+static inline void obdo2id(struct lustre_id *id,
+                           struct obdo *oa)
+{
+        LASSERT(oa && id);
+        id_ino(id) = oa->o_id;
+        id_fid(id) = oa->o_fid;
+        id_group(id) = oa->o_mds;
+        id_gen(id) = oa->o_generation;
+}
+
+static inline void id2obdo(struct obdo *oa,
+                           struct lustre_id *id)
+{
+        LASSERT(oa && id);
+        oa->o_id = id_ino(id);
+        oa->o_fid = id_fid(id);
+        oa->o_mds = id_group(id);
+        oa->o_generation = id_gen(id);
+}
+
 #if !defined(__KERNEL__) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 #define to_kdev_t(dev) dev
 #define kdev_t_to_nr(dev) dev