]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/ubifs/dir.c
UBIFS: introduce helper functions for debugging checks and tests
[mirror_ubuntu-artful-kernel.git] / fs / ubifs / dir.c
index c2b80943560d6f9516468903a9847ae5089e28f8..68349204331793dec867768905bc04817c34f61f 100644 (file)
@@ -102,7 +102,7 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
         * UBIFS has to fully control "clean <-> dirty" transitions of inodes
         * to make budgeting work.
         */
-       inode->i_flags |= (S_NOCMTIME);
+       inode->i_flags |= S_NOCMTIME;
 
        inode_init_owner(inode, dir, mode);
        inode->i_mtime = inode->i_atime = inode->i_ctime =
@@ -172,9 +172,11 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
 
 #ifdef CONFIG_UBIFS_FS_DEBUG
 
-static int dbg_check_name(struct ubifs_dent_node *dent, struct qstr *nm)
+static int dbg_check_name(const struct ubifs_info *c,
+                         const struct ubifs_dent_node *dent,
+                         const struct qstr *nm)
 {
-       if (!(ubifs_chk_flags & UBIFS_CHK_GEN))
+       if (!dbg_is_chk_gen(c))
                return 0;
        if (le16_to_cpu(dent->nlen) != nm->len)
                return -EINVAL;
@@ -185,7 +187,7 @@ static int dbg_check_name(struct ubifs_dent_node *dent, struct qstr *nm)
 
 #else
 
-#define dbg_check_name(dent, nm) 0
+#define dbg_check_name(c, dent, nm) 0
 
 #endif
 
@@ -219,7 +221,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry,
                goto out;
        }
 
-       if (dbg_check_name(dent, &dentry->d_name)) {
+       if (dbg_check_name(c, dent, &dentry->d_name)) {
                err = -EINVAL;
                goto out;
        }
@@ -522,7 +524,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
        ubifs_assert(mutex_is_locked(&dir->i_mutex));
        ubifs_assert(mutex_is_locked(&inode->i_mutex));
 
-       err = dbg_check_synced_i_size(inode);
+       err = dbg_check_synced_i_size(c, inode);
        if (err)
                return err;
 
@@ -577,7 +579,7 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
                inode->i_nlink, dir->i_ino);
        ubifs_assert(mutex_is_locked(&dir->i_mutex));
        ubifs_assert(mutex_is_locked(&inode->i_mutex));
-       err = dbg_check_synced_i_size(inode);
+       err = dbg_check_synced_i_size(c, inode);
        if (err)
                return err;
 
@@ -656,8 +658,6 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
        struct ubifs_inode *dir_ui = ubifs_inode(dir);
        struct ubifs_budget_req req = { .mod_dent = 1, .dirtied_ino = 2 };
 
-       dentry_unhash(dentry);
-
        /*
         * Budget request settings: deletion direntry, deletion inode and
         * changing the parent inode. If budgeting fails, go ahead anyway
@@ -978,9 +978,6 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        .dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
        struct timespec time;
 
-       if (new_inode && S_ISDIR(new_inode->i_mode))
-               dentry_unhash(new_dentry);
-
        /*
         * Budget request settings: deletion direntry, new direntry, removing
         * the old inode, and changing old and new parent directory inodes.