Whamcloud - gitweb
b=3920
[fs/lustre-release.git] / lustre / mds / mds_lmv.c
index 8b72d9c..7496916 100644 (file)
@@ -521,7 +521,7 @@ int mds_splitting_expected(struct obd_device *obd, struct dentry *dentry)
  * must not be called on already splitted directories.
  */
 int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
-                         struct mea **mea, int nstripes)
+                         struct mea **mea, int nstripes, int update_mode)
 {
         struct inode *dir = dentry->d_inode;
         struct mds_obd *mds = &obd->u.mds;
@@ -531,21 +531,22 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
        void *handle;
        ENTRY;
 
+        if (update_mode != LCK_EX)
+                return 0;
         /* TODO: optimization possible - we already may have mea here */
         rc = mds_splitting_expected(obd, dentry);
         if (rc == MDS_NO_SPLITTABLE)
                 return 0;
         if (rc == MDS_NO_SPLIT_EXPECTED && nstripes == 0)
                 return 0;
+        if (nstripes && nstripes == 1)
+                return 0;
         
         LASSERT(mea == NULL || *mea == NULL);
 
         CDEBUG(D_OTHER, "%s: split directory %u/%lu/%lu\n",
                obd->obd_name, mds->mds_num, dir->i_ino,
                (unsigned long) dir->i_generation);
-        CDEBUG(D_ERROR, "%s: split directory %u/%lu/%lu: %d/%d\n",
-               obd->obd_name, mds->mds_num, dir->i_ino,
-               (unsigned long) dir->i_generation, rc, nstripes);
 
         if (mea == NULL)
                 mea = &tmea;