Whamcloud - gitweb
- couple minor optimizations
authoralex <alex>
Sun, 7 Aug 2005 14:23:39 +0000 (14:23 +0000)
committeralex <alex>
Sun, 7 Aug 2005 14:23:39 +0000 (14:23 +0000)
lustre/mds/mds_lmv.c
lustre/mds/mds_open.c

index e96929c..f40db1c 100644 (file)
@@ -643,7 +643,7 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
         struct obdo *oa = NULL;
        int rc, mea_size = 0;
         struct lustre_id id;
         struct obdo *oa = NULL;
        int rc, mea_size = 0;
         struct lustre_id id;
-       void *handle;
+        void *handle;
        ENTRY;
 
         if (update_mode != LCK_EX)
        ENTRY;
 
         if (update_mode != LCK_EX)
@@ -706,9 +706,8 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
          */
        oa->o_id = dir->i_ino;
 
          */
        oa->o_id = dir->i_ino;
 
-        down(&dir->i_sem);
+        /* get parent id: ldlm lock on the parent protects ea */
         rc = mds_read_inode_sid(obd, dir, &id);
         rc = mds_read_inode_sid(obd, dir, &id);
-        up(&dir->i_sem);
         if (rc) {
                 CERROR("Can't read inode self id, inode %lu, "
                        "rc %d.\n", dir->i_ino, rc);
         if (rc) {
                 CERROR("Can't read inode self id, inode %lu, "
                        "rc %d.\n", dir->i_ino, rc);
index 355577c..f49a66a 100644 (file)
@@ -1024,14 +1024,6 @@ restart:
 
         cleanup_phase = 1; /* parent dentry and lock */
 
 
         cleanup_phase = 1; /* parent dentry and lock */
 
-        /* get parent id: ldlm lock on the parent protects ea */
-        rc = mds_read_inode_sid(obd, dparent->d_inode, &sid);
-        if (rc) {
-                CERROR("can't read parent inode id. ino(%lu) rc(%d)\n",
-                       dparent->d_inode->i_ino, rc);
-                GOTO(cleanup, rc);
-        }
-
         /* try to retrieve MEA data for this dir */
         rc = mds_md_get_attr(obd, dparent->d_inode, &mea, &mea_size);
         if (rc)
         /* try to retrieve MEA data for this dir */
         rc = mds_md_get_attr(obd, dparent->d_inode, &mea, &mea_size);
         if (rc)
@@ -1135,6 +1127,14 @@ got_child:
                 struct iattr iattr;
                 struct inode *inode;
                 
                 struct iattr iattr;
                 struct inode *inode;
                 
+                /* get parent id: ldlm lock on the parent protects ea */
+                rc = mds_read_inode_sid(obd, dparent->d_inode, &sid);
+                if (rc) {
+                        CERROR("can't read parent inode id. ino(%lu) rc(%d)\n",
+                                dparent->d_inode->i_ino, rc);
+                        GOTO(cleanup, rc);
+                }
+
                 ino = (unsigned long)id_ino(rec->ur_id2);
                 
                 rc = mds_try_to_split_dir(obd, dparent, &mea, 0,
                 ino = (unsigned long)id_ino(rec->ur_id2);
                 
                 rc = mds_try_to_split_dir(obd, dparent, &mea, 0,