*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/osd/osd_compat.c
*
OBD_SET_CTXT_MAGIC(newctxt);
newctxt->pwdmnt = dev->od_mnt;
newctxt->pwd = dev->od_mnt->mnt_root;
- newctxt->fs = KERNEL_DS;
newctxt->umask = current_umask();
newctxt->dt = NULL;
if (osd_seq->oos_dirs[j])
dput(osd_seq->oos_dirs[j]);
}
- OBD_FREE(osd_seq->oos_dirs,
- sizeof(struct dentry *) * osd_seq->oos_subdir_count);
+ OBD_FREE_PTR_ARRAY(osd_seq->oos_dirs,
+ osd_seq->oos_subdir_count);
}
if (osd_seq->oos_root)
static void osd_index_backup_dir_fini(struct osd_device *dev)
{
- if (dev->od_index_backup_inode) {
- iput(dev->od_index_backup_inode);
- dev->od_index_backup_inode = NULL;
- }
+ iput(dev->od_index_backup_inode);
+ dev->od_index_backup_inode = NULL;
}
int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev)
return rc;
}
-static int osd_obj_del_entry(struct osd_thread_info *info,
- struct osd_device *osd,
- struct dentry *dird, char *name,
- handle_t *th)
+int osd_obj_del_entry(struct osd_thread_info *info, struct osd_device *osd,
+ struct dentry *dird, char *name, int namelen,
+ handle_t *th)
{
struct ldiskfs_dir_entry_2 *de;
struct buffer_head *bh;
child = &info->oti_child_dentry;
child->d_name.hash = 0;
child->d_name.name = name;
- child->d_name.len = strlen(name);
+ child->d_name.len = namelen;
child->d_parent = dird;
child->d_inode = NULL;
fid_seq_is_idif(seq) ? 0 : seq);
}
-static inline void osd_oid_name(char *name, size_t name_size,
- const struct lu_fid *fid, u64 id)
-{
- snprintf(name, name_size,
- (fid_seq_is_rsvd(fid_seq(fid)) ||
- fid_seq_is_mdt0(fid_seq(fid)) ||
- fid_seq_is_idif(fid_seq(fid))) ? "%llu" : "%llx", id);
-}
-
/* external locking is required */
static int osd_seq_load_locked(struct osd_thread_info *info,
struct osd_device *osd,
osd_seq->oos_root = seq_dir;
LASSERT(osd_seq->oos_dirs == NULL);
- OBD_ALLOC(osd_seq->oos_dirs,
- sizeof(seq_dir) * osd_seq->oos_subdir_count);
+ OBD_ALLOC_PTR_ARRAY(osd_seq->oos_dirs, osd_seq->oos_subdir_count);
if (osd_seq->oos_dirs == NULL)
GOTO(out_put, rc = -ENOMEM);
if (osd_seq->oos_dirs[i] != NULL)
dput(osd_seq->oos_dirs[i]);
}
- OBD_FREE(osd_seq->oos_dirs,
- sizeof(seq_dir) * osd_seq->oos_subdir_count);
+ OBD_FREE_PTR_ARRAY(osd_seq->oos_dirs,
+ osd_seq->oos_subdir_count);
out_put:
dput(seq_dir);
osd_seq->oos_root = NULL;
RETURN(rc);
}
-static struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
- struct osd_device *osd, u64 seq)
+struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
+ struct osd_device *osd, u64 seq)
{
struct osd_obj_map *map;
struct osd_obj_seq *osd_seq;
LASSERT(d);
osd_oid_name(name, sizeof(name), fid, ostid_id(ostid));
- rc = osd_obj_del_entry(info, osd, d, name, th);
+ rc = osd_obj_del_entry(info, osd, d, name, strlen(name), th);
cleanup:
RETURN(rc);
}
dquot_initialize(src_parent);
dquot_initialize(dir);
- inode_lock(src_parent);
inode_lock(dir);
bh = osd_ldiskfs_find_entry(dir, &tgt_child->d_name, &de, NULL, NULL);
if (!IS_ERR(bh)) {
*/
brelse(bh);
inode_unlock(dir);
- inode_unlock(src_parent);
ldiskfs_journal_stop(jh);
rc = -EEXIST;
unlock:
inode_unlock(dir);
- inode_unlock(src_parent);
ldiskfs_journal_stop(jh);
return rc;
}
}
int osd_obj_spec_lookup(struct osd_thread_info *info, struct osd_device *osd,
- const struct lu_fid *fid, struct osd_inode_id *id)
+ const struct lu_fid *fid, struct osd_inode_id *id,
+ enum oi_check_flags flags)
{
struct dentry *root;
struct dentry *dentry;
RETURN(-ENOENT);
}
- dentry = osd_lookup_one_len_unlocked(osd, name, root, strlen(name));
+ dentry = osd_lookup_one_len_common(osd, name, root, strlen(name),
+ flags);
if (!IS_ERR(dentry)) {
inode = dentry->d_inode;
if (inode) {