Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / osc / osc_create.c
index 6d3b80f..daa8049 100644 (file)
@@ -36,7 +36,8 @@
 # include <linux/module.h>
 # include <linux/mm.h>
 # include <linux/highmem.h>
-# include <linux/lustre_dlm.h>
+# include <linux/ctype.h>
+# include <linux/init.h>
 # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #  include <linux/workqueue.h>
 #  include <linux/smp_lock.h>
 # include <liblustre.h>
 #endif
 
-#ifndef  __CYGWIN__
-# include <linux/ctype.h>
-# include <linux/init.h>
-#else
+#ifdef  __CYGWIN__
 # include <ctype.h>
 #endif
 
+# include <linux/lustre_dlm.h>
 #include <linux/obd_class.h>
 #include "osc_internal.h"
 
@@ -124,7 +123,9 @@ static int oscc_internal_create(struct osc_creator *oscc)
 
         spin_lock(&oscc->oscc_lock);
         body->oa.o_id = oscc->oscc_last_id + oscc->oscc_grow_count;
-        body->oa.o_valid |= OBD_MD_FLID;
+        body->oa.o_gr = oscc->oscc_gr;
+        LASSERT(body->oa.o_gr > 0);
+        body->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
         CDEBUG(D_INFO, "preallocating through id "LPU64" (last used "LPU64")\n",
                body->oa.o_id, oscc->oscc_next_id);
         spin_unlock(&oscc->oscc_lock);
@@ -212,8 +213,13 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
         ENTRY;
         LASSERT(oa);
         LASSERT(ea);
+        LASSERT(oa->o_valid & OBD_MD_FLGROUP);
+        LASSERT(oa->o_gr > 0);
+
+        LASSERT(oscc->oscc_gr == 0 || oscc->oscc_gr == oa->o_gr);
+        oscc->oscc_gr = oa->o_gr;
 
-        if ((oa->o_valid & OBD_MD_FLGROUP) && (oa->o_gr != 0))
+        if (oa->o_gr == FILTER_GROUP_LLOG || oa->o_gr == FILTER_GROUP_ECHO)
                 RETURN(osc_real_create(exp, oa, ea, oti));
 
         if ((oa->o_valid & OBD_MD_FLFLAGS) &&
@@ -275,7 +281,9 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
                 if (oscc->oscc_last_id >= oscc->oscc_next_id) {
                         memcpy(oa, &oscc->oscc_oa, sizeof(*oa));
                         oa->o_id = oscc->oscc_next_id;
+                        oa->o_gr = oscc->oscc_gr;
                         lsm->lsm_object_id = oscc->oscc_next_id;
+                        lsm->lsm_object_gr = oscc->oscc_gr;
                         *ea = lsm;
                         oscc->oscc_next_id++;
                         try_again = 0;
@@ -291,7 +299,8 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
         }
 
         if (rc == 0)
-                CDEBUG(D_INFO, "returning objid "LPU64"\n", lsm->lsm_object_id);
+                CDEBUG(D_INFO, "returning objid "LPU64"/"LPU64"\n",
+                                lsm->lsm_object_id, lsm->lsm_object_gr);
         else if (*ea == NULL)
                 obd_free_memmd(exp, &lsm);
         RETURN(rc);