Whamcloud - gitweb
LU-73 RHEL6 support.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4_data_in_dirent-rhel6.patch
1 this patch implements feature which allows ext4 fs users (e.g. Lustre)
2 to store data in ext4 dirent.
3 data is stored in ext4 dirent after file-name, this space is accounted
4 in de->rec_len. flag EXT4_DIRENT_LUFID added to d_type if extra data
5 is present.
6
7 make use of dentry->d_fsdata to pass fid to ext4. so no
8 changes in ext4_add_entry() interface required.
9
10 Index: linux-2.6.32.i386/fs/ext4/dir.c
11 ===================================================================
12 --- linux-2.6.32.i386.orig/fs/ext4/dir.c        2009-12-03 09:21:21.000000000 +0530
13 +++ linux-2.6.32.i386/fs/ext4/dir.c     2010-04-16 06:25:43.000000000 +0530
14 @@ -53,11 +53,18 @@
15  
16  static unsigned char get_dtype(struct super_block *sb, int filetype)
17  {
18 +       int fl_index = filetype & EXT4_FT_MASK;
19 +
20         if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE) ||
21 -           (filetype >= EXT4_FT_MAX))
22 +           (fl_index >= EXT4_FT_MAX))
23                 return DT_UNKNOWN;
24  
25 -       return (ext4_filetype_table[filetype]);
26 +       if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_DIRDATA))
27 +               return (ext4_filetype_table[fl_index]);
28 +
29 +       return (ext4_filetype_table[fl_index]) |
30 +               (filetype & EXT4_DIRENT_LUFID);
31 +
32  }
33  
34  
35 @@ -70,11 +77,11 @@
36         const int rlen = ext4_rec_len_from_disk(de->rec_len,
37                                                 dir->i_sb->s_blocksize);
38  
39 -       if (rlen < EXT4_DIR_REC_LEN(1))
40 +       if (rlen < __EXT4_DIR_REC_LEN(1))
41                 error_msg = "rec_len is smaller than minimal";
42         else if (rlen % 4 != 0)
43                 error_msg = "rec_len % 4 != 0";
44 -       else if (rlen < EXT4_DIR_REC_LEN(de->name_len))
45 +       else if (rlen < EXT4_DIR_REC_LEN(de))
46                 error_msg = "rec_len is too small for name_len";
47         else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
48                 error_msg = "directory entry across blocks";
49 @@ -179,7 +186,7 @@
50                                  * failure will be detected in the
51                                  * dirent test below. */
52                                 if (ext4_rec_len_from_disk(de->rec_len,
53 -                                       sb->s_blocksize) < EXT4_DIR_REC_LEN(1))
54 +                                       sb->s_blocksize) < __EXT4_DIR_REC_LEN(1))
55                                         break;
56                                 i += ext4_rec_len_from_disk(de->rec_len,
57                                                             sb->s_blocksize);
58 @@ -342,12 +349,17 @@
59         struct fname *fname, *new_fn;
60         struct dir_private_info *info;
61         int len;
62 +       int extra_data = 1;
63  
64         info = (struct dir_private_info *) dir_file->private_data;
65         p = &info->root.rb_node;
66  
67         /* Create and allocate the fname structure */
68 -       len = sizeof(struct fname) + dirent->name_len + 1;
69 +       if (dirent->file_type & EXT4_DIRENT_LUFID)
70 +               extra_data = ext4_get_dirent_data_len(dirent);
71 +
72 +       len = sizeof(struct fname) + dirent->name_len + extra_data;
73 +
74         new_fn = kzalloc(len, GFP_KERNEL);
75         if (!new_fn)
76                 return -ENOMEM;
77 @@ -356,7 +368,7 @@
78         new_fn->inode = le32_to_cpu(dirent->inode);
79         new_fn->name_len = dirent->name_len;
80         new_fn->file_type = dirent->file_type;
81 -       memcpy(new_fn->name, dirent->name, dirent->name_len);
82 +       memcpy(new_fn->name, dirent->name, dirent->name_len + extra_data);
83         new_fn->name[dirent->name_len] = 0;
84  
85         while (*p) {
86 Index: linux-2.6.32.i386/fs/ext4/ext4.h
87 ===================================================================
88 --- linux-2.6.32.i386.orig/fs/ext4/ext4.h       2010-04-16 06:10:06.000000000 +0530
89 +++ linux-2.6.32.i386/fs/ext4/ext4.h    2010-04-16 06:27:40.000000000 +0530
90 @@ -1135,6 +1135,7 @@
91  #define EXT4_FEATURE_INCOMPAT_64BIT            0x0080
92  #define EXT4_FEATURE_INCOMPAT_MMP               0x0100
93  #define EXT4_FEATURE_INCOMPAT_FLEX_BG          0x0200
94 +#define EXT4_FEATURE_INCOMPAT_DIRDATA          0x1000
95  
96  #define EXT4_FEATURE_COMPAT_SUPP       EXT2_FEATURE_COMPAT_EXT_ATTR
97  #define EXT4_FEATURE_INCOMPAT_SUPP     (EXT4_FEATURE_INCOMPAT_FILETYPE| \
98 @@ -1143,7 +1144,9 @@
99                                          EXT4_FEATURE_INCOMPAT_EXTENTS| \
100                                          EXT4_FEATURE_INCOMPAT_64BIT| \
101                                          EXT4_FEATURE_INCOMPAT_FLEX_BG| \
102 -                                        EXT4_FEATURE_INCOMPAT_MMP)
103 +                                        EXT4_FEATURE_INCOMPAT_MMP| \
104 +                                        EXT4_FEATURE_INCOMPAT_DIRDATA)
105 +
106  #define EXT4_FEATURE_RO_COMPAT_SUPP    (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
107                                          EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
108                                          EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
109 @@ -1225,6 +1228,43 @@
110  #define EXT4_FT_SYMLINK                7
111  
112  #define EXT4_FT_MAX            8
113 +#define EXT4_FT_MASK           0xf
114 +
115 +#if EXT4_FT_MAX > EXT4_FT_MASK
116 +#error "conflicting EXT4_FT_MAX and EXT4_FT_MASK"
117 +#endif
118 +
119 +/*
120 + * d_type has 4 unused bits, so it can hold four types data. these different
121 + * type of data (e.g. lustre data, high 32 bits of 64-bit inode number) can be
122 + * stored, in flag order, after file-name in ext4 dirent.
123 +*/
124 +/*
125 + * this flag is added to d_type if ext4 dirent has extra data after
126 + * filename. this data length is variable and length is stored in first byte
127 + * of data. data start after filename NUL byte.
128 + * This is used by Lustre FS.
129 +  */
130 +#define EXT4_DIRENT_LUFID              0x10
131 +
132 +#define EXT4_LUFID_MAGIC    0xAD200907UL
133 +struct ext4_dentry_param {
134 +       __u32  edp_magic;       /* EXT4_LUFID_MAGIC */
135 +       char   edp_len;         /* size of edp_data in bytes */
136 +       char   edp_data[0];     /* packed array of data */
137 +} __attribute__((packed));
138 +
139 +static inline unsigned char *ext4_dentry_get_data(struct super_block *sb,
140 +               struct ext4_dentry_param* p)
141 +
142 +{
143 +       if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_DIRDATA))
144 +               return NULL;
145 +       if (p && p->edp_magic == EXT4_LUFID_MAGIC)
146 +               return &p->edp_len;
147 +       else
148 +               return NULL;
149 +}
150  
151  /*
152   * EXT4_DIR_PAD defines the directory entries boundaries
153 @@ -1233,8 +1273,11 @@
154   */
155  #define EXT4_DIR_PAD                   4
156  #define EXT4_DIR_ROUND                 (EXT4_DIR_PAD - 1)
157 -#define EXT4_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT4_DIR_ROUND) & \
158 +#define __EXT4_DIR_REC_LEN(name_len)   (((name_len) + 8 + EXT4_DIR_ROUND) & \
159                                          ~EXT4_DIR_ROUND)
160 +#define EXT4_DIR_REC_LEN(de)           (__EXT4_DIR_REC_LEN(de->name_len +\
161 +                                       ext4_get_dirent_data_len(de)))
162 +
163  #define EXT4_MAX_REC_LEN               ((1<<16)-1)
164  
165  /*
166 @@ -1524,7 +1567,7 @@
167                                             struct ext4_dir_entry_2 ** res_dir);
168  #define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir)
169  extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
170 -                              struct inode *inode);
171 +                              struct inode *inode, const void *, const void *);
172  extern struct buffer_head *ext4_append(handle_t *handle,
173                                        struct inode *inode,
174                                        ext4_lblk_t *block, int *err);
175 @@ -1851,6 +1894,28 @@
176         set_bit(BH_BITMAP_UPTODATE, &(bh)->b_state);
177  }
178  
179 +/*
180 + * Compute the total directory entry data length.
181 + * This includes the filename and an implicit NUL terminator (always present),
182 + * and optional extensions.  Each extension has a bit set in the high 4 bits of
183 + * de->file_type, and the extension length is the first byte in each entry.
184 + */
185 +static inline int ext4_get_dirent_data_len(struct ext4_dir_entry_2 *de)
186 +{
187 +       char *len = de->name + de->name_len + 1 /* NUL terminator */;
188 +       int dlen = 0;
189 +       __u8 extra_data_flags = (de->file_type & ~EXT4_FT_MASK) >> 4;
190 +
191 +       while (extra_data_flags) {
192 +               if (extra_data_flags & 1) {
193 +                       dlen += *len + (dlen == 0);
194 +                       len += *len;
195 +               }
196 +               extra_data_flags >>= 1;
197 +       }
198 +       return dlen;
199 +}
200 +
201  #endif /* __KERNEL__ */
202  
203  #endif /* _EXT4_H */
204 Index: linux-2.6.32.i386/fs/ext4/namei.c
205 ===================================================================
206 --- linux-2.6.32.i386.orig/fs/ext4/namei.c      2010-04-16 05:47:41.000000000 +0530
207 +++ linux-2.6.32.i386/fs/ext4/namei.c   2010-04-16 06:40:38.000000000 +0530
208 @@ -170,7 +170,8 @@
209  static unsigned dx_get_limit(struct dx_entry *entries);
210  static void dx_set_count(struct dx_entry *entries, unsigned value);
211  static void dx_set_limit(struct dx_entry *entries, unsigned value);
212 -static unsigned dx_root_limit(struct inode *dir, unsigned infosize);
213 +static inline unsigned dx_root_limit(__u32 blocksize,
214 +               struct ext4_dir_entry_2 *dot_de, unsigned infosize);
215  static unsigned dx_node_limit(struct inode *dir);
216  static struct dx_frame *dx_probe(const struct qstr *d_name,
217                                  struct inode *dir,
218 @@ -237,11 +238,12 @@
219   */
220  struct dx_root_info * dx_get_dx_info(struct ext4_dir_entry_2 *de)
221  {
222 -       /* get dotdot first */
223 -       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(1));
224 +       BUG_ON(de->name_len != 1);
225 +       /* get dotdot first */
226 +       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
227  
228 -       /* dx root info is after dotdot entry */
229 -       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(2));
230 +       /* dx root info is after dotdot entry */
231 +       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
232  
233         return (struct dx_root_info *) de;
234  }
235 @@ -286,16 +288,23 @@
236         ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value);
237  }
238  
239 -static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
240 +static inline unsigned dx_root_limit(__u32 blocksize,
241 +               struct ext4_dir_entry_2 *dot_de, unsigned infosize)
242  {
243 -       unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) -
244 -               EXT4_DIR_REC_LEN(2) - infosize;
245 +       struct ext4_dir_entry_2 *dotdot_de;
246 +       unsigned entry_space;
247 +
248 +       BUG_ON(dot_de->name_len != 1);
249 +       dotdot_de = ext4_next_entry(dot_de, blocksize);
250 +       entry_space = blocksize - EXT4_DIR_REC_LEN(dot_de) -
251 +                        EXT4_DIR_REC_LEN(dotdot_de) - infosize;
252 +
253         return entry_space / sizeof(struct dx_entry);
254  }
255  
256  static inline unsigned dx_node_limit(struct inode *dir)
257  {
258 -       unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0);
259 +       unsigned entry_space = dir->i_sb->s_blocksize - __EXT4_DIR_REC_LEN(0);
260         return entry_space / sizeof(struct dx_entry);
261  }
262  
263 @@ -342,7 +351,7 @@
264                                 printk(":%x.%u ", h.hash,
265                                        ((char *) de - base));
266                         }
267 -                       space += EXT4_DIR_REC_LEN(de->name_len);
268 +                       space += EXT4_DIR_REC_LEN(de);
269                         names++;
270                 }
271                 de = ext4_next_entry(de, size);
272 @@ -447,7 +456,8 @@
273  
274         entries = (struct dx_entry *) (((char *)info) + info->info_length);
275  
276 -       if (dx_get_limit(entries) != dx_root_limit(dir,
277 +       if (dx_get_limit(entries) != dx_root_limit(dir->i_sb->s_blocksize,
278 +                                                  (struct ext4_dir_entry_2*)bh->b_data,
279                                                    info->info_length)) {
280                 ext4_warning(dir->i_sb, __func__,
281                              "dx entry: limit != root limit");
282 @@ -637,7 +647,7 @@
283         de = (struct ext4_dir_entry_2 *) bh->b_data;
284         top = (struct ext4_dir_entry_2 *) ((char *) de +
285                                            dir->i_sb->s_blocksize -
286 -                                          EXT4_DIR_REC_LEN(0));
287 +                                          __EXT4_DIR_REC_LEN(0));
288         for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) {
289                 if (!ext4_check_dir_entry("htree_dirblock_to_tree", dir, de, bh,
290                                         (block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
291 @@ -1050,7 +1060,7 @@
292                         goto errout;
293                 de = (struct ext4_dir_entry_2 *) bh->b_data;
294                 top = (struct ext4_dir_entry_2 *) ((char *) de + sb->s_blocksize -
295 -                                      EXT4_DIR_REC_LEN(0));
296 +                                      __EXT4_DIR_REC_LEN(0));
297                 for (; de < top; de = ext4_next_entry(de, sb->s_blocksize)) {
298                         int off = (block << EXT4_BLOCK_SIZE_BITS(sb))
299                                   + ((char *) de - bh->b_data);
300 @@ -1216,7 +1226,7 @@
301         while (count--) {
302                 struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *) 
303                                                 (from + (map->offs<<2));
304 -               rec_len = EXT4_DIR_REC_LEN(de->name_len);
305 +               rec_len = EXT4_DIR_REC_LEN(de);
306                 memcpy (to, de, rec_len);
307                 ((struct ext4_dir_entry_2 *) to)->rec_len =
308                                 ext4_rec_len_to_disk(rec_len, blocksize);
309 @@ -1240,7 +1250,7 @@
310         while ((char*)de < base + blocksize) {
311                 next = ext4_next_entry(de, blocksize);
312                 if (de->inode && de->name_len) {
313 -                       rec_len = EXT4_DIR_REC_LEN(de->name_len);
314 +                       rec_len = EXT4_DIR_REC_LEN(de);
315                         if (de > to)
316                                 memmove(to, de, rec_len);
317                         to->rec_len = ext4_rec_len_to_disk(rec_len, blocksize);
318 @@ -1370,10 +1380,16 @@
319         unsigned int    offset = 0;
320         unsigned int    blocksize = dir->i_sb->s_blocksize;
321         unsigned short  reclen;
322 -       int             nlen, rlen, err;
323 +       int             nlen, rlen, err, dlen = 0;
324 +       unsigned char   *data;
325         char            *top;
326  
327 -       reclen = EXT4_DIR_REC_LEN(namelen);
328 +       data = ext4_dentry_get_data(inode->i_sb, (struct ext4_dentry_param *)
329 +                                               dentry->d_fsdata);
330 +       if (data)
331 +               dlen = (*data) + 1;
332 +
333 +       reclen = __EXT4_DIR_REC_LEN(namelen + dlen);
334         if (!de) {
335                 de = (struct ext4_dir_entry_2 *)bh->b_data;
336                 top = bh->b_data + blocksize - reclen;
337 @@ -1383,7 +1399,7 @@
338                                 return -EIO;
339                         if (ext4_match(namelen, name, de))
340                                 return -EEXIST;
341 -                       nlen = EXT4_DIR_REC_LEN(de->name_len);
342 +                       nlen = EXT4_DIR_REC_LEN(de);
343                         rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
344                         if ((de->inode? rlen - nlen: rlen) >= reclen)
345                                 break;
346 @@ -1401,7 +1417,7 @@
347         }
348  
349         /* By now the buffer is marked for journaling */
350 -       nlen = EXT4_DIR_REC_LEN(de->name_len);
351 +       nlen = EXT4_DIR_REC_LEN(de);
352         rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
353         if (de->inode) {
354                 struct ext4_dir_entry_2 *de1 = (struct ext4_dir_entry_2 *)((char *)de + nlen);
355 @@ -1417,6 +1433,12 @@
356                 de->inode = 0;
357         de->name_len = namelen;
358         memcpy(de->name, name, namelen);
359 +       if (data) {
360 +               de->name[namelen] = 0;
361 +               memcpy(&de->name[namelen + 1], data, *(char *) data);
362 +               de->file_type |= EXT4_DIRENT_LUFID;
363 +       }
364 +
365         /*
366          * XXX shouldn't update any times until successful
367          * completion of syscall, but too many callers depend
368 @@ -1515,7 +1537,8 @@
369  
370         dx_set_block(entries, 1);
371         dx_set_count(entries, 1);
372 -       dx_set_limit(entries, dx_root_limit(dir, sizeof(*dx_info)));
373 +       dx_set_limit(entries, dx_root_limit(dir->i_sb->s_blocksize,
374 +                                        dot_de, sizeof(*dx_info)));
375  
376         /* Initialize as for dx_probe */
377         hinfo.hash_version = dx_info->hash_version;
378 @@ -1546,6 +1569,8 @@
379         struct buffer_head * dir_block;
380         struct ext4_dir_entry_2 * de;
381         int len, journal = 0, err = 0;
382 +       int dlen = 0;
383 +       char *data;
384  
385         if (IS_ERR(handle))
386                 return PTR_ERR(handle);
387 @@ -1561,19 +1586,24 @@
388         /* the first item must be "." */
389         assert(de->name_len == 1 && de->name[0] == '.');
390         len = le16_to_cpu(de->rec_len);
391 -       assert(len >= EXT4_DIR_REC_LEN(1));
392 -       if (len > EXT4_DIR_REC_LEN(1)) {
393 +       assert(len >= __EXT4_DIR_REC_LEN(1));
394 +       if (len > __EXT4_DIR_REC_LEN(1)) {
395                 BUFFER_TRACE(dir_block, "get_write_access");
396                 err = ext4_journal_get_write_access(handle, dir_block);
397                 if (err)
398                         goto out_journal;
399  
400                 journal = 1;
401 -               de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(1));
402 +               de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
403         }
404  
405 -       len -= EXT4_DIR_REC_LEN(1);
406 -       assert(len == 0 || len >= EXT4_DIR_REC_LEN(2));
407 +       len -= EXT4_DIR_REC_LEN(de);
408 +       data = ext4_dentry_get_data(dir->i_sb,
409 +                       (struct ext4_dentry_param *) dentry->d_fsdata);
410 +       if (data)
411 +               dlen = *data + 1;
412 +       assert(len == 0 || len >= __EXT4_DIR_REC_LEN(2 + dlen));
413 +
414         de = (struct ext4_dir_entry_2 *)
415                         ((char *) de + le16_to_cpu(de->rec_len));
416         if (!journal) {
417 @@ -1587,10 +1617,15 @@
418         if (len > 0)
419                 de->rec_len = cpu_to_le16(len);
420         else
421 -               assert(le16_to_cpu(de->rec_len) >= EXT4_DIR_REC_LEN(2));
422 +               assert(le16_to_cpu(de->rec_len) >= __EXT4_DIR_REC_LEN(2));
423         de->name_len = 2;
424         strcpy (de->name, "..");
425         ext4_set_de_type(dir->i_sb, de, S_IFDIR);
426 +       if (data) {
427 +               de->name[2] = 0;
428 +               memcpy(&de->name[2 + 1], data, dlen);
429 +               de->file_type |= EXT4_DIRENT_LUFID;
430 +       }
431  
432  out_journal:
433         if (journal) {
434 @@ -2011,12 +2046,13 @@
435  /* Initialize @inode as a subdirectory of @dir, and add the
436   * "." and ".." entries into the first directory block. */
437  int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
438 -                       struct inode *inode)
439 +                       struct inode *inode,
440 +                        const void *data1, const void *data2)
441  {
442         struct buffer_head * dir_block;
443         struct ext4_dir_entry_2 * de;
444         unsigned int blocksize = dir->i_sb->s_blocksize;
445 -       int err = 0;
446 +       int err = 0, dot_reclen;
447  
448         if (IS_ERR(handle))
449                 return PTR_ERR(handle);
450 @@ -2040,17 +2076,32 @@
451         de = (struct ext4_dir_entry_2 *) dir_block->b_data;
452         de->inode = cpu_to_le32(inode->i_ino);
453         de->name_len = 1;
454 -       de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len),
455 -                                          blocksize);
456         strcpy(de->name, ".");
457         ext4_set_de_type(dir->i_sb, de, S_IFDIR);
458 +       /* get packed fid data*/
459 +       data1 = ext4_dentry_get_data(dir->i_sb,
460 +                               (struct ext4_dentry_param *) data1);
461 +       if (data1) {
462 +               de->name[1] = 0;
463 +               memcpy(&de->name[2], data1, *(char *) data1);
464 +               de->file_type |= EXT4_DIRENT_LUFID;
465 +       }
466 +       de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
467 +       dot_reclen = cpu_to_le16(de->rec_len);
468         de = ext4_next_entry(de, blocksize);
469         de->inode = cpu_to_le32(dir->i_ino);
470 -       de->rec_len = ext4_rec_len_to_disk(blocksize - EXT4_DIR_REC_LEN(1),
471 +       de->rec_len = ext4_rec_len_to_disk(blocksize - dot_reclen,
472                                            blocksize);
473         de->name_len = 2;
474         strcpy(de->name, "..");
475         ext4_set_de_type(dir->i_sb, de, S_IFDIR);
476 +       data2 = ext4_dentry_get_data(dir->i_sb,
477 +                       (struct ext4_dentry_param *) data2);
478 +       if (data2) {
479 +               de->name[2] = 0;
480 +               memcpy(&de->name[3], data2, *(char *) data2);
481 +               de->file_type |= EXT4_DIRENT_LUFID;
482 +       }
483         inode->i_nlink = 2;
484         BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
485         ext4_handle_dirty_metadata(handle, dir, dir_block);
486 @@ -2087,7 +2138,7 @@
487         if (IS_ERR(inode))
488                 goto out_stop;
489  
490 -       err = ext4_add_dot_dotdot(handle, dir, inode);
491 +       err = ext4_add_dot_dotdot(handle, dir, inode, NULL, NULL);
492         if (err)
493                 goto out_stop;
494  
495 @@ -2123,7 +2174,7 @@
496         int err = 0;
497  
498         sb = inode->i_sb;
499 -       if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) ||
500 +       if (inode->i_size < __EXT4_DIR_REC_LEN(1) + __EXT4_DIR_REC_LEN(2) ||
501             !(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
502                 if (err)
503                         ext4_error(inode->i_sb, __func__,