dir.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. * linux/fs/ext4/dir.c
  3. *
  4. * Copyright (C) 1992, 1993, 1994, 1995
  5. * Remy Card (card@masi.ibp.fr)
  6. * Laboratoire MASI - Institut Blaise Pascal
  7. * Universite Pierre et Marie Curie (Paris VI)
  8. *
  9. * from
  10. *
  11. * linux/fs/minix/dir.c
  12. *
  13. * Copyright (C) 1991, 1992 Linus Torvalds
  14. *
  15. * ext4 directory handling functions
  16. *
  17. * Big-endian to little-endian byte-swapping/bitmaps by
  18. * David S. Miller (davem@caip.rutgers.edu), 1995
  19. *
  20. * Hash Tree Directory indexing (c) 2001 Daniel Phillips
  21. *
  22. */
  23. #include <linux/fs.h>
  24. #include <linux/buffer_head.h>
  25. #include <linux/slab.h>
  26. #include "ext4.h"
  27. #include "xattr.h"
  28. static int ext4_dx_readdir(struct file *, struct dir_context *);
  29. /**
  30. * Check if the given dir-inode refers to an htree-indexed directory
  31. * (or a directory which could potentially get converted to use htree
  32. * indexing).
  33. *
  34. * Return 1 if it is a dx dir, 0 if not
  35. */
  36. static int is_dx_dir(struct inode *inode)
  37. {
  38. struct super_block *sb = inode->i_sb;
  39. if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
  40. EXT4_FEATURE_COMPAT_DIR_INDEX) &&
  41. ((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
  42. ((inode->i_size >> sb->s_blocksize_bits) == 1) ||
  43. ext4_has_inline_data(inode)))
  44. return 1;
  45. return 0;
  46. }
  47. /*
  48. * Return 0 if the directory entry is OK, and 1 if there is a problem
  49. *
  50. * Note: this is the opposite of what ext2 and ext3 historically returned...
  51. *
  52. * bh passed here can be an inode block or a dir data block, depending
  53. * on the inode inline data flag.
  54. */
  55. int __ext4_check_dir_entry(const char *function, unsigned int line,
  56. struct inode *dir, struct file *filp,
  57. struct ext4_dir_entry_2 *de,
  58. struct buffer_head *bh, char *buf, int size,
  59. unsigned int offset)
  60. {
  61. const char *error_msg = NULL;
  62. const int rlen = ext4_rec_len_from_disk(de->rec_len,
  63. dir->i_sb->s_blocksize);
  64. if (unlikely(rlen < EXT4_DIR_REC_LEN(1)))
  65. error_msg = "rec_len is smaller than minimal";
  66. else if (unlikely(rlen % 4 != 0))
  67. error_msg = "rec_len % 4 != 0";
  68. else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
  69. error_msg = "rec_len is too small for name_len";
  70. else if (unlikely(((char *) de - buf) + rlen > size))
  71. error_msg = "directory entry across range";
  72. else if (unlikely(le32_to_cpu(de->inode) >
  73. le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count)))
  74. error_msg = "inode out of bounds";
  75. else
  76. return 0;
  77. if (filp)
  78. ext4_error_file(filp, function, line, bh->b_blocknr,
  79. "bad entry in directory: %s - offset=%u(%u), "
  80. "inode=%u, rec_len=%d, name_len=%d",
  81. error_msg, (unsigned) (offset % size),
  82. offset, le32_to_cpu(de->inode),
  83. rlen, de->name_len);
  84. else
  85. ext4_error_inode(dir, function, line, bh->b_blocknr,
  86. "bad entry in directory: %s - offset=%u(%u), "
  87. "inode=%u, rec_len=%d, name_len=%d",
  88. error_msg, (unsigned) (offset % size),
  89. offset, le32_to_cpu(de->inode),
  90. rlen, de->name_len);
  91. return 1;
  92. }
  93. static int ext4_readdir(struct file *file, struct dir_context *ctx)
  94. {
  95. unsigned int offset;
  96. int i;
  97. struct ext4_dir_entry_2 *de;
  98. int err;
  99. struct inode *inode = file_inode(file);
  100. struct super_block *sb = inode->i_sb;
  101. struct buffer_head *bh = NULL;
  102. int dir_has_error = 0;
  103. struct ext4_str fname_crypto_str = {.name = NULL, .len = 0};
  104. if (is_dx_dir(inode)) {
  105. err = ext4_dx_readdir(file, ctx);
  106. if (err != ERR_BAD_DX_DIR) {
  107. return err;
  108. }
  109. /*
  110. * We don't set the inode dirty flag since it's not
  111. * critical that it get flushed back to the disk.
  112. */
  113. ext4_clear_inode_flag(file_inode(file),
  114. EXT4_INODE_INDEX);
  115. }
  116. if (ext4_has_inline_data(inode)) {
  117. int has_inline_data = 1;
  118. err = ext4_read_inline_dir(file, ctx,
  119. &has_inline_data);
  120. if (has_inline_data)
  121. return err;
  122. }
  123. if (ext4_encrypted_inode(inode)) {
  124. err = ext4_fname_crypto_alloc_buffer(inode, EXT4_NAME_LEN,
  125. &fname_crypto_str);
  126. if (err < 0)
  127. return err;
  128. }
  129. offset = ctx->pos & (sb->s_blocksize - 1);
  130. while (ctx->pos < inode->i_size) {
  131. struct ext4_map_blocks map;
  132. map.m_lblk = ctx->pos >> EXT4_BLOCK_SIZE_BITS(sb);
  133. map.m_len = 1;
  134. err = ext4_map_blocks(NULL, inode, &map, 0);
  135. if (err > 0) {
  136. pgoff_t index = map.m_pblk >>
  137. (PAGE_CACHE_SHIFT - inode->i_blkbits);
  138. if (!ra_has_index(&file->f_ra, index))
  139. page_cache_sync_readahead(
  140. sb->s_bdev->bd_inode->i_mapping,
  141. &file->f_ra, file,
  142. index, 1);
  143. file->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
  144. bh = ext4_bread(NULL, inode, map.m_lblk, 0);
  145. if (IS_ERR(bh))
  146. return PTR_ERR(bh);
  147. }
  148. if (!bh) {
  149. if (!dir_has_error) {
  150. EXT4_ERROR_FILE(file, 0,
  151. "directory contains a "
  152. "hole at offset %llu",
  153. (unsigned long long) ctx->pos);
  154. dir_has_error = 1;
  155. }
  156. /* corrupt size? Maybe no more blocks to read */
  157. if (ctx->pos > inode->i_blocks << 9)
  158. break;
  159. ctx->pos += sb->s_blocksize - offset;
  160. continue;
  161. }
  162. /* Check the checksum */
  163. if (!buffer_verified(bh) &&
  164. !ext4_dirent_csum_verify(inode,
  165. (struct ext4_dir_entry *)bh->b_data)) {
  166. EXT4_ERROR_FILE(file, 0, "directory fails checksum "
  167. "at offset %llu",
  168. (unsigned long long)ctx->pos);
  169. ctx->pos += sb->s_blocksize - offset;
  170. brelse(bh);
  171. bh = NULL;
  172. continue;
  173. }
  174. set_buffer_verified(bh);
  175. /* If the dir block has changed since the last call to
  176. * readdir(2), then we might be pointing to an invalid
  177. * dirent right now. Scan from the start of the block
  178. * to make sure. */
  179. if (file->f_version != inode->i_version) {
  180. for (i = 0; i < sb->s_blocksize && i < offset; ) {
  181. de = (struct ext4_dir_entry_2 *)
  182. (bh->b_data + i);
  183. /* It's too expensive to do a full
  184. * dirent test each time round this
  185. * loop, but we do have to test at
  186. * least that it is non-zero. A
  187. * failure will be detected in the
  188. * dirent test below. */
  189. if (ext4_rec_len_from_disk(de->rec_len,
  190. sb->s_blocksize) < EXT4_DIR_REC_LEN(1))
  191. break;
  192. i += ext4_rec_len_from_disk(de->rec_len,
  193. sb->s_blocksize);
  194. }
  195. offset = i;
  196. ctx->pos = (ctx->pos & ~(sb->s_blocksize - 1))
  197. | offset;
  198. file->f_version = inode->i_version;
  199. }
  200. while (ctx->pos < inode->i_size
  201. && offset < sb->s_blocksize) {
  202. de = (struct ext4_dir_entry_2 *) (bh->b_data + offset);
  203. if (ext4_check_dir_entry(inode, file, de, bh,
  204. bh->b_data, bh->b_size,
  205. offset)) {
  206. /*
  207. * On error, skip to the next block
  208. */
  209. ctx->pos = (ctx->pos |
  210. (sb->s_blocksize - 1)) + 1;
  211. break;
  212. }
  213. offset += ext4_rec_len_from_disk(de->rec_len,
  214. sb->s_blocksize);
  215. if (le32_to_cpu(de->inode)) {
  216. if (!ext4_encrypted_inode(inode)) {
  217. if (!dir_emit(ctx, de->name,
  218. de->name_len,
  219. le32_to_cpu(de->inode),
  220. get_dtype(sb, de->file_type)))
  221. goto done;
  222. } else {
  223. int save_len = fname_crypto_str.len;
  224. /* Directory is encrypted */
  225. err = ext4_fname_disk_to_usr(inode,
  226. NULL, de, &fname_crypto_str);
  227. fname_crypto_str.len = save_len;
  228. if (err < 0)
  229. goto errout;
  230. if (!dir_emit(ctx,
  231. fname_crypto_str.name, err,
  232. le32_to_cpu(de->inode),
  233. get_dtype(sb, de->file_type)))
  234. goto done;
  235. }
  236. }
  237. ctx->pos += ext4_rec_len_from_disk(de->rec_len,
  238. sb->s_blocksize);
  239. }
  240. if ((ctx->pos < inode->i_size) && !dir_relax(inode))
  241. goto done;
  242. brelse(bh);
  243. bh = NULL;
  244. offset = 0;
  245. }
  246. done:
  247. err = 0;
  248. errout:
  249. #ifdef CONFIG_EXT4_FS_ENCRYPTION
  250. ext4_fname_crypto_free_buffer(&fname_crypto_str);
  251. #endif
  252. brelse(bh);
  253. return err;
  254. }
  255. static inline int is_32bit_api(void)
  256. {
  257. #ifdef CONFIG_COMPAT
  258. return is_compat_task();
  259. #else
  260. return (BITS_PER_LONG == 32);
  261. #endif
  262. }
  263. /*
  264. * These functions convert from the major/minor hash to an f_pos
  265. * value for dx directories
  266. *
  267. * Upper layer (for example NFS) should specify FMODE_32BITHASH or
  268. * FMODE_64BITHASH explicitly. On the other hand, we allow ext4 to be mounted
  269. * directly on both 32-bit and 64-bit nodes, under such case, neither
  270. * FMODE_32BITHASH nor FMODE_64BITHASH is specified.
  271. */
  272. static inline loff_t hash2pos(struct file *filp, __u32 major, __u32 minor)
  273. {
  274. if ((filp->f_mode & FMODE_32BITHASH) ||
  275. (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
  276. return major >> 1;
  277. else
  278. return ((__u64)(major >> 1) << 32) | (__u64)minor;
  279. }
  280. static inline __u32 pos2maj_hash(struct file *filp, loff_t pos)
  281. {
  282. if ((filp->f_mode & FMODE_32BITHASH) ||
  283. (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
  284. return (pos << 1) & 0xffffffff;
  285. else
  286. return ((pos >> 32) << 1) & 0xffffffff;
  287. }
  288. static inline __u32 pos2min_hash(struct file *filp, loff_t pos)
  289. {
  290. if ((filp->f_mode & FMODE_32BITHASH) ||
  291. (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
  292. return 0;
  293. else
  294. return pos & 0xffffffff;
  295. }
  296. /*
  297. * Return 32- or 64-bit end-of-file for dx directories
  298. */
  299. static inline loff_t ext4_get_htree_eof(struct file *filp)
  300. {
  301. if ((filp->f_mode & FMODE_32BITHASH) ||
  302. (!(filp->f_mode & FMODE_64BITHASH) && is_32bit_api()))
  303. return EXT4_HTREE_EOF_32BIT;
  304. else
  305. return EXT4_HTREE_EOF_64BIT;
  306. }
  307. /*
  308. * ext4_dir_llseek() calls generic_file_llseek_size to handle htree
  309. * directories, where the "offset" is in terms of the filename hash
  310. * value instead of the byte offset.
  311. *
  312. * Because we may return a 64-bit hash that is well beyond offset limits,
  313. * we need to pass the max hash as the maximum allowable offset in
  314. * the htree directory case.
  315. *
  316. * For non-htree, ext4_llseek already chooses the proper max offset.
  317. */
  318. static loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence)
  319. {
  320. struct inode *inode = file->f_mapping->host;
  321. int dx_dir = is_dx_dir(inode);
  322. loff_t htree_max = ext4_get_htree_eof(file);
  323. if (likely(dx_dir))
  324. return generic_file_llseek_size(file, offset, whence,
  325. htree_max, htree_max);
  326. else
  327. return ext4_llseek(file, offset, whence);
  328. }
  329. /*
  330. * This structure holds the nodes of the red-black tree used to store
  331. * the directory entry in hash order.
  332. */
  333. struct fname {
  334. __u32 hash;
  335. __u32 minor_hash;
  336. struct rb_node rb_hash;
  337. struct fname *next;
  338. __u32 inode;
  339. __u8 name_len;
  340. __u8 file_type;
  341. char name[0];
  342. };
  343. /*
  344. * This functoin implements a non-recursive way of freeing all of the
  345. * nodes in the red-black tree.
  346. */
  347. static void free_rb_tree_fname(struct rb_root *root)
  348. {
  349. struct fname *fname, *next;
  350. rbtree_postorder_for_each_entry_safe(fname, next, root, rb_hash)
  351. while (fname) {
  352. struct fname *old = fname;
  353. fname = fname->next;
  354. kfree(old);
  355. }
  356. *root = RB_ROOT;
  357. }
  358. static struct dir_private_info *ext4_htree_create_dir_info(struct file *filp,
  359. loff_t pos)
  360. {
  361. struct dir_private_info *p;
  362. p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL);
  363. if (!p)
  364. return NULL;
  365. p->curr_hash = pos2maj_hash(filp, pos);
  366. p->curr_minor_hash = pos2min_hash(filp, pos);
  367. return p;
  368. }
  369. void ext4_htree_free_dir_info(struct dir_private_info *p)
  370. {
  371. free_rb_tree_fname(&p->root);
  372. kfree(p);
  373. }
  374. /*
  375. * Given a directory entry, enter it into the fname rb tree.
  376. *
  377. * When filename encryption is enabled, the dirent will hold the
  378. * encrypted filename, while the htree will hold decrypted filename.
  379. * The decrypted filename is passed in via ent_name. parameter.
  380. */
  381. int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
  382. __u32 minor_hash,
  383. struct ext4_dir_entry_2 *dirent,
  384. struct ext4_str *ent_name)
  385. {
  386. struct rb_node **p, *parent = NULL;
  387. struct fname *fname, *new_fn;
  388. struct dir_private_info *info;
  389. int len;
  390. info = dir_file->private_data;
  391. p = &info->root.rb_node;
  392. /* Create and allocate the fname structure */
  393. len = sizeof(struct fname) + ent_name->len + 1;
  394. new_fn = kzalloc(len, GFP_KERNEL);
  395. if (!new_fn)
  396. return -ENOMEM;
  397. new_fn->hash = hash;
  398. new_fn->minor_hash = minor_hash;
  399. new_fn->inode = le32_to_cpu(dirent->inode);
  400. new_fn->name_len = ent_name->len;
  401. new_fn->file_type = dirent->file_type;
  402. memcpy(new_fn->name, ent_name->name, ent_name->len);
  403. new_fn->name[ent_name->len] = 0;
  404. while (*p) {
  405. parent = *p;
  406. fname = rb_entry(parent, struct fname, rb_hash);
  407. /*
  408. * If the hash and minor hash match up, then we put
  409. * them on a linked list. This rarely happens...
  410. */
  411. if ((new_fn->hash == fname->hash) &&
  412. (new_fn->minor_hash == fname->minor_hash)) {
  413. new_fn->next = fname->next;
  414. fname->next = new_fn;
  415. return 0;
  416. }
  417. if (new_fn->hash < fname->hash)
  418. p = &(*p)->rb_left;
  419. else if (new_fn->hash > fname->hash)
  420. p = &(*p)->rb_right;
  421. else if (new_fn->minor_hash < fname->minor_hash)
  422. p = &(*p)->rb_left;
  423. else /* if (new_fn->minor_hash > fname->minor_hash) */
  424. p = &(*p)->rb_right;
  425. }
  426. rb_link_node(&new_fn->rb_hash, parent, p);
  427. rb_insert_color(&new_fn->rb_hash, &info->root);
  428. return 0;
  429. }
  430. /*
  431. * This is a helper function for ext4_dx_readdir. It calls filldir
  432. * for all entres on the fname linked list. (Normally there is only
  433. * one entry on the linked list, unless there are 62 bit hash collisions.)
  434. */
  435. static int call_filldir(struct file *file, struct dir_context *ctx,
  436. struct fname *fname)
  437. {
  438. struct dir_private_info *info = file->private_data;
  439. struct inode *inode = file_inode(file);
  440. struct super_block *sb = inode->i_sb;
  441. if (!fname) {
  442. ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: comm %s: "
  443. "called with null fname?!?", __func__, __LINE__,
  444. inode->i_ino, current->comm);
  445. return 0;
  446. }
  447. ctx->pos = hash2pos(file, fname->hash, fname->minor_hash);
  448. while (fname) {
  449. if (!dir_emit(ctx, fname->name,
  450. fname->name_len,
  451. fname->inode,
  452. get_dtype(sb, fname->file_type))) {
  453. info->extra_fname = fname;
  454. return 1;
  455. }
  456. fname = fname->next;
  457. }
  458. return 0;
  459. }
  460. static int ext4_dx_readdir(struct file *file, struct dir_context *ctx)
  461. {
  462. struct dir_private_info *info = file->private_data;
  463. struct inode *inode = file_inode(file);
  464. struct fname *fname;
  465. int ret;
  466. if (!info) {
  467. info = ext4_htree_create_dir_info(file, ctx->pos);
  468. if (!info)
  469. return -ENOMEM;
  470. file->private_data = info;
  471. }
  472. if (ctx->pos == ext4_get_htree_eof(file))
  473. return 0; /* EOF */
  474. /* Some one has messed with f_pos; reset the world */
  475. if (info->last_pos != ctx->pos) {
  476. free_rb_tree_fname(&info->root);
  477. info->curr_node = NULL;
  478. info->extra_fname = NULL;
  479. info->curr_hash = pos2maj_hash(file, ctx->pos);
  480. info->curr_minor_hash = pos2min_hash(file, ctx->pos);
  481. }
  482. /*
  483. * If there are any leftover names on the hash collision
  484. * chain, return them first.
  485. */
  486. if (info->extra_fname) {
  487. if (call_filldir(file, ctx, info->extra_fname))
  488. goto finished;
  489. info->extra_fname = NULL;
  490. goto next_node;
  491. } else if (!info->curr_node)
  492. info->curr_node = rb_first(&info->root);
  493. while (1) {
  494. /*
  495. * Fill the rbtree if we have no more entries,
  496. * or the inode has changed since we last read in the
  497. * cached entries.
  498. */
  499. if ((!info->curr_node) ||
  500. (file->f_version != inode->i_version)) {
  501. info->curr_node = NULL;
  502. free_rb_tree_fname(&info->root);
  503. file->f_version = inode->i_version;
  504. ret = ext4_htree_fill_tree(file, info->curr_hash,
  505. info->curr_minor_hash,
  506. &info->next_hash);
  507. if (ret < 0)
  508. return ret;
  509. if (ret == 0) {
  510. ctx->pos = ext4_get_htree_eof(file);
  511. break;
  512. }
  513. info->curr_node = rb_first(&info->root);
  514. }
  515. fname = rb_entry(info->curr_node, struct fname, rb_hash);
  516. info->curr_hash = fname->hash;
  517. info->curr_minor_hash = fname->minor_hash;
  518. if (call_filldir(file, ctx, fname))
  519. break;
  520. next_node:
  521. info->curr_node = rb_next(info->curr_node);
  522. if (info->curr_node) {
  523. fname = rb_entry(info->curr_node, struct fname,
  524. rb_hash);
  525. info->curr_hash = fname->hash;
  526. info->curr_minor_hash = fname->minor_hash;
  527. } else {
  528. if (info->next_hash == ~0) {
  529. ctx->pos = ext4_get_htree_eof(file);
  530. break;
  531. }
  532. info->curr_hash = info->next_hash;
  533. info->curr_minor_hash = 0;
  534. }
  535. }
  536. finished:
  537. info->last_pos = ctx->pos;
  538. return 0;
  539. }
  540. static int ext4_dir_open(struct inode * inode, struct file * filp)
  541. {
  542. if (ext4_encrypted_inode(inode))
  543. return ext4_get_encryption_info(inode) ? -EACCES : 0;
  544. return 0;
  545. }
  546. static int ext4_release_dir(struct inode *inode, struct file *filp)
  547. {
  548. if (filp->private_data)
  549. ext4_htree_free_dir_info(filp->private_data);
  550. return 0;
  551. }
  552. int ext4_check_all_de(struct inode *dir, struct buffer_head *bh, void *buf,
  553. int buf_size)
  554. {
  555. struct ext4_dir_entry_2 *de;
  556. int nlen, rlen;
  557. unsigned int offset = 0;
  558. char *top;
  559. de = (struct ext4_dir_entry_2 *)buf;
  560. top = buf + buf_size;
  561. while ((char *) de < top) {
  562. if (ext4_check_dir_entry(dir, NULL, de, bh,
  563. buf, buf_size, offset))
  564. return -EIO;
  565. nlen = EXT4_DIR_REC_LEN(de->name_len);
  566. rlen = ext4_rec_len_from_disk(de->rec_len, buf_size);
  567. de = (struct ext4_dir_entry_2 *)((char *)de + rlen);
  568. offset += rlen;
  569. }
  570. if ((char *) de > top)
  571. return -EIO;
  572. return 0;
  573. }
  574. const struct file_operations ext4_dir_operations = {
  575. .llseek = ext4_dir_llseek,
  576. .read = generic_read_dir,
  577. .iterate = ext4_readdir,
  578. .unlocked_ioctl = ext4_ioctl,
  579. #ifdef CONFIG_COMPAT
  580. .compat_ioctl = ext4_compat_ioctl,
  581. #endif
  582. .fsync = ext4_sync_file,
  583. .open = ext4_dir_open,
  584. .release = ext4_release_dir,
  585. };