struct dentry *dir, const char *name,
const struct lu_fid *fid,
const struct osd_inode_id *id,
- handle_t *th)
+ handle_t *th, bool locked)
{
struct inode *parent = dir->d_inode;
struct dentry *child;
child->d_name.len = strlen(name);
dquot_initialize(parent);
- inode_lock(parent);
+ if (!locked)
+ inode_lock(parent);
bh = osd_ldiskfs_find_entry(parent, &child->d_name, &de, NULL, NULL);
if (IS_ERR(bh))
GOTO(out, rc = PTR_ERR(bh));
out:
if (!IS_ERR(bh))
brelse(bh);
- inode_unlock(parent);
+ if (!locked)
+ inode_unlock(parent);
return rc;
}
struct osd_device *osd,
struct dentry *dir, char *name,
const struct osd_inode_id *id,
- handle_t *th)
+ handle_t *th, bool locked)
{
struct dentry *child;
struct inode *inode;
inode->i_ino++;
dquot_initialize(dir->d_inode);
- inode_lock(dir->d_inode);
+ if (!locked)
+ inode_lock(dir->d_inode);
rc = osd_ldiskfs_add_entry(info, osd, th, child, inode, NULL);
- inode_unlock(dir->d_inode);
+ if (!locked)
+ inode_unlock(dir->d_inode);
RETURN(rc);
}
osd_oid_name(name, sizeof(name), fid, oid);
again:
- rc = osd_obj_add_entry(info, osd, d, name, id, th);
+ rc = osd_obj_add_entry(info, osd, d, name, id, th, false);
if (rc == -EEXIST) {
- rc = osd_obj_update_entry(info, osd, d, name, fid, id, th);
+ rc = osd_obj_update_entry(info, osd, d, name, fid, id, th,
+ false);
if (unlikely(rc == -ENOENT))
goto again;
LASSERT(d);
osd_oid_name(name, sizeof(name), fid, ostid_id(ostid));
- rc = osd_obj_update_entry(info, osd, d, name, fid, id, th);
+ rc = osd_obj_update_entry(info, osd, d, name, fid, id, th, false);
RETURN(rc);
}
int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
const struct lu_fid *fid, const struct osd_inode_id *id,
- handle_t *th)
+ handle_t *th, bool locked)
{
struct dentry *root;
char *name = NULL;
root = osd_object_spec_find(info, osd, fid, &name);
if (!IS_ERR(root)) {
- rc = osd_obj_update_entry(info, osd, root, name, fid, id, th);
+ rc = osd_obj_update_entry(info, osd, root, name, fid, id, th,
+ locked);
} else {
rc = PTR_ERR(root);
if (rc == -ENOENT)
int osd_obj_spec_insert(struct osd_thread_info *info, struct osd_device *osd,
const struct lu_fid *fid, const struct osd_inode_id *id,
- handle_t *th)
+ handle_t *th, bool locked)
{
struct dentry *root;
char *name = NULL;
root = osd_object_spec_find(info, osd, fid, &name);
if (!IS_ERR(root)) {
- rc = osd_obj_add_entry(info, osd, root, name, id, th);
+ rc = osd_obj_add_entry(info, osd, root, name, id, th, locked);
} else {
rc = PTR_ERR(root);
if (rc == -ENOENT)
struct lu_fid *oi_fid = &info->oti_fid2;
struct osd_inode_id *oi_id = &info->oti_id2;
int rc = 0;
+ bool locked = !!(flags & OI_LOCKED);
CDEBUG(D_INODE, "insert OI for "DFID"\n", PFID(fid));
if (unlikely(fid_is_last_id(fid)))
- return osd_obj_spec_insert(info, osd, fid, id, th);
+ return osd_obj_spec_insert(info, osd, fid, id, th, locked);
if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
return osd_obj_map_insert(info, osd, fid, id, th);
}
if (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE))
- rc = osd_obj_spec_insert(info, osd, fid, id, th);
+ rc = osd_obj_spec_insert(info, osd, fid, id, th, locked);
return rc;
}
struct lu_fid *oi_fid = &info->oti_fid2;
struct osd_inode_id *oi_id = &info->oti_id2;
int rc = 0;
+ bool locked = !!(flags & OI_LOCKED);
CDEBUG(D_INODE, "update OI for "DFID"\n", PFID(fid));
if (unlikely(fid_is_last_id(fid)))
- return osd_obj_spec_update(info, osd, fid, id, th);
+ return osd_obj_spec_update(info, osd, fid, id, th, locked);
if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
return osd_obj_map_update(info, osd, fid, id, th);
return rc;
if (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE))
- rc = osd_obj_spec_update(info, osd, fid, id, th);
+ rc = osd_obj_spec_update(info, osd, fid, id, th, locked);
return rc;
}