Whamcloud - gitweb
file export-do_kern_mount.patch was initially added on branch b1_5.
[fs/lustre-release.git] / lustre / smfs / ost_kml.c
index c0dd244..31e2e79 100644 (file)
 
 static int smfs_ost_get_id(obd_id *id, char *data, int size)
 {
-        /*for obdfilter obdid is the name of the filename*/
+        /* for obdfilter obdid is the name of the filename */
         char end;
         char *endp = &end;
         if (data)
                 *id = simple_strtoull(data, &endp, 10);
         else
                 return -EINVAL;
+        CDEBUG(D_DENTRY,"name = %s\n", data);
         return 0;
 }
 
@@ -66,14 +67,16 @@ static int smfs_ost_get_group(struct dentry *dentry, struct obdo *oa)
         if (dparent_group == NULL || dparent_group == dparent_subdir)
                 return -EINVAL;
 
+        CDEBUG(D_DENTRY,"try to find group for dentry %p\n", dparent_group);
         for (i = 1; i < filter->fo_group_count; i++) {
+                CDEBUG(D_DENTRY, "group[%i] = %p\n", i, filter->fo_groups[i]);
                 if (filter->fo_groups[i] == dparent_group) {
                         oa->o_gr = i;
                         oa->o_valid |= OBD_MD_FLGROUP;
                         return 0;
                 }
         }
-        return -EINVAL;
+        return -ENOENT;
 }
 
 static int ost_rec_create_pack(char *buffer, struct dentry *dentry,
@@ -97,18 +100,20 @@ static int ost_rec_create_pack(char *buffer, struct dentry *dentry,
                 oa->o_valid = OBD_MD_FLID | OBD_MD_FLGENER | OBD_MD_FLTYPE |
                         OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID;
                 oa->o_size = 0;
-                obdo_from_inode(oa, dentry->d_inode, OBD_MD_FLTYPE|OBD_MD_FLATIME|
-                                OBD_MD_FLMTIME| OBD_MD_FLCTIME);
-                rc = smfs_ost_get_id(&oa->o_id, (char*)dentry->d_name.name,
+                obdo_from_inode(oa, dentry->d_inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
+                                OBD_MD_FLMTIME | OBD_MD_FLCTIME);
+                rc = smfs_ost_get_id(&oa->o_id, (char *)dentry->d_name.name,
                                      dentry->d_name.len);
                 if (rc) {
-                        CERROR("Can not find id of node %lu\n", dentry->d_inode->i_ino);
-                        GOTO(out, rc = -ENOMEM);
+                        CERROR("can not find id of inode %lu, name %s\n",
+                               dentry->d_inode->i_ino, (char *)dentry->d_name.name);
+                        GOTO(out, rc);
                 }
                 rc = smfs_ost_get_group(dentry, oa);
                 if (rc) {
-                        CERROR("Can not find group node %lu\n", dentry->d_inode->i_ino);
-                        GOTO(out, rc = -ENOMEM); 
+                        CERROR("can not find group inode %lu, name %s\n",
+                               dentry->d_inode->i_ino, (char *)dentry->d_name.name);
+                        GOTO(out, rc); 
                 }
         } 
         rc = sizeof(*oa) + sizeof(int);
@@ -170,24 +175,17 @@ out:
 
 typedef int (*ost_pack_rec_func)(char *buffer, struct dentry *dentry,
                                  struct inode *dir, void *data1, void *data2);
+
 static ost_pack_rec_func ost_kml_pack[REINT_MAX + 1] = {
         [REINT_SETATTR] ost_rec_setattr_pack,
         [REINT_CREATE]  ost_rec_create_pack,
         [REINT_WRITE]   ost_rec_write_pack,
 };
 
-int ost_rec_pack(char *buffer, struct dentry *dentry, struct inode *dir,
-                 void *data1, void *data2, int op)
+int ost_rec_pack(int op, char *buffer, struct dentry *dentry,
+                 struct inode *dir, void *data1, void *data2)
 {
-        if (op == REINT_SETATTR || op == REINT_CREATE || op == REINT_WRITE) {
+        if (op == REINT_SETATTR || op == REINT_CREATE || op == REINT_WRITE)
                 return ost_kml_pack[op](buffer, dentry, dir, data1, data2);
-        }
-        return 0;
-}
-
-int ost_rec_pack_init(struct smfs_super_info *smsi)
-{
-
-        smsi->smsi_pack_rec[PACK_OST] = ost_rec_pack;
         return 0;
 }