Whamcloud - gitweb
LU-3373 misc: small changes for 3.10 server support
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index f5f21c8..a4323d0 100644 (file)
@@ -257,10 +257,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
                                   NULL);
        CDEBUG(D_INODE, "%s: add %s:%lu to remote parent %lu.\n", osd_name(osd),
               name, obj->oo_inode->i_ino, parent->d_inode->i_ino);
-       LASSERTF(parent->d_inode->i_nlink > 1, "%s: %lu nlink %d",
-                osd_name(osd), parent->d_inode->i_ino,
-                parent->d_inode->i_nlink);
-       parent->d_inode->i_nlink++;
+       ldiskfs_inc_count(oh->ot_handle, parent->d_inode);
        mark_inode_dirty(parent->d_inode);
        mutex_unlock(&parent->d_inode->i_mutex);
        RETURN(rc);
@@ -294,7 +291,8 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
        dentry = osd_child_dentry_by_inode(env, parent->d_inode,
                                           name, strlen(name));
        mutex_lock(&parent->d_inode->i_mutex);
-       bh = osd_ldiskfs_find_entry(parent->d_inode, dentry, &de, NULL);
+       bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
+                                   NULL, NULL);
        if (bh == NULL) {
                mutex_unlock(&parent->d_inode->i_mutex);
                RETURN(-ENOENT);
@@ -302,10 +300,7 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
        CDEBUG(D_INODE, "%s: el %s:%lu to remote parent %lu.\n", osd_name(osd),
               name, obj->oo_inode->i_ino, parent->d_inode->i_ino);
        rc = ldiskfs_delete_entry(oh->ot_handle, parent->d_inode, de, bh);
-       LASSERTF(parent->d_inode->i_nlink > 1, "%s: %lu nlink %d",
-                osd_name(osd), parent->d_inode->i_ino,
-                parent->d_inode->i_nlink);
-       parent->d_inode->i_nlink--;
+       ldiskfs_dec_count(oh->ot_handle, parent->d_inode);
        mark_inode_dirty(parent->d_inode);
        mutex_unlock(&parent->d_inode->i_mutex);
        brelse(bh);
@@ -337,7 +332,8 @@ int osd_lookup_in_remote_parent(struct osd_thread_info *oti,
        dentry = osd_child_dentry_by_inode(oti->oti_env, parent->d_inode,
                                           name, strlen(name));
        mutex_lock(&parent->d_inode->i_mutex);
-       bh = osd_ldiskfs_find_entry(parent->d_inode, dentry, &de, NULL);
+       bh = osd_ldiskfs_find_entry(parent->d_inode, &dentry->d_name, &de,
+                                   NULL, NULL);
        if (bh == NULL) {
                rc = -ENOENT;
        } else {
@@ -558,7 +554,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
 
        ll_vfs_dq_init(parent);
        mutex_lock(&parent->i_mutex);
-       bh = osd_ldiskfs_find_entry(parent, child, &de, NULL);
+       bh = osd_ldiskfs_find_entry(parent, &child->d_name, &de, NULL, NULL);
        if (bh == NULL)
                GOTO(out, rc = -ENOENT);
 
@@ -652,7 +648,7 @@ static int osd_obj_del_entry(struct osd_thread_info *info,
        ll_vfs_dq_init(dir);
        mutex_lock(&dir->i_mutex);
        rc = -ENOENT;
-       bh = osd_ldiskfs_find_entry(dir, child, &de, NULL);
+       bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
        if (bh) {
                rc = ldiskfs_delete_entry(oh->ot_handle, dir, de, bh);
                brelse(bh);
@@ -915,7 +911,7 @@ int osd_obj_map_lookup(struct osd_thread_info *info, struct osd_device *dev,
 
        dir = d_seq->d_inode;
        mutex_lock(&dir->i_mutex);
-       bh = osd_ldiskfs_find_entry(dir, child, &de, NULL);
+       bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
        mutex_unlock(&dir->i_mutex);
 
        if (bh == NULL)
@@ -1085,7 +1081,7 @@ int osd_obj_map_recover(struct osd_thread_info *info,
        tgt_child->d_inode = inode;
 
        /* The non-initialized src_child may be destroyed. */
-       jh = ldiskfs_journal_start_sb(osd_sb(osd),
+       jh = osd_journal_start_sb(osd_sb(osd), LDISKFS_HT_MISC,
                                osd_dto_credits_noquota[DTO_INDEX_DELETE] +
                                osd_dto_credits_noquota[DTO_INDEX_INSERT] +
                                osd_dto_credits_noquota[DTO_OBJECT_DELETE]);
@@ -1097,7 +1093,7 @@ int osd_obj_map_recover(struct osd_thread_info *info,
 
        mutex_lock(&src_parent->i_mutex);
        mutex_lock(&dir->i_mutex);
-       bh = osd_ldiskfs_find_entry(dir, tgt_child, &de, NULL);
+       bh = osd_ldiskfs_find_entry(dir, &tgt_child->d_name, &de, NULL, NULL);
        if (bh != NULL) {
                /* XXX: If some other object occupied the same slot. And If such
                 *      inode is zero-sized and with SUID+SGID, then means it is
@@ -1123,8 +1119,8 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                /* If the src object has never been modified, then remove it. */
                if (inode->i_size == 0 && inode->i_mode & S_ISUID &&
                    inode->i_mode & S_ISGID) {
-                       bh = osd_ldiskfs_find_entry(src_parent, src_child, &de,
-                                                   NULL);
+                       bh = osd_ldiskfs_find_entry(src_parent, &src_child->d_name,
+                                                   &de, NULL, NULL);
                        if (unlikely(bh == NULL)) {
                                mutex_unlock(&src_parent->i_mutex);
                                ldiskfs_journal_stop(jh);
@@ -1143,7 +1139,8 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                RETURN(rc);
        }
 
-       bh = osd_ldiskfs_find_entry(src_parent, src_child, &de, NULL);
+       bh = osd_ldiskfs_find_entry(src_parent, &src_child->d_name, &de,
+                                   NULL, NULL);
        if (unlikely(bh == NULL))
                GOTO(unlock, rc = -ENOENT);