From dd1b9340334c15ac687137776baef65b50264fbc Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 7 Aug 2005 14:23:39 +0000 Subject: [PATCH] - couple minor optimizations --- lustre/mds/mds_lmv.c | 5 ++--- lustre/mds/mds_open.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lustre/mds/mds_lmv.c b/lustre/mds/mds_lmv.c index e96929c..f40db1c 100644 --- a/lustre/mds/mds_lmv.c +++ b/lustre/mds/mds_lmv.c @@ -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; - void *handle; + void *handle; 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; - down(&dir->i_sem); + /* get parent id: ldlm lock on the parent protects ea */ 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); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 355577c..f49a66a 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1024,14 +1024,6 @@ restart: 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) @@ -1135,6 +1127,14 @@ got_child: 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, -- 1.8.3.1