Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[cascardo/linux.git] / fs / ext4 / inline.c
index 4b143fe..095c7a2 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+
+#include <linux/fiemap.h>
+
 #include "ext4_jbd2.h"
 #include "ext4.h"
 #include "xattr.h"
 #include "truncate.h"
-#include <linux/fiemap.h>
 
 #define EXT4_XATTR_SYSTEM_DATA "data"
 #define EXT4_MIN_INLINE_DATA_SIZE      ((sizeof(__le32) * EXT4_N_BLOCKS))
@@ -972,7 +974,7 @@ void ext4_show_inline_dir(struct inode *dir, struct buffer_head *bh,
        offset = 0;
        while ((void *)de < dlimit) {
                de_len = ext4_rec_len_from_disk(de->rec_len, inline_size);
-               trace_printk("de: off %u rlen %u name %*.s nlen %u ino %u\n",
+               trace_printk("de: off %u rlen %u name %.*s nlen %u ino %u\n",
                             offset, de_len, de->name_len, de->name,
                             de->name_len, le32_to_cpu(de->inode));
                if (ext4_check_dir_entry(dir, NULL, de, bh,
@@ -998,7 +1000,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
                                     struct ext4_iloc *iloc,
                                     void *inline_start, int inline_size)
 {
-       struct inode    *dir = dentry->d_parent->d_inode;
+       struct inode    *dir = d_inode(dentry->d_parent);
        const char      *name = dentry->d_name.name;
        int             namelen = dentry->d_name.len;
        int             err;
@@ -1014,7 +1016,8 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
        err = ext4_journal_get_write_access(handle, iloc->bh);
        if (err)
                return err;
-       ext4_insert_dentry(inode, de, inline_size, name, namelen);
+       ext4_insert_dentry(dir, inode, de, inline_size, &dentry->d_name,
+                          name, namelen);
 
        ext4_show_inline_dir(dir, iloc->bh, inline_start, inline_size);
 
@@ -1251,7 +1254,7 @@ int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry,
        int ret, inline_size;
        void *inline_start;
        struct ext4_iloc iloc;
-       struct inode *dir = dentry->d_parent->d_inode;
+       struct inode *dir = d_inode(dentry->d_parent);
 
        ret = ext4_get_inode_loc(dir, &iloc);
        if (ret)
@@ -1327,6 +1330,7 @@ int htree_inlinedir_to_tree(struct file *dir_file,
        struct ext4_iloc iloc;
        void *dir_buf = NULL;
        struct ext4_dir_entry_2 fake;
+       struct ext4_str tmp_str;
 
        ret = ext4_get_inode_loc(inode, &iloc);
        if (ret)
@@ -1398,8 +1402,10 @@ int htree_inlinedir_to_tree(struct file *dir_file,
                        continue;
                if (de->inode == 0)
                        continue;
-               err = ext4_htree_store_dirent(dir_file,
-                                  hinfo->hash, hinfo->minor_hash, de);
+               tmp_str.name = de->name;
+               tmp_str.len = de->name_len;
+               err = ext4_htree_store_dirent(dir_file, hinfo->hash,
+                                             hinfo->minor_hash, de, &tmp_str);
                if (err) {
                        count = err;
                        goto out;