diff options
Diffstat (limited to 'kernel/drivers/staging/lustre/lustre/llite/namei.c')
-rw-r--r-- | kernel/drivers/staging/lustre/lustre/llite/namei.c | 72 |
1 files changed, 19 insertions, 53 deletions
diff --git a/kernel/drivers/staging/lustre/lustre/llite/namei.c b/kernel/drivers/staging/lustre/lustre/llite/namei.c index 5a25dcd10..2ca22001a 100644 --- a/kernel/drivers/staging/lustre/lustre/llite/namei.c +++ b/kernel/drivers/staging/lustre/lustre/llite/namei.c @@ -100,7 +100,6 @@ static int ll_set_inode(struct inode *inode, void *opaque) return 0; } - /* * Get an inode by inode number (already instantiated by the intent lookup). * Returns inode or NULL @@ -144,10 +143,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, static void ll_invalidate_negative_children(struct inode *dir) { struct dentry *dentry, *tmp_subdir; - struct ll_d_hlist_node *p; ll_lock_dcache(dir); - ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) { + hlist_for_each_entry(dentry, &dir->i_dentry, d_u.d_alias) { spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { struct dentry *child; @@ -334,15 +332,14 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2) static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) { struct dentry *alias, *discon_alias, *invalid_alias; - struct ll_d_hlist_node *p; - if (ll_d_hlist_empty(&inode->i_dentry)) + if (hlist_empty(&inode->i_dentry)) return NULL; discon_alias = invalid_alias = NULL; ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) { + hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { LASSERT(alias != dentry); spin_lock(&alias->d_lock); @@ -411,7 +408,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, { struct inode *inode = NULL; __u64 bits = 0; - int rc; + int rc = 0; /* NB 1 request reference will be taken away by ll_intent_lock() * when I return */ @@ -441,8 +438,10 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, struct dentry *alias; alias = ll_splice_alias(inode, *de); - if (IS_ERR(alias)) - return PTR_ERR(alias); + if (IS_ERR(alias)) { + rc = PTR_ERR(alias); + goto out; + } *de = alias; } else if (!it_disposition(it, DISP_LOOKUP_NEG) && !it_disposition(it, DISP_OPEN_CREATE)) { @@ -473,7 +472,11 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, } } - return 0; +out: + if (rc != 0 && it->it_op & IT_OPEN) + ll_open_cleanup((*de)->d_sb, request); + + return rc; } static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, @@ -665,12 +668,11 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, out_release: ll_intent_release(it); - OBD_FREE(it, sizeof(*it)); + kfree(it); return rc; } - /* We depend on "mode" being set with the proper file type/umask by now */ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) { @@ -690,7 +692,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) goto out; } - LASSERT(ll_d_hlist_empty(&inode->i_dentry)); + LASSERT(hlist_empty(&inode->i_dentry)); /* We asked for a lock on the directory, but were granted a * lock on the inode. Since we finally have an inode pointer, @@ -866,34 +868,6 @@ static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) *fid = *ll_inode2fid(d_inode(child)); } -/** - * Remove dir entry - **/ -int ll_rmdir_entry(struct inode *dir, char *name, int namelen) -{ - struct ptlrpc_request *request = NULL; - struct md_op_data *op_data; - int rc; - - CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", - namelen, name, dir->i_ino, dir->i_generation, dir); - - op_data = ll_prep_md_op_data(NULL, dir, NULL, name, strlen(name), - S_IFDIR, LUSTRE_OPC_ANY, NULL); - if (IS_ERR(op_data)) - return PTR_ERR(op_data); - op_data->op_cli_flags |= CLI_RM_ENTRY; - rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); - ll_finish_md_op_data(op_data); - if (rc == 0) { - ll_update_times(request, dir); - ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1); - } - - ptlrpc_req_finished(request); - return rc; -} - int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) { struct mdt_body *body; @@ -901,7 +875,6 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) struct lov_stripe_md *lsm = NULL; struct obd_trans_info oti = { 0 }; struct obdo *oa; - struct obd_capa *oc = NULL; int rc; /* req is swabbed so this is safe */ @@ -930,7 +903,7 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) } LASSERT(rc >= sizeof(*lsm)); - OBDO_ALLOC(oa); + oa = kmem_cache_alloc(obdo_cachep, GFP_NOFS | __GFP_ZERO); if (oa == NULL) { rc = -ENOMEM; goto out_free_memmd; @@ -953,21 +926,14 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) } } - if (body->valid & OBD_MD_FLOSSCAPA) { - rc = md_unpack_capa(ll_i2mdexp(dir), request, &RMF_CAPA2, &oc); - if (rc) - goto out_free_memmd; - } - rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti, - ll_i2mdexp(dir), oc); - capa_put(oc); + ll_i2mdexp(dir)); if (rc) CERROR("obd destroy objid "DOSTID" error %d\n", POSTID(&lsm->lsm_oi), rc); out_free_memmd: obd_free_memmd(ll_i2dtexp(dir), &lsm); - OBDO_FREE(oa); + kmem_cache_free(obdo_cachep, oa); out: return rc; } @@ -1008,7 +974,7 @@ static int ll_unlink(struct inode *dir, struct dentry *dentry) return rc; } -static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) +static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { int err; |