From f6af9245c9d53c0795d04848d1062f06ed3d493f Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 18 Oct 2002 19:02:00 +0000 Subject: [PATCH] Merge some of the no-op intent changes to the core tree before branching. --- lustre/llite/dcache.c | 16 ++++++++------- lustre/llite/namei.c | 55 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 9b4bc2d..c66423e 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -41,28 +41,30 @@ void ll_release(struct dentry *de) void ll_intent_release(struct dentry *de) { + struct lookup_intent *it; struct lustre_handle *handle; ENTRY; - if (de->d_it == NULL) { + it = de->d_it; + if (it == NULL) { EXIT; return; } LASSERT(ll_d2d(de) != NULL); - if (de->d_it->it_lock_mode) { - handle = (struct lustre_handle *)de->d_it->it_lock_handle; - if (de->d_it->it_op == IT_SETATTR) { + if (it->it_lock_mode) { + handle = (struct lustre_handle *)it->it_lock_handle; + if (it->it_op == IT_SETATTR) { int rc; - ldlm_lock_decref(handle, de->d_it->it_lock_mode); + ldlm_lock_decref(handle, it->it_lock_mode); rc = ldlm_cli_cancel(handle); if (rc < 0) CERROR("ldlm_cli_cancel: %d\n", rc); } else - ldlm_lock_decref(handle, de->d_it->it_lock_mode); + ldlm_lock_decref(handle, it->it_lock_mode); } - // de->d_it = NULL; + de->d_it = NULL; //up(&ll_d2d(de)->lld_it_sem); EXIT; } diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index c334d02..1f7e598 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -481,27 +481,31 @@ static int ll_create(struct inode *dir, struct dentry *dentry, int mode) static int ll_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev) { + struct lookup_intent *it; struct inode *inode; - int err = 0; + int rc = 0; + + it = dentry->d_it; inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len, - NULL, 0, mode, rdev, dentry->d_it, NULL); + NULL, 0, mode, rdev, it, NULL); if (IS_ERR(inode)) RETURN(PTR_ERR(inode)); /* no directory data updates when intents rule */ - if (dentry->d_it && dentry->d_it->it_disposition) + if (it && it->it_disposition) d_instantiate(dentry, inode); else - err = ext2_add_nondir(dentry, inode); + rc = ext2_add_nondir(dentry, inode); - return err; + return rc; } static int ll_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { + struct lookup_intent *it; unsigned l = strlen(symname); struct inode *inode; struct ll_inode_info *lli; @@ -510,9 +514,11 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, CHECK_MOUNT_EPOCH(dir); + it = dentry->d_it; + inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len, symname, l, S_IFLNK | S_IRWXUGO, 0, - dentry->d_it, NULL); + it, NULL); if (IS_ERR(inode)) RETURN(PTR_ERR(inode)); @@ -529,7 +535,7 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, inode->i_size = l; /* no directory data updates when intents rule */ - if (dentry->d_it && dentry->d_it->it_disposition) + if (it && it->it_disposition) d_instantiate(dentry, inode); else err = ext2_add_nondir(dentry, inode); @@ -540,10 +546,12 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, static int ll_link(struct dentry *old_dentry, struct inode * dir, struct dentry *dentry) { + struct lookup_intent *it; struct inode *inode = old_dentry->d_inode; - struct lookup_intent *it = dentry->d_it; int rc; + it = dentry->d_it; + if (it && it->it_disposition) { if (it->it_status) RETURN(it->it_status); @@ -575,6 +583,7 @@ static int ll_link(struct dentry *old_dentry, struct inode * dir, static int ll_mkdir(struct inode *dir, struct dentry *dentry, int mode) { + struct lookup_intent *it; struct inode * inode; int err = -EMLINK; ENTRY; @@ -584,8 +593,10 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, int mode) ext2_inc_count(dir); + it = dentry->d_it; + inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len, - NULL, 0, S_IFDIR | mode, 0, dentry->d_it, NULL); + NULL, 0, S_IFDIR | mode, 0, it, NULL); err = PTR_ERR(inode); if (IS_ERR(inode)) goto out_dir; @@ -597,7 +608,7 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, int mode) goto out_fail; /* no directory data updates when intents rule */ - if (dentry->d_it->it_disposition == 0) { + if (!it || !it->it_disposition) { err = ll_add_link(dentry, inode); if (err) goto out_fail; @@ -619,9 +630,9 @@ out_dir: goto out; } -static int ll_common_unlink(struct inode *dir, struct dentry *dentry,__u32 mode) +static int ll_common_unlink(struct inode *dir, struct dentry *dentry, + struct lookup_intent *it, __u32 mode) { - struct lookup_intent *it = dentry->d_it; struct inode *inode = dentry->d_inode; struct ext2_dir_entry_2 * de; struct page * page; @@ -639,7 +650,7 @@ static int ll_common_unlink(struct inode *dir, struct dentry *dentry,__u32 mode) if (!de) GOTO(out, rc = -ENOENT); rc = ll_mdc_unlink(dir, dentry->d_inode, mode, - dentry->d_name.name, dentry->d_name.len); + dentry->d_name.name, dentry->d_name.len); if (rc) GOTO(out, rc); @@ -661,20 +672,26 @@ out: static int ll_unlink(struct inode *dir, struct dentry *dentry) { - return ll_common_unlink(dir, dentry, S_IFREG); + struct lookup_intent *it; + + it = dentry->d_it; + + return ll_common_unlink(dir, dentry, it, S_IFREG); } static int ll_rmdir(struct inode *dir, struct dentry *dentry) { struct inode * inode = dentry->d_inode; - struct lookup_intent *it = dentry->d_it; - int rc = 0; + struct lookup_intent *it; + int rc; ENTRY; + it = dentry->d_it; + if ((!it || !it->it_disposition) && !ext2_empty_dir(inode)) RETURN(-ENOTEMPTY); - rc = ll_common_unlink(dir, dentry, S_IFDIR); + rc = ll_common_unlink(dir, dentry, it, S_IFDIR); if (!rc) { inode->i_size = 0; ext2_dec_count(inode); @@ -687,7 +704,7 @@ static int ll_rmdir(struct inode *dir, struct dentry *dentry) static int ll_rename(struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry) { - struct lookup_intent *it = new_dentry->d_it; + struct lookup_intent *it; struct inode * old_inode = old_dentry->d_inode; struct inode * tgt_inode = new_dentry->d_inode; struct page * dir_page = NULL; @@ -696,6 +713,8 @@ static int ll_rename(struct inode * old_dir, struct dentry * old_dentry, struct page * old_page; int err; + it = new_dentry->d_it; + if (it && it->it_disposition) { if (tgt_inode) { tgt_inode->i_ctime = CURRENT_TIME; -- 1.8.3.1