Whamcloud - gitweb
->ldo_object_alloc(): add lu_object_headers to arguments, so that allocation may...
authornikita <nikita>
Sun, 28 May 2006 18:16:36 +0000 (18:16 +0000)
committernikita <nikita>
Sun, 28 May 2006 18:16:36 +0000 (18:16 +0000)
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_object.c
lustre/cmm/mdc_internal.h
lustre/cmm/mdc_object.c
lustre/include/lu_object.h
lustre/include/lustre_dlm.h
lustre/mdd/mdd_handler.c
lustre/mdt/mdt_handler.c
lustre/obdclass/lu_object.c
lustre/osd/osd_handler.c

index b6c7c7d..78b762a 100644 (file)
@@ -94,6 +94,7 @@ static inline struct md_object *cmm2child_obj(struct cmm_object *o)
 
 /* cmm_object.c */
 struct lu_object *cmm_object_alloc(const struct lu_context *ctx,
+                                   const struct lu_object_header *hdr,
                                    struct lu_device *);
 #endif /* __KERNEL__ */
 #endif /* _CMM_INTERNAL_H */
index b9fddd7..5f0a5dd 100644 (file)
@@ -68,6 +68,7 @@ static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num)
 }
 
 struct lu_object *cmm_object_alloc(const struct lu_context *ctx,
+                                   const struct lu_object_header *hdr,
                                    struct lu_device *ld)
 {
         struct cmm_object *co;
@@ -110,7 +111,8 @@ static int cmm_object_init(const struct lu_context *ctx, struct lu_object *lo)
         if (c_dev == NULL) {
                 rc = -ENOENT;
         } else {
-                c_obj = c_dev->ld_ops->ldo_object_alloc(ctx, c_dev);
+                c_obj = c_dev->ld_ops->ldo_object_alloc(ctx,
+                                                        lo->lo_header, c_dev);
                 if (c_obj != NULL) {
                         struct cmm_object *co = lu2cmm_obj(lo);
 
index 667f357..6a2d3df 100644 (file)
@@ -78,6 +78,7 @@ static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld)
 }
 
 struct lu_object *mdc_object_alloc(const struct lu_context *,
+                                   const struct lu_object_header *,
                                    struct lu_device *);
 #endif /* __KERNEL__ */
 #endif /* _CMM_MDC_INTERNAL_H */
index f717b57..6543256 100644 (file)
@@ -43,6 +43,7 @@ static struct md_dir_operations mdc_dir_ops;
 static struct lu_object_operations mdc_obj_ops;
 
 struct lu_object *mdc_object_alloc(const struct lu_context *ctx,
+                                   const struct lu_object_header *hdr,
                                    struct lu_device *ld)
 {
        struct mdc_object *mco;
index e368d23..017d0f0 100644 (file)
@@ -133,6 +133,7 @@ struct lu_device_operations {
          *                                      result->lo_ops != NULL);
          */
         struct lu_object *(*ldo_object_alloc)(const struct lu_context *ctx,
+                                              const struct lu_object_header *h,
                                               struct lu_device *d);
         /*
          * process config specific for device
index 98b5044..e45f18c 100644 (file)
@@ -476,7 +476,7 @@ void ldlm_lock_remove_from_lru(struct ldlm_lock *);
 struct ldlm_lock *ldlm_handle2lock_ns(struct ldlm_namespace *,
                                       const struct lustre_handle *);
 
-static inline struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *h)
+static inline struct ldlm_lock *ldlm_handle2lock(const struct lustre_handle *h)
 {
         return __ldlm_handle2lock(h, 0);
 }
index e76ad0d..ea9a3bb 100644 (file)
@@ -119,6 +119,7 @@ static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d)
 }
 
 static struct lu_object *mdd_object_alloc(const struct lu_context *ctxt,
+                                          const struct lu_object_header *hdr,
                                           struct lu_device *d)
 {
         struct mdd_object *mdo;
@@ -146,7 +147,7 @@ static int mdd_object_init(const struct lu_context *ctxt, struct lu_object *o)
         ENTRY;
 
        under = &d->mdd_child->dd_lu_dev;
-       below = under->ld_ops->ldo_object_alloc(ctxt, under);
+       below = under->ld_ops->ldo_object_alloc(ctxt, o->lo_header, under);
 
         if (below == NULL)
                RETURN(-ENOMEM);
index 374ed2a..4dd3d63 100644 (file)
@@ -1739,6 +1739,7 @@ static int mdt_process_config(const struct lu_context *ctx,
 }
 
 static struct lu_object *mdt_object_alloc(const struct lu_context *ctxt,
+                                          const struct lu_object_header *hdr,
                                           struct lu_device *d)
 {
         struct mdt_object *mo;
@@ -1768,7 +1769,7 @@ static int mdt_object_init(const struct lu_context *ctxt, struct lu_object *o)
         struct lu_object  *below;
 
         under = &d->mdt_child->md_lu_dev;
-        below = under->ld_ops->ldo_object_alloc(ctxt, under);
+        below = under->ld_ops->ldo_object_alloc(ctxt, o->lo_header, under);
         if (below != NULL) {
                 lu_object_add(o, below);
                 return 0;
index 3bc8ee7..9a57cd3 100644 (file)
@@ -111,7 +111,8 @@ static struct lu_object *lu_object_alloc(const struct lu_context *ctxt,
          * Create top-level object slice. This will also create
          * lu_object_header.
          */
-        top = s->ls_top_dev->ld_ops->ldo_object_alloc(ctxt, s->ls_top_dev);
+        top = s->ls_top_dev->ld_ops->ldo_object_alloc(ctxt,
+                                                      NULL, s->ls_top_dev);
         if (IS_ERR(top))
                 RETURN(top);
         s->ls_total ++;
@@ -496,7 +497,7 @@ EXPORT_SYMBOL(lu_object_add);
 int lu_object_header_init(struct lu_object_header *h)
 {
         memset(h, 0, sizeof *h);
-        h->loh_ref = 1; 
+        h->loh_ref = 1;
         INIT_HLIST_NODE(&h->loh_hash);
         CFS_INIT_LIST_HEAD(&h->loh_lru);
         CFS_INIT_LIST_HEAD(&h->loh_layers);
index 6dc3e71..d7a8feb 100644 (file)
@@ -124,6 +124,7 @@ static struct lu_device   *osd_device_alloc (const struct lu_context *ctx,
                                              struct lu_device_type *t,
                                              struct lustre_cfg *cfg);
 static struct lu_object   *osd_object_alloc (const struct lu_context *ctx,
+                                             const struct lu_object_header *hdr,
                                              struct lu_device *d);
 static struct inode       *osd_iget         (struct osd_thread_info *info,
                                              struct osd_device *dev,
@@ -186,6 +187,7 @@ EXPORT_SYMBOL(dt_object_find);
  */
 
 static struct lu_object *osd_object_alloc(const struct lu_context *ctx,
+                                          const struct lu_object_header *hdr,
                                           struct lu_device *d)
 {
         struct osd_object *mo;
@@ -221,8 +223,6 @@ static int osd_object_init(const struct lu_context *ctxt, struct lu_object *l)
 
         result = osd_fid_lookup(ctxt, obj, lu_object_fid(l));
         if (result == 0) {
-                /*FIXME: put osd_index_ops here for tmp fix WANGDI*/
-                obj->oo_dt.do_index_ops = &osd_index_ops;
                 if (obj->oo_inode != NULL)
                         osd_object_init0(obj);
         }
@@ -855,7 +855,7 @@ static int osd_index_init(const struct lu_context *ctx,
                 dentry = osd_open(osd_sb(osd)->s_root, osd_fld_name,
                                   S_IFREG);
                 if (IS_ERR(dentry)) {
-                        CERROR("can not open %s, rc = %\n", osd_fld_name,
+                        CERROR("can not open %s, rc = %ld\n", osd_fld_name,
                                 PTR_ERR(dentry));
                         return (PTR_ERR(dentry));
                 }
@@ -885,8 +885,6 @@ static struct dt_index_operations osd_index_ops = {
         .dio_lookup = osd_index_lookup,
         .dio_insert = osd_index_insert,
         .dio_probe  = osd_index_probe,
-        .dio_init   = osd_index_init,
-        .dio_fini   = osd_index_fini,
 };
 
 /*