4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/f2fs_fs.h>
18 static unsigned long dir_blocks(struct inode
*inode
)
20 return ((unsigned long long) (i_size_read(inode
) + PAGE_CACHE_SIZE
- 1))
24 static unsigned int dir_buckets(unsigned int level
, int dir_level
)
26 if (level
+ dir_level
< MAX_DIR_HASH_DEPTH
/ 2)
27 return 1 << (level
+ dir_level
);
29 return MAX_DIR_BUCKETS
;
32 static unsigned int bucket_blocks(unsigned int level
)
34 if (level
< MAX_DIR_HASH_DEPTH
/ 2)
40 unsigned char f2fs_filetype_table
[F2FS_FT_MAX
] = {
41 [F2FS_FT_UNKNOWN
] = DT_UNKNOWN
,
42 [F2FS_FT_REG_FILE
] = DT_REG
,
43 [F2FS_FT_DIR
] = DT_DIR
,
44 [F2FS_FT_CHRDEV
] = DT_CHR
,
45 [F2FS_FT_BLKDEV
] = DT_BLK
,
46 [F2FS_FT_FIFO
] = DT_FIFO
,
47 [F2FS_FT_SOCK
] = DT_SOCK
,
48 [F2FS_FT_SYMLINK
] = DT_LNK
,
52 static unsigned char f2fs_type_by_mode
[S_IFMT
>> S_SHIFT
] = {
53 [S_IFREG
>> S_SHIFT
] = F2FS_FT_REG_FILE
,
54 [S_IFDIR
>> S_SHIFT
] = F2FS_FT_DIR
,
55 [S_IFCHR
>> S_SHIFT
] = F2FS_FT_CHRDEV
,
56 [S_IFBLK
>> S_SHIFT
] = F2FS_FT_BLKDEV
,
57 [S_IFIFO
>> S_SHIFT
] = F2FS_FT_FIFO
,
58 [S_IFSOCK
>> S_SHIFT
] = F2FS_FT_SOCK
,
59 [S_IFLNK
>> S_SHIFT
] = F2FS_FT_SYMLINK
,
62 void set_de_type(struct f2fs_dir_entry
*de
, struct inode
*inode
)
64 umode_t mode
= inode
->i_mode
;
65 de
->file_type
= f2fs_type_by_mode
[(mode
& S_IFMT
) >> S_SHIFT
];
68 static unsigned long dir_block_index(unsigned int level
,
69 int dir_level
, unsigned int idx
)
72 unsigned long bidx
= 0;
74 for (i
= 0; i
< level
; i
++)
75 bidx
+= dir_buckets(i
, dir_level
) * bucket_blocks(i
);
76 bidx
+= idx
* bucket_blocks(level
);
80 static bool early_match_name(size_t namelen
, f2fs_hash_t namehash
,
81 struct f2fs_dir_entry
*de
)
83 if (le16_to_cpu(de
->name_len
) != namelen
)
86 if (de
->hash_code
!= namehash
)
92 static struct f2fs_dir_entry
*find_in_block(struct page
*dentry_page
,
93 struct qstr
*name
, int *max_slots
,
94 struct page
**res_page
)
96 struct f2fs_dentry_block
*dentry_blk
;
97 struct f2fs_dir_entry
*de
;
98 struct f2fs_dentry_ptr d
;
100 dentry_blk
= (struct f2fs_dentry_block
*)kmap(dentry_page
);
102 make_dentry_ptr(&d
, (void *)dentry_blk
, 1);
103 de
= find_target_dentry(name
, max_slots
, &d
);
106 *res_page
= dentry_page
;
111 * For the most part, it should be a bug when name_len is zero.
112 * We stop here for figuring out where the bugs has occurred.
114 f2fs_bug_on(F2FS_P_SB(dentry_page
), d
.max
< 0);
118 struct f2fs_dir_entry
*find_target_dentry(struct qstr
*name
, int *max_slots
,
119 struct f2fs_dentry_ptr
*d
)
121 struct f2fs_dir_entry
*de
;
122 unsigned long bit_pos
= 0;
123 f2fs_hash_t namehash
= f2fs_dentry_hash(name
);
128 while (bit_pos
< d
->max
) {
129 if (!test_bit_le(bit_pos
, d
->bitmap
)) {
132 else if (!test_bit_le(bit_pos
- 1, d
->bitmap
))
137 de
= &d
->dentry
[bit_pos
];
138 if (early_match_name(name
->len
, namehash
, de
) &&
139 !memcmp(d
->filename
[bit_pos
], name
->name
, name
->len
))
142 if (max_slots
&& *max_slots
>= 0 && max_len
> *max_slots
) {
143 *max_slots
= max_len
;
147 /* remain bug on condition */
148 if (unlikely(!de
->name_len
))
151 bit_pos
+= GET_DENTRY_SLOTS(le16_to_cpu(de
->name_len
));
156 if (max_slots
&& max_len
> *max_slots
)
157 *max_slots
= max_len
;
161 static struct f2fs_dir_entry
*find_in_level(struct inode
*dir
,
162 unsigned int level
, struct qstr
*name
,
163 f2fs_hash_t namehash
, struct page
**res_page
)
165 int s
= GET_DENTRY_SLOTS(name
->len
);
166 unsigned int nbucket
, nblock
;
167 unsigned int bidx
, end_block
;
168 struct page
*dentry_page
;
169 struct f2fs_dir_entry
*de
= NULL
;
173 f2fs_bug_on(F2FS_I_SB(dir
), level
> MAX_DIR_HASH_DEPTH
);
175 nbucket
= dir_buckets(level
, F2FS_I(dir
)->i_dir_level
);
176 nblock
= bucket_blocks(level
);
178 bidx
= dir_block_index(level
, F2FS_I(dir
)->i_dir_level
,
179 le32_to_cpu(namehash
) % nbucket
);
180 end_block
= bidx
+ nblock
;
182 for (; bidx
< end_block
; bidx
++) {
183 /* no need to allocate new dentry pages to all the indices */
184 dentry_page
= find_data_page(dir
, bidx
, true);
185 if (IS_ERR(dentry_page
)) {
190 de
= find_in_block(dentry_page
, name
, &max_slots
, res_page
);
196 f2fs_put_page(dentry_page
, 0);
199 if (!de
&& room
&& F2FS_I(dir
)->chash
!= namehash
) {
200 F2FS_I(dir
)->chash
= namehash
;
201 F2FS_I(dir
)->clevel
= level
;
208 * Find an entry in the specified directory with the wanted name.
209 * It returns the page where the entry was found (as a parameter - res_page),
210 * and the entry itself. Page is returned mapped and unlocked.
211 * Entry is guaranteed to be valid.
213 struct f2fs_dir_entry
*f2fs_find_entry(struct inode
*dir
,
214 struct qstr
*child
, struct page
**res_page
)
216 unsigned long npages
= dir_blocks(dir
);
217 struct f2fs_dir_entry
*de
= NULL
;
218 f2fs_hash_t name_hash
;
219 unsigned int max_depth
;
222 if (f2fs_has_inline_dentry(dir
))
223 return find_in_inline_dir(dir
, child
, res_page
);
230 name_hash
= f2fs_dentry_hash(child
);
231 max_depth
= F2FS_I(dir
)->i_current_depth
;
233 for (level
= 0; level
< max_depth
; level
++) {
234 de
= find_in_level(dir
, level
, child
, name_hash
, res_page
);
238 if (!de
&& F2FS_I(dir
)->chash
!= name_hash
) {
239 F2FS_I(dir
)->chash
= name_hash
;
240 F2FS_I(dir
)->clevel
= level
- 1;
245 struct f2fs_dir_entry
*f2fs_parent_dir(struct inode
*dir
, struct page
**p
)
248 struct f2fs_dir_entry
*de
;
249 struct f2fs_dentry_block
*dentry_blk
;
251 if (f2fs_has_inline_dentry(dir
))
252 return f2fs_parent_inline_dir(dir
, p
);
254 page
= get_lock_data_page(dir
, 0);
258 dentry_blk
= kmap(page
);
259 de
= &dentry_blk
->dentry
[1];
265 ino_t
f2fs_inode_by_name(struct inode
*dir
, struct qstr
*qstr
)
268 struct f2fs_dir_entry
*de
;
271 de
= f2fs_find_entry(dir
, qstr
, &page
);
273 res
= le32_to_cpu(de
->ino
);
274 f2fs_dentry_kunmap(dir
, page
);
275 f2fs_put_page(page
, 0);
281 void f2fs_set_link(struct inode
*dir
, struct f2fs_dir_entry
*de
,
282 struct page
*page
, struct inode
*inode
)
284 enum page_type type
= f2fs_has_inline_dentry(dir
) ? NODE
: DATA
;
286 f2fs_wait_on_page_writeback(page
, type
);
287 de
->ino
= cpu_to_le32(inode
->i_ino
);
288 set_de_type(de
, inode
);
289 f2fs_dentry_kunmap(dir
, page
);
290 set_page_dirty(page
);
291 dir
->i_mtime
= dir
->i_ctime
= CURRENT_TIME
;
292 mark_inode_dirty(dir
);
294 f2fs_put_page(page
, 1);
297 static void init_dent_inode(const struct qstr
*name
, struct page
*ipage
)
299 struct f2fs_inode
*ri
;
301 f2fs_wait_on_page_writeback(ipage
, NODE
);
303 /* copy name info. to this inode page */
304 ri
= F2FS_INODE(ipage
);
305 ri
->i_namelen
= cpu_to_le32(name
->len
);
306 memcpy(ri
->i_name
, name
->name
, name
->len
);
307 set_page_dirty(ipage
);
310 int update_dent_inode(struct inode
*inode
, const struct qstr
*name
)
314 page
= get_node_page(F2FS_I_SB(inode
), inode
->i_ino
);
316 return PTR_ERR(page
);
318 init_dent_inode(name
, page
);
319 f2fs_put_page(page
, 1);
324 void do_make_empty_dir(struct inode
*inode
, struct inode
*parent
,
325 struct f2fs_dentry_ptr
*d
)
327 struct f2fs_dir_entry
*de
;
330 de
->name_len
= cpu_to_le16(1);
332 de
->ino
= cpu_to_le32(inode
->i_ino
);
333 memcpy(d
->filename
[0], ".", 1);
334 set_de_type(de
, inode
);
338 de
->name_len
= cpu_to_le16(2);
339 de
->ino
= cpu_to_le32(parent
->i_ino
);
340 memcpy(d
->filename
[1], "..", 2);
341 set_de_type(de
, inode
);
343 test_and_set_bit_le(0, (void *)d
->bitmap
);
344 test_and_set_bit_le(1, (void *)d
->bitmap
);
347 static int make_empty_dir(struct inode
*inode
,
348 struct inode
*parent
, struct page
*page
)
350 struct page
*dentry_page
;
351 struct f2fs_dentry_block
*dentry_blk
;
352 struct f2fs_dentry_ptr d
;
354 if (f2fs_has_inline_dentry(inode
))
355 return make_empty_inline_dir(inode
, parent
, page
);
357 dentry_page
= get_new_data_page(inode
, page
, 0, true);
358 if (IS_ERR(dentry_page
))
359 return PTR_ERR(dentry_page
);
361 dentry_blk
= kmap_atomic(dentry_page
);
363 make_dentry_ptr(&d
, (void *)dentry_blk
, 1);
364 do_make_empty_dir(inode
, parent
, &d
);
366 kunmap_atomic(dentry_blk
);
368 set_page_dirty(dentry_page
);
369 f2fs_put_page(dentry_page
, 1);
373 struct page
*init_inode_metadata(struct inode
*inode
, struct inode
*dir
,
374 const struct qstr
*name
, struct page
*dpage
)
379 if (is_inode_flag_set(F2FS_I(inode
), FI_NEW_INODE
)) {
380 page
= new_inode_page(inode
);
384 if (S_ISDIR(inode
->i_mode
)) {
385 err
= make_empty_dir(inode
, dir
, page
);
390 err
= f2fs_init_acl(inode
, dir
, page
, dpage
);
394 err
= f2fs_init_security(inode
, dir
, name
, page
);
398 page
= get_node_page(F2FS_I_SB(dir
), inode
->i_ino
);
402 set_cold_node(inode
, page
);
406 init_dent_inode(name
, page
);
409 * This file should be checkpointed during fsync.
410 * We lost i_pino from now on.
412 if (is_inode_flag_set(F2FS_I(inode
), FI_INC_LINK
)) {
413 file_lost_pino(inode
);
415 * If link the tmpfile to alias through linkat path,
416 * we should remove this inode from orphan list.
418 if (inode
->i_nlink
== 0)
419 remove_orphan_inode(F2FS_I_SB(dir
), inode
->i_ino
);
425 f2fs_put_page(page
, 1);
427 /* once the failed inode becomes a bad inode, i_mode is S_IFREG */
428 truncate_inode_pages(&inode
->i_data
, 0);
429 truncate_blocks(inode
, 0, false);
430 remove_dirty_dir_inode(inode
);
431 remove_inode_page(inode
);
435 void update_parent_metadata(struct inode
*dir
, struct inode
*inode
,
436 unsigned int current_depth
)
438 if (is_inode_flag_set(F2FS_I(inode
), FI_NEW_INODE
)) {
439 if (S_ISDIR(inode
->i_mode
)) {
441 set_inode_flag(F2FS_I(dir
), FI_UPDATE_DIR
);
443 clear_inode_flag(F2FS_I(inode
), FI_NEW_INODE
);
445 dir
->i_mtime
= dir
->i_ctime
= CURRENT_TIME
;
446 mark_inode_dirty(dir
);
448 if (F2FS_I(dir
)->i_current_depth
!= current_depth
) {
449 F2FS_I(dir
)->i_current_depth
= current_depth
;
450 set_inode_flag(F2FS_I(dir
), FI_UPDATE_DIR
);
453 if (is_inode_flag_set(F2FS_I(inode
), FI_INC_LINK
))
454 clear_inode_flag(F2FS_I(inode
), FI_INC_LINK
);
457 int room_for_filename(const void *bitmap
, int slots
, int max_slots
)
460 int zero_start
, zero_end
;
462 zero_start
= find_next_zero_bit_le(bitmap
, max_slots
, bit_start
);
463 if (zero_start
>= max_slots
)
466 zero_end
= find_next_bit_le(bitmap
, max_slots
, zero_start
);
467 if (zero_end
- zero_start
>= slots
)
470 bit_start
= zero_end
+ 1;
472 if (zero_end
+ 1 >= max_slots
)
478 * Caller should grab and release a rwsem by calling f2fs_lock_op() and
481 int __f2fs_add_link(struct inode
*dir
, const struct qstr
*name
,
484 unsigned int bit_pos
;
486 unsigned int current_depth
;
487 unsigned long bidx
, block
;
488 f2fs_hash_t dentry_hash
;
489 struct f2fs_dir_entry
*de
;
490 unsigned int nbucket
, nblock
;
491 size_t namelen
= name
->len
;
492 struct page
*dentry_page
= NULL
;
493 struct f2fs_dentry_block
*dentry_blk
= NULL
;
494 int slots
= GET_DENTRY_SLOTS(namelen
);
499 if (f2fs_has_inline_dentry(dir
)) {
500 err
= f2fs_add_inline_entry(dir
, name
, inode
);
501 if (!err
|| err
!= -EAGAIN
)
507 dentry_hash
= f2fs_dentry_hash(name
);
509 current_depth
= F2FS_I(dir
)->i_current_depth
;
510 if (F2FS_I(dir
)->chash
== dentry_hash
) {
511 level
= F2FS_I(dir
)->clevel
;
512 F2FS_I(dir
)->chash
= 0;
516 if (unlikely(current_depth
== MAX_DIR_HASH_DEPTH
))
519 /* Increase the depth, if required */
520 if (level
== current_depth
)
523 nbucket
= dir_buckets(level
, F2FS_I(dir
)->i_dir_level
);
524 nblock
= bucket_blocks(level
);
526 bidx
= dir_block_index(level
, F2FS_I(dir
)->i_dir_level
,
527 (le32_to_cpu(dentry_hash
) % nbucket
));
529 for (block
= bidx
; block
<= (bidx
+ nblock
- 1); block
++) {
530 dentry_page
= get_new_data_page(dir
, NULL
, block
, true);
531 if (IS_ERR(dentry_page
))
532 return PTR_ERR(dentry_page
);
534 dentry_blk
= kmap(dentry_page
);
535 bit_pos
= room_for_filename(&dentry_blk
->dentry_bitmap
,
536 slots
, NR_DENTRY_IN_BLOCK
);
537 if (bit_pos
< NR_DENTRY_IN_BLOCK
)
541 f2fs_put_page(dentry_page
, 1);
544 /* Move to next level to find the empty slot for new dentry */
548 f2fs_wait_on_page_writeback(dentry_page
, DATA
);
550 down_write(&F2FS_I(inode
)->i_sem
);
551 page
= init_inode_metadata(inode
, dir
, name
, NULL
);
556 de
= &dentry_blk
->dentry
[bit_pos
];
557 de
->hash_code
= dentry_hash
;
558 de
->name_len
= cpu_to_le16(namelen
);
559 memcpy(dentry_blk
->filename
[bit_pos
], name
->name
, name
->len
);
560 de
->ino
= cpu_to_le32(inode
->i_ino
);
561 set_de_type(de
, inode
);
562 for (i
= 0; i
< slots
; i
++)
563 test_and_set_bit_le(bit_pos
+ i
, &dentry_blk
->dentry_bitmap
);
564 set_page_dirty(dentry_page
);
566 /* we don't need to mark_inode_dirty now */
567 F2FS_I(inode
)->i_pino
= dir
->i_ino
;
568 update_inode(inode
, page
);
569 f2fs_put_page(page
, 1);
571 update_parent_metadata(dir
, inode
, current_depth
);
573 up_write(&F2FS_I(inode
)->i_sem
);
575 if (is_inode_flag_set(F2FS_I(dir
), FI_UPDATE_DIR
)) {
576 update_inode_page(dir
);
577 clear_inode_flag(F2FS_I(dir
), FI_UPDATE_DIR
);
580 f2fs_put_page(dentry_page
, 1);
584 int f2fs_do_tmpfile(struct inode
*inode
, struct inode
*dir
)
589 down_write(&F2FS_I(inode
)->i_sem
);
590 page
= init_inode_metadata(inode
, dir
, NULL
, NULL
);
595 /* we don't need to mark_inode_dirty now */
596 update_inode(inode
, page
);
597 f2fs_put_page(page
, 1);
599 clear_inode_flag(F2FS_I(inode
), FI_NEW_INODE
);
601 up_write(&F2FS_I(inode
)->i_sem
);
605 void f2fs_drop_nlink(struct inode
*dir
, struct inode
*inode
, struct page
*page
)
607 struct f2fs_sb_info
*sbi
= F2FS_I_SB(dir
);
609 down_write(&F2FS_I(inode
)->i_sem
);
611 if (S_ISDIR(inode
->i_mode
)) {
614 update_inode(dir
, page
);
616 update_inode_page(dir
);
618 inode
->i_ctime
= CURRENT_TIME
;
621 if (S_ISDIR(inode
->i_mode
)) {
623 i_size_write(inode
, 0);
625 up_write(&F2FS_I(inode
)->i_sem
);
626 update_inode_page(inode
);
628 if (inode
->i_nlink
== 0)
629 add_orphan_inode(sbi
, inode
->i_ino
);
631 release_orphan_inode(sbi
);
635 * It only removes the dentry from the dentry page, corresponding name
636 * entry in name page does not need to be touched during deletion.
638 void f2fs_delete_entry(struct f2fs_dir_entry
*dentry
, struct page
*page
,
639 struct inode
*dir
, struct inode
*inode
)
641 struct f2fs_dentry_block
*dentry_blk
;
642 unsigned int bit_pos
;
643 int slots
= GET_DENTRY_SLOTS(le16_to_cpu(dentry
->name_len
));
646 if (f2fs_has_inline_dentry(dir
))
647 return f2fs_delete_inline_entry(dentry
, page
, dir
, inode
);
650 f2fs_wait_on_page_writeback(page
, DATA
);
652 dentry_blk
= page_address(page
);
653 bit_pos
= dentry
- dentry_blk
->dentry
;
654 for (i
= 0; i
< slots
; i
++)
655 clear_bit_le(bit_pos
+ i
, &dentry_blk
->dentry_bitmap
);
657 /* Let's check and deallocate this dentry page */
658 bit_pos
= find_next_bit_le(&dentry_blk
->dentry_bitmap
,
661 kunmap(page
); /* kunmap - pair of f2fs_find_entry */
662 set_page_dirty(page
);
664 dir
->i_ctime
= dir
->i_mtime
= CURRENT_TIME
;
667 f2fs_drop_nlink(dir
, inode
, NULL
);
669 if (bit_pos
== NR_DENTRY_IN_BLOCK
) {
670 truncate_hole(dir
, page
->index
, page
->index
+ 1);
671 clear_page_dirty_for_io(page
);
672 ClearPageUptodate(page
);
673 inode_dec_dirty_pages(dir
);
675 f2fs_put_page(page
, 1);
678 bool f2fs_empty_dir(struct inode
*dir
)
681 struct page
*dentry_page
;
682 unsigned int bit_pos
;
683 struct f2fs_dentry_block
*dentry_blk
;
684 unsigned long nblock
= dir_blocks(dir
);
686 if (f2fs_has_inline_dentry(dir
))
687 return f2fs_empty_inline_dir(dir
);
689 for (bidx
= 0; bidx
< nblock
; bidx
++) {
690 dentry_page
= get_lock_data_page(dir
, bidx
);
691 if (IS_ERR(dentry_page
)) {
692 if (PTR_ERR(dentry_page
) == -ENOENT
)
698 dentry_blk
= kmap_atomic(dentry_page
);
703 bit_pos
= find_next_bit_le(&dentry_blk
->dentry_bitmap
,
706 kunmap_atomic(dentry_blk
);
708 f2fs_put_page(dentry_page
, 1);
710 if (bit_pos
< NR_DENTRY_IN_BLOCK
)
716 bool f2fs_fill_dentries(struct dir_context
*ctx
, struct f2fs_dentry_ptr
*d
,
717 unsigned int start_pos
)
719 unsigned char d_type
= DT_UNKNOWN
;
720 unsigned int bit_pos
;
721 struct f2fs_dir_entry
*de
= NULL
;
723 bit_pos
= ((unsigned long)ctx
->pos
% d
->max
);
725 while (bit_pos
< d
->max
) {
726 bit_pos
= find_next_bit_le(d
->bitmap
, d
->max
, bit_pos
);
727 if (bit_pos
>= d
->max
)
730 de
= &d
->dentry
[bit_pos
];
731 if (de
->file_type
< F2FS_FT_MAX
)
732 d_type
= f2fs_filetype_table
[de
->file_type
];
735 if (!dir_emit(ctx
, d
->filename
[bit_pos
],
736 le16_to_cpu(de
->name_len
),
737 le32_to_cpu(de
->ino
), d_type
))
740 bit_pos
+= GET_DENTRY_SLOTS(le16_to_cpu(de
->name_len
));
741 ctx
->pos
= start_pos
+ bit_pos
;
746 static int f2fs_readdir(struct file
*file
, struct dir_context
*ctx
)
748 struct inode
*inode
= file_inode(file
);
749 unsigned long npages
= dir_blocks(inode
);
750 struct f2fs_dentry_block
*dentry_blk
= NULL
;
751 struct page
*dentry_page
= NULL
;
752 struct file_ra_state
*ra
= &file
->f_ra
;
753 unsigned int n
= ((unsigned long)ctx
->pos
/ NR_DENTRY_IN_BLOCK
);
754 struct f2fs_dentry_ptr d
;
756 if (f2fs_has_inline_dentry(inode
))
757 return f2fs_read_inline_dir(file
, ctx
);
759 /* readahead for multi pages of dir */
760 if (npages
- n
> 1 && !ra_has_index(ra
, n
))
761 page_cache_sync_readahead(inode
->i_mapping
, ra
, file
, n
,
762 min(npages
- n
, (pgoff_t
)MAX_DIR_RA_PAGES
));
764 for (; n
< npages
; n
++) {
765 dentry_page
= get_lock_data_page(inode
, n
);
766 if (IS_ERR(dentry_page
))
769 dentry_blk
= kmap(dentry_page
);
771 make_dentry_ptr(&d
, (void *)dentry_blk
, 1);
773 if (f2fs_fill_dentries(ctx
, &d
, n
* NR_DENTRY_IN_BLOCK
))
776 ctx
->pos
= (n
+ 1) * NR_DENTRY_IN_BLOCK
;
778 f2fs_put_page(dentry_page
, 1);
782 if (dentry_page
&& !IS_ERR(dentry_page
)) {
784 f2fs_put_page(dentry_page
, 1);
790 const struct file_operations f2fs_dir_operations
= {
791 .llseek
= generic_file_llseek
,
792 .read
= generic_read_dir
,
793 .iterate
= f2fs_readdir
,
794 .fsync
= f2fs_sync_file
,
795 .unlocked_ioctl
= f2fs_ioctl
,