Whamcloud - gitweb
LU-10565 osd: unify interface for vfs
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index 7712187..b7e6872 100644 (file)
@@ -278,7 +278,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
        sprintf(name, DFID_NOBRACE, PFID(lu_object_fid(&obj->oo_dt.do_lu)));
        dentry = osd_child_dentry_by_inode(env, parent->d_inode,
                                           name, strlen(name));
-       mutex_lock(&parent->d_inode->i_mutex);
+       inode_lock(parent->d_inode);
        rc = osd_ldiskfs_add_entry(info, osd, oh->ot_handle, dentry,
                                   obj->oo_inode, NULL);
        if (!rc && S_ISDIR(obj->oo_inode->i_mode))
@@ -290,7 +290,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
        CDEBUG(D_INODE, "%s: create agent entry for %s: rc = %d\n",
               osd_name(osd), name, rc);
        mark_inode_dirty(parent->d_inode);
-       mutex_unlock(&parent->d_inode->i_mutex);
+       inode_unlock(parent->d_inode);
        RETURN(rc);
 }
 
@@ -313,11 +313,11 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
        sprintf(name, DFID_NOBRACE, PFID(lu_object_fid(&obj->oo_dt.do_lu)));
        dentry = osd_child_dentry_by_inode(env, parent->d_inode,
                                           name, strlen(name));
-       mutex_lock(&parent->d_inode->i_mutex);
+       inode_lock(parent->d_inode);
        bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
                                    NULL, NULL);
        if (IS_ERR(bh)) {
-               mutex_unlock(&parent->d_inode->i_mutex);
+               inode_unlock(parent->d_inode);
                rc = PTR_ERR(bh);
                if (unlikely(rc == -ENOENT))
                        rc = 0;
@@ -327,7 +327,7 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
                if (!rc && S_ISDIR(obj->oo_inode->i_mode))
                        ldiskfs_dec_count(oh->ot_handle, parent->d_inode);
                mark_inode_dirty(parent->d_inode);
-               mutex_unlock(&parent->d_inode->i_mutex);
+               inode_unlock(parent->d_inode);
                brelse(bh);
                CDEBUG(D_INODE, "%s: remove agent entry for %s: rc = %d\n",
                       osd_name(osd), name, rc);
@@ -376,7 +376,7 @@ int osd_lookup_in_remote_parent(struct osd_thread_info *oti,
        sprintf(name, DFID_NOBRACE, PFID(fid));
        dentry = osd_child_dentry_by_inode(oti->oti_env, parent->d_inode,
                                           name, strlen(name));
-       mutex_lock(&parent->d_inode->i_mutex);
+       inode_lock(parent->d_inode);
        bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
                                    NULL, NULL);
        if (IS_ERR(bh)) {
@@ -396,7 +396,7 @@ int osd_lookup_in_remote_parent(struct osd_thread_info *oti,
                        rc = 0;
                }
        }
-       mutex_unlock(&parent->d_inode->i_mutex);
+       inode_unlock(parent->d_inode);
        if (rc == 0)
                osd_add_oi_cache(oti, osd, id, fid);
        RETURN(rc);
@@ -629,7 +629,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
        child->d_name.len = strlen(name);
 
        ll_vfs_dq_init(parent);
-       mutex_lock(&parent->i_mutex);
+       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));
@@ -736,7 +736,7 @@ update:
 out:
        if (!IS_ERR(bh))
                brelse(bh);
-       mutex_unlock(&parent->i_mutex);
+       inode_unlock(parent);
        return rc;
 }
 
@@ -764,7 +764,7 @@ static int osd_obj_del_entry(struct osd_thread_info *info,
        child->d_inode = NULL;
 
        ll_vfs_dq_init(dir);
-       mutex_lock(&dir->i_mutex);
+       inode_lock(dir);
        bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
        if (IS_ERR(bh)) {
                rc = PTR_ERR(bh);
@@ -772,7 +772,7 @@ static int osd_obj_del_entry(struct osd_thread_info *info,
                rc = ldiskfs_delete_entry(th, dir, de, bh);
                brelse(bh);
        }
-       mutex_unlock(&dir->i_mutex);
+       inode_unlock(dir);
 
        RETURN(rc);
 }
@@ -819,9 +819,9 @@ static int osd_obj_add_entry(struct osd_thread_info *info,
                inode->i_ino++;
 
        ll_vfs_dq_init(dir->d_inode);
-       mutex_lock(&dir->d_inode->i_mutex);
+       inode_lock(dir->d_inode);
        rc = osd_ldiskfs_add_entry(info, osd, th, child, inode, NULL);
-       mutex_unlock(&dir->d_inode->i_mutex);
+       inode_unlock(dir->d_inode);
 
        RETURN(rc);
 }
@@ -1015,9 +1015,9 @@ int osd_obj_map_lookup(struct osd_thread_info *info, struct osd_device *dev,
        child->d_name.len = strlen(name);
 
        dir = d_seq->d_inode;
-       mutex_lock(&dir->i_mutex);
+       inode_lock(dir);
        bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
-       mutex_unlock(&dir->i_mutex);
+       inode_unlock(dir);
 
        if (IS_ERR(bh))
                RETURN(PTR_ERR(bh));
@@ -1199,8 +1199,8 @@ int osd_obj_map_recover(struct osd_thread_info *info,
        ll_vfs_dq_init(src_parent);
        ll_vfs_dq_init(dir);
 
-       mutex_lock(&src_parent->i_mutex);
-       mutex_lock(&dir->i_mutex);
+       inode_lock(src_parent);
+       inode_lock(dir);
        bh = osd_ldiskfs_find_entry(dir, &tgt_child->d_name, &de, NULL, NULL);
        if (!IS_ERR(bh)) {
                /* XXX: If some other object occupied the same slot. And If such
@@ -1221,8 +1221,8 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                 *
                 *      So keep it there before we have suitable solution. */
                brelse(bh);
-               mutex_unlock(&dir->i_mutex);
-               mutex_unlock(&src_parent->i_mutex);
+               inode_unlock(dir);
+               inode_unlock(src_parent);
                ldiskfs_journal_stop(jh);
 
                rc = -EEXIST;
@@ -1251,8 +1251,8 @@ int osd_obj_map_recover(struct osd_thread_info *info,
        GOTO(unlock, rc);
 
 unlock:
-       mutex_unlock(&dir->i_mutex);
-       mutex_unlock(&src_parent->i_mutex);
+       inode_unlock(dir);
+       inode_unlock(src_parent);
        ldiskfs_journal_stop(jh);
        return rc;
 }